Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support modules for web extension service workers. #6010

Conversation

eepskamp
Copy link

@eepskamp eepskamp commented Nov 1, 2022

ba3a201

Support modules for web extension service workers.
https://bugs.webkit.org/show_bug.cgi?id=247325
rdar://100429656

Reviewed by Timothy Hatcher.

Revise SPI to load a service worker to include a parameter that indicates if the service worker
uses modules or not.

Parse the "module" type from the extension's manifest and use that to load the service worker
correctly, or to create the generated background HTML file with the correct <script> elements.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _loadServiceWorker:usingModules:completionHandler:]):
(-[WKWebView _loadServiceWorker:completionHandler:]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.mm:
(-[_WKWebExtension backgroundContentUsesModules]):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm:
(WebKit::WebExtension::backgroundContentUsesModules):
(WebKit::WebExtension::generatedBackgroundContent):
(WebKit::WebExtension::populateBackgroundPropertiesIfNeeded):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::loadBackgroundWebView):
* Source/WebKit/UIProcess/Extensions/WebExtension.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadServiceWorker):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtension.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionController.mm:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/256257@main

fc79029

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios   πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios   πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv   πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  watch   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 1, 2022
@eepskamp eepskamp force-pushed the eng/Support-modules-for-web-extension-service-workers branch from 69c984c to fc79029 Compare November 2, 2022 19:03
@xeenon xeenon added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing labels Nov 2, 2022
https://bugs.webkit.org/show_bug.cgi?id=247325
rdar://100429656

Reviewed by Timothy Hatcher.

Revise SPI to load a service worker to include a parameter that indicates if the service worker
uses modules or not.

Parse the "module" type from the extension's manifest and use that to load the service worker
correctly, or to create the generated background HTML file with the correct <script> elements.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _loadServiceWorker:usingModules:completionHandler:]):
(-[WKWebView _loadServiceWorker:completionHandler:]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.mm:
(-[_WKWebExtension backgroundContentUsesModules]):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm:
(WebKit::WebExtension::backgroundContentUsesModules):
(WebKit::WebExtension::generatedBackgroundContent):
(WebKit::WebExtension::populateBackgroundPropertiesIfNeeded):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::loadBackgroundWebView):
* Source/WebKit/UIProcess/Extensions/WebExtension.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadServiceWorker):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtension.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionController.mm:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/256257@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Support-modules-for-web-extension-service-workers branch from fc79029 to ba3a201 Compare November 2, 2022 23:36
@webkit-commit-queue
Copy link
Collaborator

Committed 256257@main (ba3a201): https://commits.webkit.org/256257@main

Reviewed commits have been landed. Closing PR #6010 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit ba3a201 into WebKit:main Nov 2, 2022
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 2, 2022
@xeenon xeenon added the WebKit Extensions Bugs related to extension support. label Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Extensions Bugs related to extension support.
Projects
None yet
5 participants