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:
Luca Greco 2016-06-20 16:33:21 +02:00
Родитель 09dc5d1830
Коммит 41023d9940
1 изменённых файлов: 13 добавлений и 3 удалений

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

@ -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;