зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1222690 - SDK Content Script should not be frozen during the page loading. r=gabor
MozReview-Commit-ID: JVnJZsSA6nO --HG-- extra : transplant_source : q%0CS6%2BYrCJ%13%CA%29i%15%9Ai%C0%D6f%B2
This commit is contained in:
Родитель
09dc5d1830
Коммит
41023d9940
|
@ -51,9 +51,19 @@ const WorkerChild = Class({
|
|||
|
||||
this.sandbox = WorkerSandbox(this, this.window);
|
||||
|
||||
// If the document is still loading wait for it to finish before passing on
|
||||
// received messages
|
||||
this.frozen = this.window.document.readyState == "loading";
|
||||
// If the document has an unexpected readyState, its worker-child instance is initialized
|
||||
// as frozen until one of the known readyState is reached.
|
||||
let initialDocumentReadyState = this.window.document.readyState;
|
||||
this.frozen = [
|
||||
"loading", "interactive", "complete"
|
||||
].includes(initialDocumentReadyState) ? false : true;
|
||||
|
||||
if (this.frozen) {
|
||||
console.warn("SDK worker-child started as frozen on unexpected initial document.readyState", {
|
||||
initialDocumentReadyState, windowLocation: this.window.location.href,
|
||||
});
|
||||
}
|
||||
|
||||
this.frozenMessages = [];
|
||||
this.on('pageshow', () => {
|
||||
this.frozen = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче