Bug 772823: try to work around intermittent failure of this test on Linux by avoiding closing the window during onload
authorGavin Sharp <gavin@gavinsharp.com>
Sun, 23 Sep 2012 17:13:01 -0700
changeset 107979 4f7bff5aa1ba6f1d560e764064072e9c3c332c76
parent 107978 013a65100228ba7564d8c870c08ab915130b7877
child 107980 97f93e053b4e3b046b9fe100b001ad7c899d5d64
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
bugs772823
milestone18.0a1
Bug 772823: try to work around intermittent failure of this test on Linux by avoiding closing the window during onload
docshell/test/chrome/mozFrameType_window.xul
--- a/docshell/test/chrome/mozFrameType_window.xul
+++ b/docshell/test/chrome/mozFrameType_window.xul
@@ -27,25 +27,29 @@
       var normalFrame = document.getElementById("normalFrame");
       var typeContentFrame = document.getElementById("typeContentFrame");
 
       SimpleTest.is(getDocShellType(normalFrame), Ci.nsIDocShellTreeItem.typeChrome,
                     "normal iframe in chrome document is typeChrome");
       SimpleTest.is(getDocShellType(typeContentFrame), Ci.nsIDocShellTreeItem.typeContent,
                     "iframe with mozFrameType='content' in chrome document is typeContent");
 
-      // 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(subject, topic, data) {
-        if (topic == "domwindowclosed") {
-          ww.unregisterNotification(arguments.callee);
-          SimpleTest.waitForFocus(function() {
-            SimpleTest.finish();
-          }, opener);
-        }
+      // avoid closing the window from within the onload event handler to see
+      // whether that fixes the intermittent orange in bug 772823
+      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();
       });
-
-      window.close();
     }
   ]]></script>
 </window>