From e762a29d308caa46578cdc34a9be92c4ad5ecdd0 Mon Sep 17 00:00:00 2001 From: AlexVallat Date: Sun, 5 Apr 2015 17:52:23 +0100 Subject: [PATCH] Test-fix for #1149 --- platform/firefox/bootstrap.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/platform/firefox/bootstrap.js b/platform/firefox/bootstrap.js index fec58275d..80bf8ea8c 100644 --- a/platform/firefox/bootstrap.js +++ b/platform/firefox/bootstrap.js @@ -54,12 +54,23 @@ function startup(data, reason) { let appShell = Components.classes['@mozilla.org/appshell/appShellService;1'] .getService(Components.interfaces.nsIAppShellService); - let onReady = function(e) { - if ( e ) { + let onReady = function (e) { + console.log("uBlock> onReady"); + + if (e) { + console.log("uBlock> removing event listener " + e.type + " from " + this); + this.removeEventListener(e.type, onReady); } let hiddenDoc = appShell.hiddenDOMWindow.document; + + if (hiddenDoc.readyState === 'loading') { + console.log("uBlock> hiddenDOMWindow not ready, waiting"); + hiddenDoc.addEventListener('DOMContentLoaded', onReady); + return; + } + bgProcess = hiddenDoc.documentElement.appendChild( hiddenDoc.createElementNS('http://www.w3.org/1999/xhtml', 'iframe') );