[webkit-changes] [WebKit/WebKit] 1d5b79: Add support for specifying unsupported Web Extensi...
Timothy Hatcher
noreply at github.com
Tue Mar 26 18:40:08 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1d5b797b0b1d4322de1ae6a4fb4b48e1fd840efc
https://github.com/WebKit/WebKit/commit/1d5b797b0b1d4322de1ae6a4fb4b48e1fd840efc
Author: Timothy Hatcher <timothy at apple.com>
Date: 2024-03-26 (Tue, 26 Mar 2024)
Changed paths:
M Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h
M Source/WebKit/Shared/Extensions/WebExtensionContextParameters.serialization.in
M Source/WebKit/Shared/Extensions/WebExtensionDataType.h
M Source/WebKit/Shared/Extensions/WebExtensionEventListenerType.h
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.h
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIStorageCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIExtensionCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINamespaceCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebPageNamespaceCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWindowsCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIAction.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIAlarms.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPICommands.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPICookies.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDeclarativeNetRequest.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevTools.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevToolsExtensionPanel.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevToolsInspectedWindow.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevToolsNetwork.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevToolsPanels.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIEvent.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIExtension.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPILocalization.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIMenus.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINamespace.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINotifications.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIObject.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIPermissions.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIPort.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIRuntime.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIScripting.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorage.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorageArea.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITabs.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITest.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebNavigation.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebNavigationEvent.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebPageNamespace.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebRequest.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebRequestEvent.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindows.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindowsEvent.h
M Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm
M Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPINamespace.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWindows.mm
Log Message:
-----------
Add support for specifying unsupported Web Extension APIs.
https://webkit.org/b/271733
rdar://116824851
Reviewed by Jeff Miller.
Add an `unsupportedAPIs` property on `_WKWebExtensionContext` that allows the app to specify a
subset of web extension APIs that it chooses not to support, effectively making these APIs
`undefined` within the extension's JavaScript contexts. This enables extensions to employ
feature detection techniques for unsupported APIs, allowing them to adapt their behavior based
on the APIs actually supported by the app. Setting is only allowed when the context is not
loaded. Only certain APIs can be specified here, particularly those within the `browser`
namespace and other dynamic functions and properties, anything else will be silently ignored.
This adds a new `propertyPath()` method on `WebExtensionAPIObject` that allows the individual
APIs to know the full JavaScript path to their object for lookup purposes, and can be used for
logging and error strings in the future.
* Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h:
* Source/WebKit/Shared/Extensions/WebExtensionContextParameters.serialization.in:
* Source/WebKit/Shared/Extensions/WebExtensionDataType.h:
(WebKit::toAPIString): Added.
(WebKit::toAPIPrefixString): Deleted.
* Source/WebKit/Shared/Extensions/WebExtensionEventListenerType.h:
(WebKit::toAPIString): Added.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.mm:
(-[_WKWebExtensionContext unsupportedAPIs]): Added.
(-[_WKWebExtensionContext setUnsupportedAPIs:]): Added.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIStorageCocoa.mm:
(WebKit::WebExtensionContext::storageGet): Fixed callingAPIName, since it should not be static.
(WebKit::WebExtensionContext::storageGetBytesInUse): Ditto.
(WebKit::WebExtensionContext::storageSet): Ditto.
(WebKit::WebExtensionContext::storageRemove): Ditto.
(WebKit::WebExtensionContext::storageClear): Ditto.
(WebKit::WebExtensionContext::storageSetAccessLevel): Ditto.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::setUnsupportedAPIs): Added.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp:
(WebKit::WebExtensionContext::parameters const):
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
(WebKit::WebExtensionContext::unsupportedAPIs const):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIExtensionCocoa.mm:
(WebKit::WebExtensionAPIExtension::isPropertyAllowed):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINamespaceCocoa.mm:
(WebKit::WebExtensionAPINamespace::isPropertyAllowed):
(WebKit::WebExtensionAPINamespace::runtime const):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm:
(WebKit::WebExtensionAPIRuntime::isPropertyAllowed):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm:
(WebKit::WebExtensionAPIStorageArea::isPropertyAllowed):
(WebKit::WebExtensionAPIStorageArea::get): Fixed the path to include storage.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageCocoa.mm:
(WebKit::WebExtensionAPIStorage::isPropertyAllowed):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm:
(WebKit::WebExtensionAPITabs::isPropertyAllowed):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebPageNamespaceCocoa.mm:
(WebKit::WebExtensionAPIWebPageNamespace::runtime const):
(WebKit::WebExtensionAPIWebPageNamespace::test):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWindowsCocoa.mm:
(WebKit::WebExtensionAPIWindows::isPropertyAllowed):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIAction.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIAlarms.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPICommands.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPICookies.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDeclarativeNetRequest.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevTools.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevToolsExtensionPanel.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevToolsInspectedWindow.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevToolsNetwork.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIDevToolsPanels.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIEvent.h:
(WebKit::WebExtensionAPIEvent::WebExtensionAPIEvent):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIExtension.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPILocalization.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIMenus.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINamespace.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINotifications.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIObject.h:
(WebKit::WebExtensionAPIObject::propertyPath const): Added.
(WebKit::WebExtensionAPIObject::setPropertyPath): Added.
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIPermissions.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIPort.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIRuntime.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIScripting.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorage.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorageArea.h:
(WebKit::WebExtensionAPIStorageArea::WebExtensionAPIStorageArea):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITabs.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITest.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebNavigation.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebNavigationEvent.h:
(WebKit::WebExtensionAPIWebNavigationEvent::WebExtensionAPIWebNavigationEvent):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebPageNamespace.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebRequest.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebRequestEvent.h:
(WebKit::WebExtensionAPIWebRequestEvent::WebExtensionAPIWebRequestEvent):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindows.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindowsEvent.h:
(WebKit::WebExtensionAPIWindowsEvent::WebExtensionAPIWindowsEvent):
* Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm:
(WebKit::WebExtensionContextProxy::getOrCreate):
(WebKit::WebExtensionContextProxy::isUnsupportedAPI const):
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPINamespace.mm:
(TEST(WKWebExtensionAPINamespace, NotificationsUnsupported)): Added.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWindows.mm:
(TEST(WKWebExtensionAPIWindows, RemoveUnsupported)): Added.
Canonical link: https://commits.webkit.org/276717@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