Bug 1266134 - Wait for window close before ending test in browser_styleeditor_private_perwindowpb.js. r=jryans
MozReview-Commit-ID: 65WEA8goOP5
--- 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) {