[webkit-changes] [WebKit/WebKit] c96350: declarativeNetRequest's content rule list should n...

Timothy Hatcher noreply at github.com
Mon Dec 11 15:21:26 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c96350ffd7304e47f9995a186719057c6fb12a60
      https://github.com/WebKit/WebKit/commit/c96350ffd7304e47f9995a186719057c6fb12a60
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2023-12-11 (Mon, 11 Dec 2023)

  Changed paths:
    M Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp
    M Source/WebKit/UIProcess/API/APIContentRuleListStore.h
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIDeclarativeNetRequest.mm

  Log Message:
  -----------
  declarativeNetRequest's content rule list should not use the identifier for the filename.
https://webkit.org/b/266198
rdar://problem/119469953

Reviewed by Brian Weinstein and Alex Christensen.

Removes the legacy filename support from APIContentRuleListStore, per the comment that it can
be removed in 2022-2023.

Adds methods to allow compile, lookup, and remove with an explicit file path. This allows the
Web Extension dNR code to store the file at the path it desires, bypassing APIContentRuleListStore's
automatic file management of an explicit storage directory for rule lists. Web Extensions store their
rule list in a unique directory alongside other extension state files, so the rule list file name
does not need be unique or contain the rule list identifier.

* Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:
(API::constructedPath): Drop legacy file name support. Added RELEASE_ASSERT for base.
(API::createExtension): Add some whitespace.
(API::getContentRuleListSourceFromMappedFile): Ditto.
(API::ContentRuleListStore::lookupContentRuleList): Call lookupContentRuleListFile.
(API::ContentRuleListStore::lookupContentRuleListFile): Added.
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers): Call compileContentRuleListFile.
(API::ContentRuleListStore::compileContentRuleList): Call compileContentRuleListFile.
(API::ContentRuleListStore::compileContentRuleListFile): Added.
(API::ContentRuleListStore::removeContentRuleList): Call removeContentRuleListFile.
(API::ContentRuleListStore::removeContentRuleListFile): Added.
(API::ContentRuleListStore::invalidateContentRuleListVersion): Drop false for legacy filename param.
(API::ContentRuleListStore::getContentRuleListSource): Drop legacy file name support.
* Source/WebKit/UIProcess/API/APIContentRuleListStore.h:
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::unloadDeclarativeNetRequestState):
(WebKit::WebExtensionContext::declarativeNetRequestContentRuleListFilePath): Added.
(WebKit::WebExtensionContext::addDeclarativeNetRequestRulesToPrivateUserContentControllers): Use API::ContentRuleListStore.
(WebKit::WebExtensionContext::compileDeclarativeNetRequestRules): Ditto.
(WebKit::WebExtensionContext::loadDeclarativeNetRequestRules): Ditto.
(WebKit::WebExtensionContext::declarativeNetRequestRuleStore): Deleted.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm: Deleted ContentRuleList.LegacyVersionAndName.

Canonical link: https://commits.webkit.org/271903@main




More information about the webkit-changes mailing list