Bug 1266134 - Wait for window close before ending test in browser_styleeditor_private_perwindowpb.js. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 12 Sep 2016 03:20:52 -0700
changeset 319649 0b6042ee4d0325dadca719383175a46c2e9db6fe
parent 319648 31a80037ca8e54cba62321faddc49c355dbefb27
child 319650 2268d466af6cbf62fc48006d3ff00d087c339e8b
push id83207
push userphilringnalda@gmail.com
push dateThu, 27 Oct 2016 01:59:11 +0000
treeherdermozilla-inbound@58220cbd6604 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1266134
milestone52.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 1266134 - Wait for window close before ending test in browser_styleeditor_private_perwindowpb.js. r=jryans MozReview-Commit-ID: 65WEA8goOP5
devtools/client/styleeditor/test/browser_styleeditor_private_perwindowpb.js
--- a/devtools/client/styleeditor/test/browser_styleeditor_private_perwindowpb.js
+++ b/devtools/client/styleeditor/test/browser_styleeditor_private_perwindowpb.js
@@ -17,24 +17,36 @@ const cache = Cc["@mozilla.org/netwerk/c
 add_task(function* () {
   info("Opening a new private window");
   let win = OpenBrowserWindow({private: true});
   yield waitForDelayedStartupFinished(win);
 
   info("Clearing the browser cache");
   cache.clear();
 
-  let { ui } = yield openStyleEditorForURL(TEST_URL, win);
+  let { toolbox, ui } = yield openStyleEditorForURL(TEST_URL, win);
 
   is(ui.editors.length, 1, "The style editor contains one sheet.");
   let editor = ui.editors[0];
 
   yield editor.getSourceEditor();
   yield checkDiskCacheFor(TEST_HOST);
+
+  yield toolbox.destroy();
+
+  let onUnload = new Promise(done => {
+    win.addEventListener("unload", function listener(event) {
+      if (event.target == win.document) {
+        win.removeEventListener("unload", listener);
+        done();
+      }
+    });
+  });
   win.close();
+  yield onUnload;
 });
 
 function checkDiskCacheFor(host) {
   let foundPrivateData = false;
   let deferred = defer();
 
   Visitor.prototype = {
     onCacheStorageInfo: function (num) {