SyncMessage suspending on DOMContentLoaded.

This commit is contained in:
hackademix 2020-08-29 08:18:48 +02:00
parent 4b3af158b9
commit d282a385ca
1 changed files with 8 additions and 0 deletions

View File

@ -245,9 +245,17 @@
suspend();
});
domSuspender.observe(document, {childList: true, subtree: true});
let bodySuspender = e => {
console.debug("Suspending on DOMContentLoaded");
suspend();
};
addEventListener("DOMContentLoaded", bodySuspender, true);
let finalize = () => {
console.debug("sendSyncMessage finalizing");
domSuspender.disconnect();
removeEventListener("DOMContentLoaded", bodySuspender, true);
};
// on Firefox we first need to send an async message telling the