RESOLVED FIXED Bug 220406
Service Worker is no longer inspectable
https://bugs.webkit.org/show_bug.cgi?id=220406
Summary Service Worker is no longer inspectable
youenn fablet
Reported 2021-01-07 03:13:50 PST
Service Worker is no longer inspectable
Attachments
Patch (2.16 KB, patch)
2021-01-08 00:57 PST, Per Arne Vollan
no flags
Fixes the service worker regression (3.93 KB, text/plain)
2021-01-08 04:53 PST, youenn fablet
no flags
Patch (9.96 KB, patch)
2021-01-08 05:25 PST, youenn fablet
no flags
youenn fablet
Comment 1 2021-01-07 03:14:00 PST
youenn fablet
Comment 2 2021-01-07 03:15:04 PST
youenn fablet
Comment 3 2021-01-07 03:19:48 PST
ServiceWorkerDebuggable (which implements Inspector::RemoteInspectionTarget) is currently owned by ServiceWorkerThreadProxy which lives in WebContent process. There is no other debuggable in UIProcess contrary to Page and WebPageProxy. Maybe this is what is missing?
Per Arne Vollan
Comment 4 2021-01-08 00:57:14 PST
youenn fablet
Comment 5 2021-01-08 01:38:21 PST
Comment on attachment 417254 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417254&action=review > Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:219 > + if (WebCore::applicationBundleIdentifier() == "com.apple.Safari" && !CFPreferencesGetAppIntegerValue(CFSTR("ShowDevelopMenu"), CFSTR("com.apple.Safari.SandboxBroker"), nullptr)) This additional check is a no-op in case the app is Safari and Safari is no longer able to inspect service workers. It is not clear to me how this could fix the issue.
Per Arne Vollan
Comment 6 2021-01-08 03:44:10 PST
(In reply to youenn fablet from comment #5) > Comment on attachment 417254 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=417254&action=review > > > Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:219 > > + if (WebCore::applicationBundleIdentifier() == "com.apple.Safari" && !CFPreferencesGetAppIntegerValue(CFSTR("ShowDevelopMenu"), CFSTR("com.apple.Safari.SandboxBroker"), nullptr)) > > This additional check is a no-op in case the app is Safari and Safari is no > longer able to inspect service workers. > It is not clear to me how this could fix the issue. I think Safari is still able to inspect service workers, but Safari Technology Preview is not, or perhaps I am mistaken?
youenn fablet
Comment 7 2021-01-08 04:41:00 PST
(In reply to Per Arne Vollan from comment #6) > (In reply to youenn fablet from comment #5) > > Comment on attachment 417254 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=417254&action=review > > > > > Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:219 > > > + if (WebCore::applicationBundleIdentifier() == "com.apple.Safari" && !CFPreferencesGetAppIntegerValue(CFSTR("ShowDevelopMenu"), CFSTR("com.apple.Safari.SandboxBroker"), nullptr)) > > > > This additional check is a no-op in case the app is Safari and Safari is no > > longer able to inspect service workers. > > It is not clear to me how this could fix the issue. > > I think Safari is still able to inspect service workers, but Safari > Technology Preview is not, or perhaps I am mistaken? I tried Safari with the latest WebKit ToT and it no longer sees service worker. When reverting https://trac.webkit.org/changeset/270326, I can see airhorner.com.
youenn fablet
Comment 8 2021-01-08 04:45:08 PST
I locally did a test to pass the sandbox extension at the time we initialise the web process and it fixes the issue. It seems the sandbox extension arrives too late.
youenn fablet
Comment 9 2021-01-08 04:53:10 PST
Created attachment 417263 [details] Fixes the service worker regression
Per Arne Vollan
Comment 10 2021-01-08 04:54:56 PST
(In reply to youenn fablet from comment #8) > I locally did a test to pass the sandbox extension at the time we initialise > the web process and it fixes the issue. > It seems the sandbox extension arrives too late. Ah, good catch! Maybe we need to call enableRemoteInspectorIfNeeded() after having intialized the web process?
Per Arne Vollan
Comment 11 2021-01-08 04:56:51 PST
(In reply to youenn fablet from comment #9) > Created attachment 417263 [details] > Fixes the service worker regression It seems this patch creates the extension unconditionally. I think we only should create the extension when the Develop menu is enabled.
youenn fablet
Comment 12 2021-01-08 04:58:54 PST
(In reply to Per Arne Vollan from comment #11) > (In reply to youenn fablet from comment #9) > > Created attachment 417263 [details] > > Fixes the service worker regression > > It seems this patch creates the extension unconditionally. I think we only > should create the extension when the Develop menu is enabled. Right, and it should not be MAC specific, I just wrote it to validate the assumption that the sandbox extension was arriving too late. I am not sure why it is important to happen sooner rather than later, it would be interesting to understand why. I guess we could still use this patch approach as a fix.
youenn fablet
Comment 13 2021-01-08 05:25:43 PST
youenn fablet
Comment 14 2021-01-08 05:30:17 PST
This patch fixes the main regression. The case that does not work is if the process running the service worker started while the develop menu is off. I think additional refactoring should be done to fix that case.
Per Arne Vollan
Comment 15 2021-01-08 06:46:32 PST
Comment on attachment 417264 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417264&action=review Great, thanks for fixing! R=me. > Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:225 > +void WebProcessProxy::enableRemoteInspectorIfNeeded() > +{ > + if (!shouldEnableRemoteInspector()) > + return; > + send(Messages::WebProcess::EnableRemoteWebInspector(), 0); It this function still needed? It could be useful when we implement observation of the Develop menu preference key.
Per Arne Vollan
Comment 16 2021-01-08 07:10:02 PST
Comment on attachment 417264 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417264&action=review >> Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:225 >> + send(Messages::WebProcess::EnableRemoteWebInspector(), 0); > > It this function still needed? It could be useful when we implement observation of the Develop menu preference key. I see that it is still needed; we call it when receiving an enable remote inspector notification.
EWS
Comment 17 2021-01-08 07:22:33 PST
Committed r271294: <https://trac.webkit.org/changeset/271294> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417264 [details].
Note You need to log in before you can comment on or make changes to this bug.