-
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.
Content Script CSS overriding style attributes inconsistent.
https://webkit.org/b/273122 rdar://problem/126916972 Reviewed by Antti Koivisto. Change web extension content styles to be author level instead of user level by default. To allow extensions to still use user level, added support for `cssOrigin` in the `tabs.insertCSS()` options, as well as `origin` in the `scripting.insertCSS` options. Accepted values are `user` and `author`. In addition, this introduces `cssOrigin` in `scripting.registerContentScripts()` and `css_origin` for the `content_scripts` entry in the manifest. These are new options and are being discussed in the WECG at w3c/webextensions#414. * Source/WebCore/en.lproj/Localizable.strings: Updated. * Source/WebKit/Shared/Extensions/WebExtensionDynamicScripts.serialization.in: * Source/WebKit/Shared/Extensions/WebExtensionRegisteredScriptParameters.h: * Source/WebKit/Shared/Extensions/WebExtensionScriptInjectionParameters.h: * Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIScriptingCocoa.mm: (WebKit::WebExtensionContext::scriptingInsertCSS): (WebKit::WebExtensionContext::createInjectedContentForScripts): * Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm: (WebKit::WebExtensionContext::tabsInsertCSS): * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm: (WebKit::WebExtension::populateContentScriptPropertiesIfNeeded): * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm: (WebKit::WebExtensionContext::addInjectedContent): * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionDynamicScriptsCocoa.mm: (WebKit::WebExtensionDynamicScripts::injectStyleSheets): * Source/WebKit/UIProcess/Extensions/WebExtension.h: * Source/WebKit/UIProcess/Extensions/WebExtensionDynamicScripts.h: * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIScriptingCocoa.mm: (WebKit::toWebAPI): Added origin. (WebKit::WebExtensionAPIScripting::executeScript): Return early if outExceptionString is set. (WebKit::WebExtensionAPIScripting::insertCSS): Ditto. (WebKit::WebExtensionAPIScripting::removeCSS): Ditto. (WebKit::WebExtensionAPIScripting::validateCSS): Added origin. (WebKit::WebExtensionAPIScripting::validateRegisteredScripts): Ditto. (WebKit::WebExtensionAPIScripting::parseCSSInjectionOptions): Ditto. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm: (WebKit::WebExtensionAPITabs::parseScriptOptions): * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtension.mm: (TestWebKitAPI::TEST(WKWebExtension, ContentScriptsParsing)): Added new cases. * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIScripting.mm: (TestWebKitAPI::TEST(WKWebExtensionAPIScripting, ErrorsCSS)): Added new error case. (TestWebKitAPI::TEST(WKWebExtensionAPIScripting, ErrorsRegisteredContentScript)): Ditto. (TestWebKitAPI::TEST(WKWebExtensionAPIScripting, CSSUserOrigin)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIScripting, CSSAuthorOrigin)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIScripting, World)): Fixed test that was always passing. (TestWebKitAPI::TEST(WKWebExtensionAPIScripting, RegisterContentScriptsWithCSSUserOrigin)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPIScripting, RegisterContentScriptsWithCSSAuthorOrigin)): Added. * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm: (TestWebKitAPI::TEST(WKWebExtensionAPITabs, Errors)): Added new error case. (TestWebKitAPI::TEST(WKWebExtensionAPITabs, CSSUserOrigin)): Added. (TestWebKitAPI::TEST(WKWebExtensionAPITabs, CSSAuthorOrigin)): Added. * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionContext.mm: (TestWebKitAPI::TEST(WKWebExtensionContext, ContentScriptsParsing)): Added new cases. * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionController.mm: (TestWebKitAPI::TEST(WKWebExtensionController, CSSUserOrigin)): Added. (TestWebKitAPI::TEST(WKWebExtensionController, CSSAuthorOrigin)): Added. Canonical link: https://commits.webkit.org/278387@main
- Loading branch information
Showing
18 changed files
with
501 additions
and
17 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
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.