Closed Bug 1695185 Opened 4 years ago Closed 4 years ago

WebSocketEventService does not listen for events from Iframes

Categories

(Core :: Networking: WebSockets, defect, P1)

defect

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: bomsy, Assigned: bomsy)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

The WebSocketEventService does not seem to listen for events from child remote iframes. This blocks the fission work for websockets in Bug 1644196

STR

  1. Go to http://techno-barje.fr/fission/websockets/
  2. Open devtools and go to the netmonitor
  3. Make sure all fission flags are on i.e fission.autostart & devtools.browsertoolbox.fission
  4. Click "Connect" to connect to the websocket at "wss://echo.websocket.org" (which is already set) in the iframe page
  5. Select the newly added websockect request in the netmonitor
  6. Go to the response side panel
  7. On the iframed page click "send" to send some messages
ER

See websocket messages in the response sidepanel.

AR

No message are shown in the response sidepanel

Blocks: 1644196

The websocket uses the innerWindowId of the window where the script lives when
triggering events for devtools. This is may not be the same as the websocket
owner window as mentioned here https://searchfox.org/mozilla-central/rev/f1159268add2fd0959e9f91b474f5da74c90f305/dom/websocket/WebSocket.cpp#206-207,212
This seems to be the case when we have iframes within a page. The devtools
do not get the events for the websockets channels opened within iframes as
the innerWindowId is that of the top-level window.

...->TopWindowContext()->InnerWindowId() also always point to the top-level window.

This patch fixes these issues by switching to use the websocket owner window which
the iframe.

Note: The parent revsion contains the changes for the devtools fission work that
depends on this fix. i did this to make it easy to test and review.

Depends on D103847

Assignee: nobody → hmanilla
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P1
Whiteboard: [necko-triaged]
Pushed by hmanilla@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6fbfd2ff0ee7 Use the WindowId of the owner document instead r=valentin,necko-reviewers,baku
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: