Closed Bug 1721907 Opened 3 years ago Closed 3 years ago

browser_styleeditor_loading.js fails with server side target switching enabled

Categories

(DevTools :: Framework, defect)

defect

Tracking

(Fission Milestone:MVP, firefox93 fixed)

RESOLVED FIXED
93 Branch
Fission Milestone MVP
Tracking Status
firefox93 --- fixed

People

(Reporter: ochameau, Assigned: nchevobbe)

References

Details

(Whiteboard: dt-fission-m3-mvp)

Attachments

(1 file, 1 obsolete file)

This test fails because we try to attach to an initial about:blank document.

The test opens a toolbox on a still loading tab:
https://searchfox.org/mozilla-central/rev/2022d34edd5817948b27f093cd203ae6adb18a25/devtools/client/styleeditor/test/browser_styleeditor_loading.js#10-16
which ends up making the watcher throw when calling this:
https://searchfox.org/mozilla-central/rev/2022d34edd5817948b27f093cd203ae6adb18a25/devtools/server/actors/watcher/target-helpers/frame-helper.js#129-136

This will emit a JSWindow Actor query which will fail and reject because the document we try to communicate with is the initial about:blank document of the tab.
This document, and its WindowGlobal, alongside its JSWindow Actor pair, will be almost immediately destroyed!

We should probably ignore this document from the parent process, as we do in the content process:
https://searchfox.org/mozilla-central/rev/2022d34edd5817948b27f093cd203ae6adb18a25/devtools/server/connectors/js-window-actor/DevToolsFrameChild.jsm#45-63

The issue here is that's the first top level document/target and we ought to emit it while calling watcherActor.watchTarget("frame"), so that the first top target is fetched when calling targetCommand.startListening(). So we would need to ignore the document, while waiting for the next one.

Avoid attaching the the initial and transient about:blank documents
as the query to instantiate the target in the content process will
most likely fail as this document is almost immediately destroyed.

The only required change to fix browser_styleeditor_loading.js is the change
made to frame-helper.js

Note that the test fails intermitently locally, I reproduce with --run-until-failure.

I can't get the test to fail on latest Nightly, maybe some changes landed that got rid of this?

Flags: needinfo?(poirot.alex)
Whiteboard: dt-fission-m3-triage → dt-fission-future

I still reproduce this failure:

./mach mochitest --setpref devtools.target-switching.server.enabled=true --headless browser_styleeditor_loading.js

It even looks more permanent than before?

It fails with the following error:

 0:04.83 TEST_START: devtools/client/styleeditor/test/browser_styleeditor_loading.js
 0:04.94 INFO Entering test bound 
 0:04.94 INFO Adding a new tab with URL: 'http://example.com/browser/devtools/client/styleeditor/test/longload.html'
 0:05.08 INFO Console message: [JavaScript Error: "NotFoundError: No such JSWindowActor 'MarionetteEvents'"]
 0:05.23 GECKO(58984) console.warn: "Failed to create DevTools Frame target for browsingContext" 48
 0:05.23 GECKO(58984) console.warn: (new AbortError("Actor 'DevToolsFrame' destroyed before query 'DevToolsFrameParent:instantiate-already-available' was resolved", (void 0)))
 0:05.29 GECKO(58984) console.warn: "Failed to add watcher data entry for frame targets in browsing context" 48
 0:05.29 GECKO(58984) console.warn: (new Error("No target actor for this Watcher Actor ID:\"server0.conn0.watcher2\" / BrowserId:13", "resource://devtools/server/connectors/js-window-actor/DevToolsFrameChild.jsm", 506))
Flags: needinfo?(poirot.alex)
Fission Milestone: --- → MVP
Whiteboard: dt-fission-future → dt-fission-m3-mvp

This makes browser_styleeditor_loading to pass with server side target switching.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Attachment #9233979 - Attachment description: Bug 1721907 - [devtools] Don't attach initial transient about:blank documents and wait for actual document to be available when creating target. r=jdescottes. → WIP: Bug 1721907 - [devtools] Don't attach initial transient about:blank documents and wait for actual document to be available when creating target. r=jdescottes.
Attachment #9233979 - Attachment description: WIP: Bug 1721907 - [devtools] Don't attach initial transient about:blank documents and wait for actual document to be available when creating target. r=jdescottes. → Bug 1721907 - [devtools] Retry creation of initial target on AbortError. r=jdescottes.
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4e4ecddbe881 [devtools] Retry creation of initial target on AbortError. r=jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
Attachment #9232733 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: