Bug 1370102 - Make browser_console_dead_objects.js correctly wait for the window to be destroyed instead of relying on the scheduling of the corresponding event; r=kmag
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 30 May 2017 16:38:56 -0400
changeset 412721 5dd5d16e708558e464ef335c67defdf41838cea8
parent 412720 be7ee8326facc899155d9d1c6573f73731921b9b
child 412722 70e36d9d546e22b44ec55eb5906987d95bfcbcc7
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1370102
milestone55.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 1370102 - Make browser_console_dead_objects.js correctly wait for the window to be destroyed instead of relying on the scheduling of the corresponding event; r=kmag
devtools/client/webconsole/test/browser_console_dead_objects.js
--- a/devtools/client/webconsole/test/browser_console_dead_objects.js
+++ b/devtools/client/webconsole/test/browser_console_dead_objects.js
@@ -25,16 +25,18 @@ function test() {
     Services.prefs.clearUserPref("devtools.chrome.enabled");
   });
 
   Task.spawn(runner).then(finishTest);
 
   function* runner() {
     Services.prefs.setBoolPref("devtools.chrome.enabled", true);
     yield loadTab(TEST_URI);
+    let browser = gBrowser.selectedBrowser;
+    let winID = browser.outerWindowID;
 
     info("open the browser console");
 
     hud = yield HUDService.toggleBrowserConsole();
     ok(hud, "browser console opened");
 
     let jsterm = hud.jsterm;
 
@@ -45,16 +47,21 @@ function test() {
                   "Cu.import('resource://gre/modules/Services.jsm');" +
                   "chromeWindow = Services.wm.getMostRecentWindow('" +
                   "navigator:browser');" +
                   "foobarzTezt = chromeWindow.content.document;" +
                   "delete chromeWindow");
 
     gBrowser.removeCurrentTab();
 
+    yield TestUtils.topicObserved("outer-window-destroyed", (subject, data) => {
+      let id = subject.QueryInterface(Components.interfaces.nsISupportsPRUint64).data;
+      return id == winID;
+    });
+
     let msg = yield jsterm.execute("foobarzTezt");
 
     isnot(hud.outputNode.textContent.indexOf("[object DeadObject]"), -1,
           "dead object found");
 
     jsterm.setInputValue("foobarzTezt");
 
     for (let c of ".hello") {