[webkit-changes] [WebKit/WebKit] 389494: Support `world` in `content_scripts` for Web Exten...
Timothy Hatcher
noreply at github.com
Mon Mar 11 09:23:55 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 38949431399cb8ca2a55db3cd3f1292f4fb0f1ca
https://github.com/WebKit/WebKit/commit/38949431399cb8ca2a55db3cd3f1292f4fb0f1ca
Author: Timothy Hatcher <timothy at apple.com>
Date: 2024-03-11 (Mon, 11 Mar 2024)
Changed paths:
M Source/WebCore/en.lproj/Localizable.strings
M Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
M Source/WebKit/Shared/Extensions/WebExtensionFrameParameters.h
M Source/WebKit/Shared/Extensions/WebExtensionMessageSenderParameters.h
M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIScriptingCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtension.h
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtension.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIScripting.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionContext.mm
Log Message:
-----------
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
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list