dom-loading DOCUMENT_EVENT is duplicated in case of server side target switching
Categories
(DevTools :: Framework, defect, P3)
Tracking
(firefox90 fixed)
Tracking | Status | |
---|---|---|
firefox90 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
While working on bug 1702511, I was having duplicated dom-loading event when running devtools/client/webconsole/test/browser/browser_webconsole_persist.js.
That's because the DocumentEventWatcher may be instantiated before the target actor is attached.
So that a first dom-loading
will be forced from here:
https://searchfox.org/mozilla-central/source/devtools/server/actors/webconsole/listeners/document-events.js#30-36
listen() {
EventEmitter.on(this.targetActor, "window-ready", this.onWindowReady);
this.onWindowReady({
window: this.targetActor.window,
isTopLevel: true,
// Flag the very first dom-loading event, which is about the top target and may come
// after some other already existing resources.
shouldBeIgnoredAsRedundantWithTargetAvailable: true,
});
},
We emit a fake window-ready
for the current top level document.
But if the target isn't attached yet and is attached right after, another window-ready
will be fired by the TargetActor itself, from here:
https://searchfox.org/mozilla-central/rev/3de2db87f3c9001ae478318d47a2ca3427574382/devtools/server/actors/targets/browsing-context.js#1669-1671
// Dispatch the _windowReady event on the targetActor for pre-existing windows
for (const win of this._getWindowsInDocShell(docShell)) {
this._targetActor._windowReady(win);
(this code is called when the target actor is attached)
Note that bug 1704805 is required in order to easily reproduce this issue in the added test. Without this, the target actor is already attached by the time we start the DOCUMENT_EVENT watcher.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5de21b75b2e9 [devtools] Fix duplicated dom-loading event in case of server side target switching. r=nchevobbe
Comment 3•3 years ago
|
||
bugherder |
Description
•