Open Bug 1591266 Opened 5 years ago Updated 6 months ago

WS connection from Shared worker is not available

Categories

(DevTools :: Netmonitor, defect, P3)

71 Branch
defect

Tracking

(Not tracked)

People

(Reporter: Levitikus, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Attached file js-contents.txt

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36

Steps to reproduce:

As suggested in the article "new websocket inspector" I tried to take a closer Look at my Websocket-Connection usinf Firefox (dev) [71.0b3]

Website-Layout:
The main Design-Idea is, that several Browser-Tabs can subscribe to the SharedWorker and channel their servermessages through the common Websocket.
The Websocket can communicate some informations back to the Browser-Tabs via direct port-communication, in other cases it (the owning SharedWorker indeed) can broadcast messages to a broadcast-channel other SharedWorkers (like an IndexedDB-SharedWorker) might listen to. For instance an 'update the archive'-operation with a blocking idb-access can be parallelized.

I have shortened the SharedWorker-Scriptfile (s. attachment).
The SharedWorker-Scriptfile is called within the init()-block of the main-page (s. init-snippet). Both of them are translated Typescript-Files.
Hopefully you can make sense of it :-) Otherwise if you come forward with an idea, how I can help with your analysis I'd be glad to be of any help.

So i tired to take a look by using the about:debugging-Panel -> sharedworker + 'inspect'
But I can't find any way to inspect the websocket-connection

Actual results:

No HMI-Option to inspect the Websocket-Connection within the sharedworker-debugging-ui is shown.

Expected results:

A 'netmonitor'-Tab should be shown with the 'Websocket'-Option, or a new Option 'Websocket' should be added next to "CSS|XHR|Requests"

The priority flag is not set for this bug.
:Honza, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(odvarko)

Thanks for the report Sven!

Looks like support for WS connections coming from a worker isn't there yet.
Could you please put together a simple test case (can be online or attached to this bug)
that we could use to reproduce this on our machines?

Thanks,
Honza

Flags: needinfo?(odvarko) → needinfo?(Levitikus)

This is likely a bug, but we need a test case.
Honza

Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3

I'll set up a test scenario within the next week.

  • Sven.

@Sven: any update on the test case?

Honza

Summary: Sharedworker-Websocket netmonitor etc. not available → WS connection from Shared worker is not available
Severity: normal → S3

Clear a needinfo that is pending on an inactive user.

Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE.

For more information, please visit BugBot documentation.

Flags: needinfo?(Levitikus)

It appears that this is still an outstanding issue. My company centralized the websocket connection by moving it to a SharedWorker, so that if a user has multiple browser tabs open, they all share the websocket connection. But now I can't debug on Firefox, because there is no websocket information available for the SharedWorker. I have to use chrome as a result.

The previous messages indicate that a test case is necessary. I'd be happy to provide one, but I'm not sure one is necessary really -- just go to about:debugging#/runtime/this-firefox, then inspect a shared worker. After you click "Inspect", you can see that there is no apparent way to view websocket traffic. There is a "XHR" and "Requests" option available, but nothing for websockets.

Just to echo the above user's comments, my company has also centralized a websocket connection into a SharedWorker but being unable to debug the traffic using Firefox's inspect tools makes it difficult for us to support our Firefox users. Is there any update or chance of a solution on the horizon?

Here's a test page https://ffx-devtools-websocket-in-shared-worker.glitch.me/
Note that we explicitly disable netmonitor for about:debugging worker toolboxes https://searchfox.org/mozilla-central/rev/669fac9888b173c02baa4c036e980c0c204dfe02/devtools/client/definitions.js#339,357-361,367

Tools.netMonitor = {
...
  isToolSupported(toolbox) {
    return (
      toolbox.target.getTrait("networkMonitor") &&
      !toolbox.target.isWorkerTarget
    );
...
};

But we may display them in the regular toolbox (see https://bugzilla.mozilla.org/show_bug.cgi?id=1432311#c15)

See Also: → 1432311
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: