-
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.
Add support for externally_connectable
https://bugs.webkit.org/show_bug.cgi?id=268856 rdar://122422972 Authors: Kiara Rose, Timothy Hatcher Reviewed by Timothy Hatcher. This patch creates seperate runtime and namespace objects to use for web pages that wish to send and receive messages from extensions. Also change how WebExtensionAPIObject tracks the world, and simplify child object creation by passing the parent object. This touched all the API files, those changed files are elided. Also change WebExtensionController to have a concept of testMode, so WebPage APIs can use the browser.test API too, without an extensionContext. This required changing the UI process WebExtensionContextAPITestCocoa to be WebExtensionControllerAPITestCocoa and changing the delegates to no longer get a context. This wasn't used, so it is fine to remove. * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources-output.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Shared/Extensions/WebExtensionContentWorldType.h: (WebKit::toDebugString): * Source/WebKit/Shared/Extensions/WebExtensionContentWorldType.serialization.in: Add a new WebExtensionContentWorldType::WebPage to distinguish messages being sent to and from web pages. * Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIPortCocoa.mm: (WebKit::WebExtensionContext::portPostMessage): (WebKit::WebExtensionContext::firePortDisconnectEventIfNeeded): Notify ports created from webPageRuntime.connect that the port was disconnected. * Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm: (WebKit::WebExtensionContext::runtimeWebPageSendMessage): (WebKit::WebExtensionContext::runtimeWebPageConnect): * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerCocoa.mm: (WebKit::WebExtensionController::extensionContext const): Mehtod to return extension context with a given unique identifier. * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionMatchPatternCocoa.mm: (WebKit::WebExtensionMatchPattern::matchesPatternSetContainsMatchForURL): Return true if one of the match pattern in the MatchPatternSet matches the given URL. * Source/WebKit/UIProcess/Extensions/WebExtensionContext.h: * Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in: * Source/WebKit/UIProcess/Extensions/WebExtensionController.h: * Source/WebKit/UIProcess/Extensions/WebExtensionMatchPattern.h: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm: (WebKit::WebExtensionAPIWebPageRuntime::sendMessage): (WebKit::WebExtensionAPIWebPageRuntime::connect): (WebKit::WebExtensionContextProxy::internalDispatchRuntimeMessageEvent): Use the contentWorldType from the sendersParameters to determine which onConnect listeners we should call. (WebKit::WebExtensionContextProxy::dispatchRuntimeMessageEvent): Event listeners cannot be added for the webPageRuntime namespace object. (WebKit::WebExtensionContextProxy::internalDispatchRuntimeConnectEvent): Use the contentWorldType from the sendersParameters to determine which onConnect listeners we should call. (WebKit::WebExtensionContextProxy::dispatchRuntimeConnectEvent): Event listeners cannot be added for the webPageRuntime namespace object. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebPageNamespaceCocoa.mm: Copied from Source/WebKit/Shared/Extensions/WebExtensionContentWorldType.h. (WebKit::WebExtensionAPIWebPageNamespace::runtime): * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebPageRuntimeCocoa.mm: Added. * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIObject.h: (WebKit::WebExtensionAPIObject::WebExtensionAPIObject): * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIRuntime.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebPageNamespace.h: Copied from Source/WebKit/Shared/Extensions/WebExtensionContentWorldType.h. * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebPageRuntime.h: Copied from Source/WebKit/Shared/Extensions/WebExtensionContentWorldType.h. * Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm: (WebKit::WebExtensionContextProxy::toDOMWorld): * Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionControllerProxyCocoa.mm: (WebKit::WebExtensionControllerProxy::globalObjectIsAvailableForFrame): (WebKit::WebExtensionControllerProxy::serviceWorkerGlobalObjectIsAvailableForFrame): (WebKit::WebExtensionControllerProxy::addBindingsToWebPageFrameIfNecessary): Inject custom browser namespace object for web pages. * Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIWebPageNamespace.idl: Copied from Source/WebKit/Shared/Extensions/WebExtensionContentWorldType.h. * Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIWebPageRuntime.idl: Copied from Source/WebKit/Shared/Extensions/WebExtensionContentWorldType.h. * Source/WebKit/WebProcess/Extensions/WebExtensionControllerProxy.h: Canonical link: https://commits.webkit.org/274898@main
- Loading branch information
1 parent
6c9a595
commit b69952d
Showing
66 changed files
with
1,092 additions
and
238 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ enum class WebKit::WebExtensionContentWorldType : uint8_t { | |
Main, | ||
ContentScript, | ||
Native, | ||
WebPage, | ||
} | ||
|
||
#endif |
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.