Bug 880010 - Fix for intermittent browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js | uncaught exception - NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebProgress.removeProgressListener] | Test timed out; r=me
authorMihai Sucan <mihai.sucan@gmail.com>
Tue, 16 Jul 2013 15:30:30 +0300
changeset 138662 381473907cd0cf9a9fa2eb633b6f03fff891495b
parent 138661 61c26f84396138d0df9176c41bc61a84b0acf42c
child 138663 3d33faf4d81fd4b1a8739d66d7a48d398ea4c9ea
push id24964
push userryanvm@gmail.com
push dateTue, 16 Jul 2013 20:04:09 +0000
treeherderautoland@fd10ead17ace [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs880010
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 880010 - Fix for intermittent browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js | uncaught exception - NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebProgress.removeProgressListener] | Test timed out; r=me
browser/devtools/webconsole/test/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js
@@ -12,80 +12,63 @@ const TEST_URI = "http://example.com/bro
 
 let tab1, tab2, win1, win2;
 let noErrors = true;
 
 function tab1Loaded(aEvent) {
   browser.removeEventListener(aEvent.type, tab1Loaded, true);
 
   win2 = OpenBrowserWindow();
-  win2.addEventListener("load", win2Loaded, true);
+  whenDelayedStartupFinished(win2, win2Loaded);
 }
 
-function win2Loaded(aEvent) {
-  win2.removeEventListener(aEvent.type, win2Loaded, true);
-
+function win2Loaded() {
   tab2 = win2.gBrowser.addTab(TEST_URI);
   win2.gBrowser.selectedTab = tab2;
   tab2.linkedBrowser.addEventListener("load", tab2Loaded, true);
 }
 
 function tab2Loaded(aEvent) {
   tab2.linkedBrowser.removeEventListener(aEvent.type, tab2Loaded, true);
 
   let consolesOpened = 0;
   function onWebConsoleOpen() {
     consolesOpened++;
     if (consolesOpened == 2) {
-      Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
       executeSoon(closeConsoles);
     }
   }
 
-  Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
-
   function openConsoles() {
     try {
       let target1 = TargetFactory.forTab(tab1);
-      gDevTools.showToolbox(target1, "webconsole");
+      gDevTools.showToolbox(target1, "webconsole").then(onWebConsoleOpen);
     }
     catch (ex) {
       ok(false, "gDevTools.showToolbox(target1) exception: " + ex);
       noErrors = false;
     }
 
     try {
       let target2 = TargetFactory.forTab(tab2);
-      gDevTools.showToolbox(target2, "webconsole");
+      gDevTools.showToolbox(target2, "webconsole").then(onWebConsoleOpen);
     }
     catch (ex) {
       ok(false, "gDevTools.showToolbox(target2) exception: " + ex);
       noErrors = false;
     }
   }
 
-  let consolesClosed = 0;
-  function onWebConsoleClose()
-  {
-    consolesClosed++;
-    if (consolesClosed == 2) {
-      Services.obs.removeObserver(onWebConsoleClose, "web-console-destroyed");
-      executeSoon(testEnd);
-    }
-  }
-
   function closeConsoles() {
-    Services.obs.addObserver(onWebConsoleClose, "web-console-destroyed", false);
-
     try {
       let target1 = TargetFactory.forTab(tab1);
       gDevTools.closeToolbox(target1).then(function() {
         try {
           let target2 = TargetFactory.forTab(tab2);
-          gDevTools.closeToolbox(target2);
+          gDevTools.closeToolbox(target2).then(testEnd);
         }
         catch (ex) {
           ok(false, "gDevTools.closeToolbox(target2) exception: " + ex);
           noErrors = false;
         }
       });
     }
     catch (ex) {