-
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.
Support
world
in content_scripts
for Web Extension manifests.
https://webkit.org/b/270748 rdar://problem/124331541 Reviewed by Brian Weinstein. Add support for the `world` key in `content_scripts`. Also changed the `forMainWorld` boolean to be `contentWorldType` and use `WebExtensionContentWorldType` for consistency. Drive-by fixes to provide missing default values for plain types to avoid random memory. * Source/WebCore/en.lproj/Localizable.strings: Updated with the script. * Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js: Ditto. * Source/WebKit/Shared/Extensions/WebExtensionFrameParameters.h: Add default value. * Source/WebKit/Shared/Extensions/WebExtensionMessageSenderParameters.h: Ditto. * Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIScriptingCocoa.mm: (WebKit::WebExtensionContext::scriptingExecuteScript): Use toContentWorld(). (WebKit::WebExtensionContext::createInjectedContentForScripts): Use contentWorldType. Also use value_or() in case the web process does not set the value. * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm: (WebKit::WebExtension::populateContentScriptPropertiesIfNeeded): Parse the `world` key. * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm: (WebKit::WebExtensionContext::toContentWorld const): Added. (WebKit::WebExtensionContext::addInjectedContent): Use toContentWorld(). * Source/WebKit/UIProcess/Extensions/WebExtension.h: * Source/WebKit/UIProcess/Extensions/WebExtensionContext.h: * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtension.mm: (TEST(WKWebExtension, ContentScriptsParsing)): Added `world` tests. * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIScripting.mm: (TEST(WKWebExtensionAPIScripting, MainWorld)): Added. (TEST(WKWebExtensionAPIScripting, IsolatedWorld)): Added. * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionContext.mm: (TEST(WKWebExtensionContext, ContentScriptsParsing)): Added `world` tests. Canonical link: https://commits.webkit.org/275909@main
- Loading branch information
Showing
12 changed files
with
191 additions
and
30 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
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.