fetch() requests initiated by a serviceworker are missing in the network panel
Categories
(DevTools :: Netmonitor, enhancement, P2)
Tracking
(Not tracked)
People
(Reporter: bkelly, Unassigned)
References
(Depends on 1 open bug, Blocks 5 open bugs)
Details
(Whiteboard: SW-CLEANUP)
Reporter | ||
Comment 2•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 3•6 years ago
|
||
Andrew, did anything changed since last comments (i.e. one year ago)?
I was especially wondering if SW were running in their own process now? (sorry I did not track the SW refactoring at all)
From DevTools standpoint, we didn't changed much regarding where we do listen for network requests.
We still listen from both the content process (for SW) and the parent process (for all website requests).
So if the SW requests still happens in the parent process it is only matter of:
- being able to listen for them if the regular http-on-examine-response/http-on-examine-cached-response/http-on-modify-request are not fired for them. That's why I introduced service-worker-synthesized-response from bug 1158264.
- be able to distinguish them to flag them as SW requests. For now that's all based around service-worker-synthesized-response.
Comment 4•5 years ago
•
|
||
Perry, are you able to shine some light into what's needed? Not seeing SW requests is a major blocker for debugging the network requests/responses that they make.
I have not been able to see any requests that SWs initiate.
STR: Open Network panel https://firefox-devtools-waiting-sw.glitch.me/ ER: Requests for both /sw.js
and /server-version
from service-worker.
Updated•5 years ago
|
Comment 5•5 years ago
|
||
Waiting on a reply from perry, but we might want to dupe this with bug 1267119.
Comment 6•5 years ago
|
||
I'm not sure what's needed to show the SW script (/sw.js
) in the network monitor - I checked with pref on/off and didn't see /sw.js
show up. For the responses provided by a SW, we do still emit the "service-worker-synthesized-response"
observer notification, but in the parent process. The comment here from network-observer.js, however, suggests that the topic is only being listened for in content processes, which would explain why /server-version
isn't showing up.
Comment 7•5 years ago
|
||
Honza, does that map to similar Network data that is only available on the parent? If there is a theme, maybe we need to create a meta bug to collect those?
Comment 8•5 years ago
|
||
(In reply to Perry Jiang [:perry] from comment #6)
The comment here from network-observer.js, however, suggests that the topic is only being listened for in content processes, which would explain why
/server-version
isn't showing up.
The comment is confusing. I put the following log:
console.log(Services.appinfo.processType);
... just in front of the comment and I can see that the code is executes in both parent and content process. So, we are listening properly for "service-worker-synthesized-response" notifications in both.
However I am only getting that notification for _serviceWorkerRequest https://firefox-devtools-waiting-sw.glitch.me/version
and I am not seeing it
for https://firefox-devtools-waiting-sw.glitch.me/sw.js
. This sounds like a problem on the platform.
The second issue is that DevTools are filtering out requests that doesn't belong to the current debugged tab and SW requests don't go through that filter since they don't have parent window.
https://searchfox.org/mozilla-central/rev/13b081a62d3f3e3e3120f95564529257b0bf451c/devtools/server/actors/network-monitor/network-observer.js#67 This needs to be solved in DevTools code
Perry, could anyone check why we are not getting the "service-worker-synthesized-response" notification for sw.js
?
I am using Harald's example https://firefox-devtools-waiting-sw.glitch.me/
Honza
Comment 9•5 years ago
|
||
I am not seeing it for https://firefox-devtools-waiting-sw.glitch.me/sw.js. This sounds like a problem on the platform.
I probably conflated this issue for this bug, which perry confirmed in our chat. sw.js
not being shown is bug 1267119.
Comment 10•5 years ago
|
||
@Harald, so can we close this, it looks like dup of bug 1267119 ?
Honza
Comment 11•5 years ago
|
||
@Harald, so can we close this, it looks like dup of bug 1267119 ?
No. In short, bug 1267119 is about showing the browser's request for sw.js
; while this bug is about fetch requests made from sw.js
.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 15•2 years ago
|
||
So we do get notifications about the service worker initiated requests in our Network Observer, however they are all filtered out for a regular tab DevTools Toolbox because of the NetworkObserver filtering logic. But you can see those requests in the Browser Toolbox.
As mentioned in some comments of Bug 1267119, nothing in those requests allows us to identify them as being related to a given browsing context (understandably) so we hide them in the regular DevTools Toolbox. We could somewhat workaround that by using the loadInfo.triggeringRemoteType
, which should contain something like webServiceWorker=https://somedomain/
for requests initiated by a service worker and loosely match that against the browsingContext.currentRemoteType
, but that will not be very accurate. Might still be an acceptable first step. Otherwise, there are hints about better solutions over in Bug 1267119 comment #12
Description
•