From e762a29d308caa46578cdc34a9be92c4ad5ecdd0 Mon Sep 17 00:00:00 2001 From: AlexVallat Date: Sun, 5 Apr 2015 17:52:23 +0100 Subject: [PATCH 1/3] 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') ); From 7b781248f00cbe3d61b1cc367c440db80fa06049 Mon Sep 17 00:00:00 2001 From: AlexVallat Date: Sun, 5 Apr 2015 17:54:19 +0100 Subject: [PATCH 2/3] Fix spurious log messages at cleanup --- platform/firefox/vapi-background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 982a0c54f..ede2a97ff 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -65,7 +65,7 @@ vAPI.app.restart = function() { var cleanupTasks = []; // This must be updated manually, every time a new task is added/removed -var expectedNumberOfCleanups = 7; +var expectedNumberOfCleanups = 6; // 7 instances of cleanupTasks.push, but one is unique to fennec, and one to desktop. window.addEventListener('unload', function() { for ( var cleanup of cleanupTasks ) { From e6b3c31d5e23e1febd8d9c78ed02c056b27c70b1 Mon Sep 17 00:00:00 2001 From: AlexVallat Date: Mon, 6 Apr 2015 08:08:23 +0100 Subject: [PATCH 3/3] Remove diagnostic logging --- platform/firefox/bootstrap.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/platform/firefox/bootstrap.js b/platform/firefox/bootstrap.js index 80bf8ea8c..96c1681d9 100644 --- a/platform/firefox/bootstrap.js +++ b/platform/firefox/bootstrap.js @@ -54,19 +54,14 @@ function startup(data, reason) { let appShell = Components.classes['@mozilla.org/appshell/appShellService;1'] .getService(Components.interfaces.nsIAppShellService); - let onReady = function (e) { - console.log("uBlock> onReady"); - - if (e) { - console.log("uBlock> removing event listener " + e.type + " from " + this); - + let onReady = function(e) { + if ( e ) { this.removeEventListener(e.type, onReady); } let hiddenDoc = appShell.hiddenDOMWindow.document; - if (hiddenDoc.readyState === 'loading') { - console.log("uBlock> hiddenDOMWindow not ready, waiting"); + if ( hiddenDoc.readyState === 'loading' ) { hiddenDoc.addEventListener('DOMContentLoaded', onReady); return; }