Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1093d6012bcfd5c17dbd4710264729b559612699
      
https://github.com/WebKit/WebKit/commit/1093d6012bcfd5c17dbd4710264729b559612699
  Author: Brian Weinstein <[email protected]>
  Date:   2023-11-14 (Tue, 14 Nov 2023)

  Changed paths:
    M Source/WebCore/en.lproj/Localizable.strings
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtension.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtension.mm

  Log Message:
  -----------
  Parse web extension manifest for declarativeNetRequest rulesets
https://bugs.webkit.org/show_bug.cgi?id=264836
rdar://118415584

Reviewed by Timothy Hatcher.

This patch hooks up basic manifest parsing for declarativeNetRequest rule sets.

* Source/WebCore/en.lproj/Localizable.strings:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.mm:
(-[_WKWebExtension hasDeclarativeNetRequestRules]): Mostly added for testing at 
this point. Returns if there were any correctly parsed rulesets.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm:
(WebKit::WebExtension::errors): Call 
parseDeclarativeNetRequestRulesetDictionary.
(WebKit::WebExtension::declarativeNetRequestRulesets): Call 
populateDeclarativeNetRequestPropertiesIfNeeded and return the vector of 
rulesets.
(WebKit::WebExtension::parseDeclarativeNetRequestRulesetDictionary): Takes in a 
dictionary and returns an optional DeclarativeNetRequestRulesetData. This method
does argument type checking and makes sure the string arguments aren't nil or 
empty.
(WebKit::WebExtension::populateDeclarativeNetRequestPropertiesIfNeeded): Read 
the manifest and turn the JSON into a vector of 
DeclarativeNetRequestRulesetData. This
PR makes sure the extension doesn't specify too many rulesets, too many enabled 
rulesets, or multiple rulesets with the same id.
* Source/WebKit/UIProcess/Extensions/WebExtension.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtension.mm:
(TestWebKitAPI::TEST): Add some tests for the manifest parsing.

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to