diff --git a/platform/firefox/bootstrap.js b/platform/firefox/bootstrap.js index fec58275d..96c1681d9 100644 --- a/platform/firefox/bootstrap.js +++ b/platform/firefox/bootstrap.js @@ -60,6 +60,12 @@ function startup(data, reason) { } let hiddenDoc = appShell.hiddenDOMWindow.document; + + if ( hiddenDoc.readyState === 'loading' ) { + hiddenDoc.addEventListener('DOMContentLoaded', onReady); + return; + } + 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 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 ) {