Bug 824016 - Intermittent leak in browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js; r=past a=ehsan
authorMihai Sucan <mihai.sucan@gmail.com>
Fri, 18 Jan 2013 13:43:43 +0200
changeset 127163 636f7b80515b88042ddc5165f46185aee9d4689c
parent 127162 76b9e934a0fcaca4d9164d844a1adfeed51985a5
child 127164 09f5bf30cdc0961c73fb1bc327f9df564cb04875
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast, ehsan
bugs824016
milestone20.0a2
Bug 824016 - Intermittent leak in browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js; r=past a=ehsan
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
@@ -30,68 +30,62 @@ function win2Loaded(aEvent) {
 
 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);
+      gDevTools.closeToolbox(target1).then(onWebConsoleClose);
     }
     catch (ex) {
       ok(false, "gDevTools.closeToolbox(target1) exception: " + ex);
       noErrors = false;
     }
 
     try {
       let target2 = TargetFactory.forTab(tab2);
-      gDevTools.closeToolbox(target2);
+      gDevTools.closeToolbox(target2).then(onWebConsoleClose);
     }
     catch (ex) {
       ok(false, "gDevTools.closeToolbox(target2) exception: " + ex);
       noErrors = false;
     }
   }
 
   function testEnd() {