[tbb-commits] [tor-browser/esr24] Bug 772823 - Focus the main test window before closing the newly opened window in order to work around an unknown focus manager bug. r=gavin, a=test-only

mikeperry at torproject.org mikeperry at torproject.org
Fri Aug 29 05:26:40 UTC 2014


commit 745f14404e5e5d7ee21e3d70b5f09fd1f1533907
Author: Ehsan Akhgari <ehsan at mozilla.com>
Date:   Thu Apr 17 10:59:10 2014 -0400

    Bug 772823 - Focus the main test window before closing the newly opened window in order to work around an unknown focus manager bug. r=gavin, a=test-only
---
 docshell/test/chrome/mozFrameType_window.xul |   31 ++++++++++++++------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/docshell/test/chrome/mozFrameType_window.xul b/docshell/test/chrome/mozFrameType_window.xul
index 020e6f0..aa811c3 100644
--- a/docshell/test/chrome/mozFrameType_window.xul
+++ b/docshell/test/chrome/mozFrameType_window.xul
@@ -33,20 +33,23 @@
                     "iframe with mozFrameType='content' in chrome document is typeContent");
 
       SimpleTest.executeSoon(function () {
-        // Wait for the window to be closed before finishing the test
-        let ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
-                     .getService(Components.interfaces.nsIWindowWatcher);
-        ww.registerNotification(function windowObs(subject, topic, data) {
-          if (topic == "domwindowclosed") {
-            ww.unregisterNotification(windowObs);
-
-            SimpleTest.waitForFocus(function() {
-              SimpleTest.finish();
-            }, opener);
-          }
-        });
-
-        window.close();
+        // First focus the parent window and then close this one.
+        SimpleTest.waitForFocus(function() {
+          let ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
+                       .getService(Components.interfaces.nsIWindowWatcher);
+          ww.registerNotification(function windowObs(subject, topic, data) {
+            if (topic == "domwindowclosed") {
+              ww.unregisterNotification(windowObs);
+
+              // Don't start the next test synchronously!
+              SimpleTest.executeSoon(function() {
+                SimpleTest.finish();
+              });
+            }
+          });
+
+          window.close();
+        }, opener);
       });
     }
   ]]></script>





More information about the tbb-commits mailing list