Bug 678763 - Intermittent browser_sourceeditor_initialization.js | application timed out after 330 seconds with no output; r=rcampbell
authorMihai Sucan <mihai.sucan@gmail.com>
Mon, 15 Aug 2011 18:38:53 +0300
changeset 75374 36dc4ffaaaaee5533349d589a82032ca05f2f96b
parent 75373 46cd0808d1c539b3068e871c88932f13fc21c552
child 75375 7715bba5cc3ac721b5c259cc52f5c15e4a08b9ce
push idunknown
push userunknown
push dateunknown
reviewersrcampbell
bugs678763
milestone8.0a1
Bug 678763 - Intermittent browser_sourceeditor_initialization.js | application timed out after 330 seconds with no output; r=rcampbell
browser/devtools/sourceeditor/test/browser_sourceeditor_initialization.js
--- a/browser/devtools/sourceeditor/test/browser_sourceeditor_initialization.js
+++ b/browser/devtools/sourceeditor/test/browser_sourceeditor_initialization.js
@@ -14,19 +14,26 @@ function test()
 {
   waitForExplicitFinish();
 
   const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
     "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
     " title='test for bug 660784' width='600' height='500'><hbox flex='1'/></window>";
   const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
 
-  testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
+  gBrowser.selectedTab = gBrowser.addTab();
+  gBrowser.selectedBrowser.addEventListener("load", function onTabLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onTabLoad, true);
 
-  testWin.addEventListener("load", initEditor, false);
+    testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
+    testWin.addEventListener("load", initEditor, false);
+  }, true);
+
+  content.location = "data:text/html,<p>bug 660784 - test the SourceEditor";
+
 }
 
 function initEditor()
 {
   testWin.removeEventListener("load", initEditor, false);
   testDoc = testWin.document;
 
   let hbox = testDoc.querySelector("hbox");
@@ -314,17 +321,21 @@ function editorLoaded()
   // Done.
 
   editor.destroy();
   ok(!editor.parentElement && !editor.editorElement, "destroy() works");
 
   testWin.close();
 
   testWin = testDoc = editor = null;
-  finish();
+
+  waitForFocus(function() {
+    gBrowser.removeCurrentTab();
+    finish();
+  }, content);
 }
 
 function testBackspaceKey()
 {
   editor.setText("       a\n  b\n c");
   editor.setCaretOffset(7);
   EventUtils.synthesizeKey("VK_BACK_SPACE", {}, testWin);
   is(editor.getText(), "a\n  b\n c", "line outdented (Backspace)");