Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f4f5e767d0b6eec1351fa9fb1f1224287a668edc
      
https://github.com/WebKit/WebKit/commit/f4f5e767d0b6eec1351fa9fb1f1224287a668edc
  Author: Elijah Sawyers <esawy...@apple.com>
  Date:   2025-08-21 (Thu, 21 Aug 2025)

  Changed paths:
    M Source/WTF/wtf/PlatformEnableCocoa.h
    M Source/WebCore/contentextensions/ContentExtension.cpp
    M Source/WebCore/contentextensions/ContentExtensionActions.h
    M Source/WebCore/contentextensions/ContentExtensionCompiler.cpp
    M Source/WebCore/contentextensions/ContentExtensionError.cpp
    M Source/WebCore/contentextensions/ContentExtensionError.h
    M Source/WebCore/contentextensions/ContentExtensionParser.cpp
    M Source/WebCore/contentextensions/ContentExtensionRule.cpp
    M Source/WebCore/contentextensions/ContentExtensionRule.h
    M Source/WebCore/contentextensions/ContentExtensionsBackend.cpp
    M Source/WebCore/contentextensions/ContentRuleListMatchedRule.h
    M Source/WebCore/page/ChromeClient.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/APINavigationClient.h
    M Source/WebKit/UIProcess/Cocoa/NavigationState.h
    M Source/WebKit/UIProcess/Cocoa/NavigationState.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
    M Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp

  Log Message:
  -----------
  dNR: stop serializing rule identifiers with their actions and introduce a new 
action type instead
https://bugs.webkit.org/show_bug.cgi?id=297338
rdar://157879177

Reviewed by Timothy Hatcher and Alex Christensen.

This patch stops serializing rule identifiers with their actions. Previously, 
the goal was to have
a rule's identifier be serialized with its action, and we'd write a bit to the 
metadata to indicate
if serialized actions included identifiers. This meant that every rule had to 
have an identifier.

Now, during parsing, if a rule has an identifier, we create another rule that 
has the same trigger
but the new action type, ReportIdentifierAction. If we encounter this action 
while processing a load,
we publish the notification. Splitting out a rule's identifier into a separate 
rule has the benefit
of not requiring all rules to have an identifier, as well as being able to 
combine actions during
serialization. However, the downside is that we're consuming more memory than 
the aforementioned
approach.

Also, per the recommendation of @achristensen07, I removed the compile time 
guards from the content
extensions code. However, I did leave them for the web extensions code, as it's 
common practice.

Modified the pre-existing tests to verify this change.

* Source/WTF/wtf/PlatformEnableCocoa.h:
* Source/WebCore/contentextensions/ContentExtension.cpp:
(WebCore::ContentExtensions::ContentExtension::findFirstIgnoreRule const):
* Source/WebCore/contentextensions/ContentExtensionActions.h:
* Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:
(WebCore::ContentExtensions::serializeActions):
* Source/WebCore/contentextensions/ContentExtensionError.cpp:
(WebCore::ContentExtensions::contentExtensionErrorCategory):
* Source/WebCore/contentextensions/ContentExtensionError.h:
* Source/WebCore/contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::loadRule):
(WebCore::ContentExtensions::loadRuleIdentifier):
(WebCore::ContentExtensions::loadEncodedRules):
* Source/WebCore/contentextensions/ContentExtensionRule.cpp:
(WebCore::ContentExtensions::ContentExtensionRule::ContentExtensionRule):
(WebCore::ContentExtensions::DeserializedAction::deserialize):
* Source/WebCore/contentextensions/ContentExtensionRule.h:
(WebCore::ContentExtensions::ContentExtensionRule::isolatedCopy):
(WebCore::ContentExtensions::ContentExtensionRule::identifier const): Deleted.
* Source/WebCore/contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad):
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForPingLoad):
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForResourceMonitoring):
* Source/WebCore/contentextensions/ContentRuleListMatchedRule.h:
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::contentRuleListNotification):
(WebCore::ChromeClient::contentRuleListMatchedRule):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/APINavigationClient.h:
(API::NavigationClient::contentRuleListNotification):
(API::NavigationClient::contentRuleListMatchedRule):
* Source/WebKit/UIProcess/Cocoa/NavigationState.h:
* Source/WebKit/UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::contentRuleListNotification):
(WebKit::NavigationState::NavigationClient::contentRuleListMatchedRule):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contentRuleListNotification):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::contentRuleListMatchedRule):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::TEST_F(ContentExtensionTest, InvalidJSON)):
(TestWebKitAPI::TEST_F(ContentExtensionTest, ReportIdentifierAction)):
(TestWebKitAPI::TEST_F(ContentExtensionTest, RuleIdentifiers)): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to