Back out 3476008605b4 (bug 1255121) for not fixing test_bug260264.html enough
authorPhil Ringnalda <philringnalda@gmail.com>
Wed, 09 Mar 2016 20:52:15 -0800
changeset 311786 4bad8d204efec6228b299dfaf50b0c5171cce4f1
parent 311785 663c403368893a573d7a2198cb0ec867e95010cc
child 311787 95bf9744c1324cdf2c16381d9564883b4990c405
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1255121, 260264
milestone48.0a1
backs out3476008605b4624b72f2fdd496df9d17b234af86
Back out 3476008605b4 (bug 1255121) for not fixing test_bug260264.html enough
dom/tests/mochitest/bugs/mochitest.ini
dom/tests/mochitest/bugs/test_bug260264.html
dom/tests/mochitest/bugs/utils_bug260264.js
--- a/dom/tests/mochitest/bugs/mochitest.ini
+++ b/dom/tests/mochitest/bugs/mochitest.ini
@@ -36,17 +36,17 @@ support-files =
   file_cookieOutputter.html
   file_redirector.sjs
   file_prime_cookie.html
 
 [test_DOMWindowCreated_chromeonly.html]
 [test_bug132255.html]
 [test_bug159849.html]
 [test_bug260264.html]
-skip-if = buildapp == 'b2g' || toolkit == 'android' # b2g(dom.disable_open_during_load not implemented in b2g) b2g-debug(dom.disable_open_during_load not implemented in b2g) b2g-desktop(dom.disable_open_during_load not implemented in b2g)
+skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(dom.disable_open_during_load not implemented in b2g) b2g-debug(dom.disable_open_during_load not implemented in b2g) b2g-desktop(dom.disable_open_during_load not implemented in b2g)
 [test_bug260264_nested.html]
 skip-if = buildapp == 'b2g' # b2g(dom.disable_open_during_load not implemented in b2g) b2g-debug(dom.disable_open_during_load not implemented in b2g) b2g-desktop(dom.disable_open_during_load not implemented in b2g)
 [test_bug265203.html]
 [test_bug291377.html]
 [test_bug291653.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT # b2g(showmodaldialog) b2g-debug(showmodaldialog) b2g-desktop(showmodaldialog)
 [test_bug304459.html]
 [test_bug308856.html]
--- a/dom/tests/mochitest/bugs/test_bug260264.html
+++ b/dom/tests/mochitest/bugs/test_bug260264.html
@@ -31,151 +31,138 @@ var a = $("link"),
     checkBlocked = function() { ok(!window.open("http://example.com"), "not properly blocked") };
 
 
 function run_tests() {
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
-  window.open.close().then(() => {
-    SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests2);
-  });
+  window.open.close();
+
+  SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests2);
 }
 
 function run_tests2() {
   for (var count = 0, n = 0; n < 3; n++)
     send(a, "mouseup", function() { if (window.open("http://example.com")) count++ });
   send(a, "mouseup", checkBlocked);
-  window.open.close(1).then(() => {
+  window.open.close(1);
+  send(a, "mouseup", checkOpened);
+  send(a, "mouseup", checkBlocked);
+  send(a, "mouseup", checkBlocked);
+  window.open.close();
+  ok(count > 0, "Windows left open by previous tests?");
+  while (count --> 0)
     send(a, "mouseup", checkOpened);
-    send(a, "mouseup", checkBlocked);
-    send(a, "mouseup", checkBlocked);
-    return window.open.close();
-  }).then(() => {
-    ok(count > 0, "Windows left open by previous tests?");
-    while (count --> 0)
-      send(a, "mouseup", checkOpened);
-    send(a, "mouseup", checkBlocked);
-    return window.open.close();
-  }).then(() => {
+  send(a, "mouseup", checkBlocked);
+  window.open.close();
 
-    SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}, run_tests3);
-  });
+  SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}, run_tests3);
 }
 
 function run_tests3() {
   send(a, "mouseover", checkBlocked);
-  window.open.close().then(() => {
-    SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}], function() {
-      SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests4);
-    });
+  window.open.close();
+  SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}], function() {
+    SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests4);
   });
 }
 
 function run_tests4() {
-  var count;
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
-  window.open.close().then(() => {
-    send(a, "mouseup", checkOpened);
-    send(a, "mouseup", checkOpened);
-    send(a, "mouseup", checkOpened);
-    send(a, "mouseup", checkOpened);
-    return window.open.close();
-  }).then(() => {
-    for (count = 0, n = 0; n < 3; n++)
-      send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
-    send(a, "mouseover", checkBlocked);
-    return window.open.close(1);
-  }).then(() => {
+  window.open.close();
+
+  send(a, "mouseup", checkOpened);
+  send(a, "mouseup", checkOpened);
+  send(a, "mouseup", checkOpened);
+  send(a, "mouseup", checkOpened);
+  window.open.close();
+
+  for (var count = 0, n = 0; n < 3; n++)
+    send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
+  send(a, "mouseover", checkBlocked);
+  window.open.close(1);
+  send(a, "mouseover", checkOpened);
+  send(a, "mouseover", checkBlocked);
+  send(a, "mouseover", checkBlocked);
+  window.open.close();
+  ok(count > 0, "Windows left open by previous tests?");
+  while (count --> 0)
     send(a, "mouseover", checkOpened);
-    send(a, "mouseover", checkBlocked);
-    send(a, "mouseover", checkBlocked);
-    return window.open.close();
-  }).then(() => {
-    ok(count > 0, "Windows left open by previous tests?");
-    while (count --> 0)
-      send(a, "mouseover", checkOpened);
-    send(a, "mouseover", checkBlocked);
-    return window.open.close();
-  }).then(() => {
-    SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events", "click"]]}, run_tests5);
-  });
+  send(a, "mouseover", checkBlocked);
+  window.open.close();
+
+  SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events", "click"]]}, run_tests5);
 }
 
 function run_tests5() {
   SpecialPowers.pushPermissions([{'type': 'popup', 'allow': DENY_ACTION, 'context': document}], run_tests6);
 }
 
 function run_tests6() {
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
-  window.open.close().then(() => {
-    SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}, run_tests7);
-  });
+  window.open.close();
+
+  SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}, run_tests7);
 }
 
 function run_tests7() {
   send(a, "mouseup", checkBlocked);
-  window.open.close().then(() => {
-    send(a, "mouseover", checkBlocked);
-    return window.open.close();
-  }).then(() => {
-    SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}], function() {
-      SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests8);
-    });
+  window.open.close();
+  send(a, "mouseover", checkBlocked);
+  window.open.close();
+
+  SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}], function() {
+    SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests8);
   });
 }
 
 function run_tests8() {
-  var count;
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
   send(a, "click", checkOpened);
-  window.open.close().then(() => {
-    for (count = 0, n = 0; n < 3; n++)
-      send(a, "mouseup", function() { if (window.open("http://example.com")) count++ });
-    send(a, "mouseup", checkBlocked);
-    return window.open.close(1);
-  }).then(() => {
+  window.open.close();
+
+  for (var count = 0, n = 0; n < 3; n++)
+    send(a, "mouseup", function() { if (window.open("http://example.com")) count++ });
+  send(a, "mouseup", checkBlocked);
+  window.open.close(1);
+  send(a, "mouseup", checkOpened);
+  send(a, "mouseup", checkBlocked);
+  send(a, "mouseup", checkBlocked);
+  window.open.close();
+  ok(count > 0, "Windows left open by previous tests?");
+  while (count --> 0)
     send(a, "mouseup", checkOpened);
-    send(a, "mouseup", checkBlocked);
-    send(a, "mouseup", checkBlocked);
-    return window.open.close();
-  }).then(() => {
-    ok(count > 0, "Windows left open by previous tests?");
-    while (count --> 0)
-      send(a, "mouseup", checkOpened);
-    send(a, "mouseup", checkBlocked);
-    return window.open.close();
-  }).then(() => {
-    for (count = 0, n = 0; n < 3; n++)
-      send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
-    send(a, "mouseover", checkBlocked);
-    return window.open.close(1);
-  }).then(() => {
+  send(a, "mouseup", checkBlocked);
+  window.open.close();
+
+  for (var count = 0, n = 0; n < 3; n++)
+    send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
+  send(a, "mouseover", checkBlocked);
+  window.open.close(1);
+  send(a, "mouseover", checkOpened);
+  send(a, "mouseover", checkBlocked);
+  send(a, "mouseover", checkBlocked);
+  window.open.close();
+  ok(count > 0, "Windows left open by previous tests?");
+  while (count --> 0)
     send(a, "mouseover", checkOpened);
-    send(a, "mouseover", checkBlocked);
-    send(a, "mouseover", checkBlocked);
-    return window.open.close();
-  }).then(() => {
-    ok(count > 0, "Windows left open by previous tests?");
-    while (count --> 0)
-      send(a, "mouseover", checkOpened);
-    send(a, "mouseover", checkBlocked);
-    return window.open.close();
-  }).then(() => {
-    SimpleTest.finish();
-  });
+  send(a, "mouseover", checkBlocked);
+  window.open.close();
+
+  SimpleTest.finish();
 }
 
 function check_sanity() {
   ok(SpecialPowers.testPermission('popup', UNKNOWN_ACTION, document), 'popup value should have UNKNOWN permission');
   SpecialPowers.pushPermissions([{'type': 'popup', 'allow': true, 'context': document}], check_sanity2);
 }
 
 function check_sanity2() {
--- a/dom/tests/mochitest/bugs/utils_bug260264.js
+++ b/dom/tests/mochitest/bugs/utils_bug260264.js
@@ -20,33 +20,17 @@ function send(element, event, handler) {
 (function(originalOpen) {
   var wins = [];
   (window.open = function() {
     var win = originalOpen.apply(window, arguments);
     if (win)
       wins[wins.length] = win;
     return win;
   }).close = function(n) {
-    var promises = [];
     if (arguments.length < 1)
       n = wins.length;
     while (n --> 0) {
       var win = wins.pop();
-      if (win) {
-        promises.push((function(openedWindow) {
-          return new Promise(function(resolve) {
-            SpecialPowers.addObserver(function observer(subject, topic, data) {
-              if (subject == openedWindow) {
-                SpecialPowers.removeObserver(observer, "dom-window-destroyed");
-                SimpleTest.executeSoon(resolve);
-              }
-            }, "dom-window-destroyed", false);
-          });
-        })(win));
-        win.close();
-      } else {
-        promises.push(Promise.resolve());
-        break;
-      }
+      if (win) win.close();
+      else break;
     }
-    return Promise.all(promises);
   };
 })(window.open);