-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
e2b769d
commit 1093d60
Showing
6 changed files
with
287 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.