Open Bug 1625640 Opened 4 years ago Updated 2 years ago

HTTP request generated by EventSource object in a shared worker isn't visible

Categories

(DevTools :: Netmonitor, defect, P2)

defect

Tracking

(Not tracked)

People

(Reporter: Honza, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: regression, Whiteboard: [necko-triaged])

Attachments

(1 file)

STR:

  1. Get NodeJS example SSE app from https://github.com/FarooqAR/node-sse-example
  2. Install on your machine (use npm install)
  3. Run without a worker node ./app.js
  4. Open Firefox, DevTools and select the Network panel
  5. Load http://localhost:8081/
  6. You should see http://localhost:8081/events/ request in the Network panel
  7. Restart the NodeJS app in worker node ./app.js worker
  8. Load http://localhost:8081/
  9. Thehttp://localhost:8081/events/ request is not in the Network panel

Honza

Has STR: --- → yes

:Honza, if you think that's a regression, then could you try to find a regression range in using for example mozregression?

Another and simpler STRs:

  1. Open DevTools and select the Network panel
  2. Load http://wpt.live/eventsource/dedicated-worker/eventsource-onmessage.htm
  3. You should see message.py request in the list (http://wpt.live/eventsource/resources/message.py). It's channel for server side events.

AR: message.py request is not there
ER: message.py request is in the list

Note that the request for SSE is done from within a web worker (not service worker). Requests from SW are not visible atm, which is covered by bug 1432311)

Honza

Some results from my analysis:

  1. The Network panel is filtering out requests that doesn't belong to the current page. It uses the following function
    https://searchfox.org/mozilla-central/rev/9c6e7500c0015a2c60be7b1b888261d95095ce27/devtools/server/actors/network-monitor/network-observer.js#65

The function is used at many places e.g. here
https://searchfox.org/mozilla-central/rev/9c6e7500c0015a2c60be7b1b888261d95095ce27/devtools/server/actors/network-monitor/network-observer.js#365

It's clear that the request is not visible since it's filtered out.

  1. I put some logs in the matchRequest function and it looks like the channel associated with the SSE request doesn't have request.loadGroup so, can't find parent window/frame etc.

We need the loadGroup in this function
https://searchfox.org/mozilla-central/rev/9c6e7500c0015a2c60be7b1b888261d95095ce27/devtools/shared/webconsole/network-helper.js#256

You might see (in the same file) that it's used by getTopFrameForRequest and getWindowForRequest.

  1. Also note that I am seeing an exception from this place:
    https://searchfox.org/mozilla-central/rev/9c6e7500c0015a2c60be7b1b888261d95095ce27/devtools/server/actors/network-monitor/network-response-listener.js#84

NS_NOINTERFACE, when querying for {2813a7a3-d084-4d00-acd0-f76620315c02} => nsILoadContext

Looks like nsILoadContext is not supported by the SSE channel?

Honza

Priority: P3 → P2

This is blocking our GSoC project so, marking as P2

Honza

Flags: needinfo?(nhnguyen)
Attached patch temp.patchSplinter Review

I am also attaching patch with my logs, in case it would be useful.

Honza

Assignee: nobody → odvarko

(accidentally assigned myself, unassigned)

Note that bug 1179250 landed, which could have an impact on the NS_NOINTERFACE exception

Honza

Assignee: odvarko → nobody

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression
Flags: needinfo?(nhnguyen)
Whiteboard: [necko-triaged]

Realistically, we won't be able to get to this in Fx77.

It's ok to have this in 78 (it's still before GSoC starts)

Honza

Just going to mention that any requests (include those from EventSource) generated in SharedWorkers are not visible as well in network panel.

Demos:
Fetch request in a shared worker: https://farooqar.github.io/fetch-shared-worker/
EventSource in a shared worker: http://wpt.live/eventsource/shared-worker/eventsource-onmessage.htm

A bit irrelevant to this bug but may be it's also worth mentioning that we may not be able to intercept SSE events from shared workers because of different window ids (assuming the problem I mentioned above is fixed) .
https://searchfox.org/mozilla-central/source/devtools/server/actors/network-monitor/websocket-actor.js#53

Idea: If there is a way to tell if the worker is specifically a SharedWorker (https://searchfox.org/mozilla-central/source/dom/base/EventSource.cpp#1852), may be we could notify all the service listeners regardless of which window they belong to, and then on server-side, only emit events to the one which created the request (using channel id).

Summary: HTTP request generated by EventSource object isn't visible → HTTP request generated by EventSource object in a worker isn't visible
Summary: HTTP request generated by EventSource object in a worker isn't visible → HTTP request generated by EventSource object in a shared worker isn't visible
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: