Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 64d63ae859b8dcdaf7a0e9be6e939527258caff4
      
https://github.com/WebKit/WebKit/commit/64d63ae859b8dcdaf7a0e9be6e939527258caff4
  Author: Elijah Sawyers <[email protected]>
  Date:   2025-06-06 (Fri, 06 Jun 2025)

  Changed paths:
    M 
Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionDeclarativeNetRequestRule.mm
    M 
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIDeclarativeNetRequest.mm

  Log Message:
  -----------
  dNR: allow and allowAllRequests rules aren't respecting priority
https://bugs.webkit.org/show_bug.cgi?id=293809
rdar://152193087

Reviewed by Timothy Hatcher.

This patch adopts the use of ignore-following-rules for correcting the sorting
of dNR rules. As it stands, higher priority allow and allowAllRequests rules
do not take precedence over lower priority block rules because the dNR rules
are converted into ignore-previous-rules in WebKit Content Blocking.

Now, dNR rules are sorted first by priority and then by rule type, so we have
rules correctly sorted like:

Priority | Type
---------------------------------
     100 | ignore-following-rules
     100 | block
     100 | modify-headers
     100 | redirect
     100 | make-https
---------------------------------
      10 | ignore-following-rules
      10 | block
      10 | modify-headers
      10 | redirect
      10 | make-https

Everywhere ignore-previous-rules was used was inverted, so for example, excluded
request methods/domains are added before requst methods/domains, make-https,
excluded initiator domains, etc. Also, the compare: method was update to invert
the order of the inherent rule type priorities.

* 
Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionDeclarativeNetRequestRule.mm:
(-[_WKWebExtensionDeclarativeNetRequestRule ruleInWebKitFormat]):
(-[_WKWebExtensionDeclarativeNetRequestRule 
_convertRulesWithModifiedCondition:webKitActionType:chromeActionType:]):
(-[_WKWebExtensionDeclarativeNetRequestRule compare:]):
* 
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIDeclarativeNetRequest.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
SubFrameResourceRuleConversion)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RepeatedMainFrameResourceRuleConversion)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
UpgradeSchemeRuleConversion)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
UpgradeSchemeForMainFrameRuleConversion)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RuleConversionWithNoSpecifiedResourceTypes)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RuleConversionWithExcludedInitiatorDomainsAndInitiatorDomains)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RuleConversionWithExcludedRequestDomains)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RuleConversionWithExcludedRequestMethods)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RuleConversionWithRequestMethodsAndExcludedRequestMethodsAndRequestDomainsAndExcludedRequestDomains)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RuleConversionWithAllowAllRequests)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RulesSortByPriorityFromDifferentRulesets)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RulesSortWithoutExplicitPriority)):
(TestWebKitAPI::TEST(WKWebExtensionAPIDeclarativeNetRequest, 
RulesSortByActionType)):

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



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

Reply via email to