Bug 1050638 - fix nits which got missed out in initial commit
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 10 Oct 2014 08:44:21 +0100
changeset 209725 1a6016480e7bc562da98883b476b4fae15bd264e
parent 209724 a0ee07b214da2f2ffe82d2d4d7c2d0801fa77c20
child 209726 746989e4c8d116ce86deaf3c0fbc9b0e3d632033
push id9265
push usergijskruitbosch@gmail.com
push dateFri, 10 Oct 2014 07:44:41 +0000
treeherderfx-team@1a6016480e7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1050638
milestone35.0a1
Bug 1050638 - fix nits which got missed out in initial commit
browser/base/content/tabbrowser.xml
browser/base/content/test/general/browser_double_close_tab.js
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1952,18 +1952,18 @@
               let ds = browser.docShell;
               if (ds && ds.contentViewer) {
                 // We need to block while calling permitUnload() because it
                 // processes the event queue and may lead to another removeTab()
                 // call before permitUnload() even returned.
                 aTab._pendingPermitUnload = true;
                 let permitUnload = ds.contentViewer.permitUnload();
                 delete aTab._pendingPermitUnload;
-                // If we were closed during the unload, we return false now so
-                // we don't (try to) close the same tab again. Of course, we
+                // If we were closed during onbeforeunload, we return false now
+                // so we don't (try to) close the same tab again. Of course, we
                 // also stop if the unload was cancelled by the user:
                 if (aTab.closing || !permitUnload) {
                   // NB: deliberately keep the _closedDuringPermitUnload set to
                   // true so we keep exiting early in case of multiple calls.
                   return false;
                 }
               }
             }
--- a/browser/base/content/test/general/browser_double_close_tab.js
+++ b/browser/base/content/test/general/browser_double_close_tab.js
@@ -1,9 +1,9 @@
-"use strict"
+"use strict";
 const TEST_PAGE = "http://mochi.test:8888/browser/browser/base/content/test/general/file_double_close_tab.html";
 let testTab;
 
 function waitForDialog(callback) {
   function onTabModalDialogLoaded(node) {
     Services.obs.removeObserver(onTabModalDialogLoaded, "tabmodal-dialog-loaded");
     callback(node);
   }
@@ -38,19 +38,19 @@ add_task(function*() {
   testTab = gBrowser.selectedTab = gBrowser.addTab();
   yield promiseTabLoadEvent(testTab, TEST_PAGE);
   //XXXgijs the reason this has nesting and callbacks rather than promises is
   // that DOM promises resolve on the next tick. So they're scheduled
   // in an event queue. So when we spin a new event queue for a modal dialog...
   // everything gets messed up and the promise's .then callbacks never get
   // called, despite resolve() being called just fine.
   let dialogNode = yield new Promise(resolveOuter => {
-    waitForDialog(function(dialogNode) {
+    waitForDialog(dialogNode => {
       waitForDialogDestroyed(dialogNode, () => {
-        let doCompletion = () => setTimeout(resolveOuter, 10);
+        let doCompletion = () => setTimeout(resolveOuter, 0);
         info("Now checking if dialog is destroyed");
         ok(!dialogNode.parentNode, "onbeforeunload dialog should be gone.");
         if (dialogNode.parentNode) {
           // Failed to remove onbeforeunload dialog, so do it ourselves:
           let leaveBtn = dialogNode.ui.button0;
           waitForDialogDestroyed(dialogNode, doCompletion);
           EventUtils.synthesizeMouseAtCenter(leaveBtn, {});
           return;