Bug 1686748 - [devtools] Fix WalkerActor exception on server side target switching. r=nchevobbe

When using JSWindowActor based target, each target actor is destroyed on each reload/navigation.
This code in walker actor is registering a DOMContentLoaded listener which
only fires after the target is already destroyed. This leads to exceptions.

Differential Revision: https://phabricator.services.mozilla.com/D114367
This commit is contained in:
Alexandre Poirot 2021-05-12 15:08:04 +00:00
Родитель ae9fd2e09e
Коммит 47ab6f9ade
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -2472,6 +2472,10 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
},
onFrameLoad: function({ window, isTopLevel }) {
// By the time we receive the DOMContentLoaded event, we might have been destroyed
if (this._destroyed) {
return;
}
const { readyState } = window.document;
if (readyState != "interactive" && readyState != "complete") {
// The document is not loaded, so we want to register to fire again when the