[webkit-changes] [WebKit/WebKit] 5a1eb5: Use a timer to purged old matched rules
Brian Weinstein
noreply at github.com
Wed Dec 6 13:05:30 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5a1eb5d9c5cec2c7f696dc953963f56f246dc699
https://github.com/WebKit/WebKit/commit/5a1eb5d9c5cec2c7f696dc953963f56f246dc699
Author: Brian Weinstein <bweinstein at apple.com>
Date: 2023-12-06 (Wed, 06 Dec 2023)
Changed paths:
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
M Source/WebKit/UIProcess/Extensions/WebExtensionController.h
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIDeclarativeNetRequestCocoa.mm
Log Message:
-----------
Use a timer to purged old matched rules
https://bugs.webkit.org/show_bug.cgi?id=265950
rdar://118940129
Reviewed by Timothy Hatcher.
When a content rule list notification is saved as a matched rule by an extension, start a repeating 5 minute timer to purge
any rules that are older than 5 minutes.
If after the purge there aren't any remaining saved rules, stop the timer.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::handleContentRuleListNotificationForTab): This now returns a bool representing if the
notification was saved as a matched rule.
(WebKit::WebExtensionContext::purgeMatchedRulesFromBefore): Iterate over the rules and remove any that were from before the given
start time.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerCocoa.mm:
(WebKit::WebExtensionController::handleContentRuleListNotification): Start a timer if the action was saved and there wasn't a timer
started already.
(WebKit::WebExtensionController::purgeOldMatchedRules): Iterate over all of the extensions and call purgeMatchedRulesFromBefore.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionController.h:
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIDeclarativeNetRequestCocoa.mm:
(WebKit::WebExtensionAPIDeclarativeNetRequest::getMatchedRules): Remove an extra newline.
Canonical link: https://commits.webkit.org/271629@main
More information about the webkit-changes
mailing list