diff --git a/platform/firefox/bootstrap.js b/platform/firefox/bootstrap.js index 95c2f1532..e48c9c733 100644 --- a/platform/firefox/bootstrap.js +++ b/platform/firefox/bootstrap.js @@ -60,6 +60,19 @@ function startup(data, reason) { } let hiddenDoc = appShell.hiddenDOMWindow.document; + + // https://github.com/gorhill/uBlock/issues/10 + // Fixed by github.com/AlexVallat: + // https://github.com/chrisaljoudi/uBlock/issues/1149 + // https://github.com/AlexVallat/uBlock/commit/e762a29d308caa46578cdc34a9be92c4ad5ecdd0 + if ( hiddenDoc.readyState === 'loading' ) { + hiddenDoc.addEventListener('DOMContentLoaded', onReady); + return; + } + + // I believe this needs to be called in case it was added above. + hiddenDoc.removeEventListener('DOMContentLoaded', onReady); + bgProcess = hiddenDoc.documentElement.appendChild( hiddenDoc.createElementNS('http://www.w3.org/1999/xhtml', 'iframe') ); diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index fe8c6e446..b01012cc3 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -65,7 +65,11 @@ vAPI.app.restart = function() { var cleanupTasks = []; // This must be updated manually, every time a new task is added/removed -var expectedNumberOfCleanups = 7; + +// Fixed by github.com/AlexVallat: +// https://github.com/AlexVallat/uBlock/commit/7b781248f00cbe3d61b1cc367c440db80fa06049 +// 7 instances of cleanupTasks.push, but one is unique to fennec, and one to desktop. +var expectedNumberOfCleanups = 6; window.addEventListener('unload', function() { for ( var cleanup of cleanupTasks ) {