browser/components/sessionstore/test/browser_659591.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/sessionstore/test/browser_659591.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  waitForExplicitFinish();
     1.9 +
    1.10 +  let eventReceived = false;
    1.11 +
    1.12 +  registerCleanupFunction(function () {
    1.13 +    ok(eventReceived, "SSWindowClosing event received");
    1.14 +  });
    1.15 +
    1.16 +  newWindow(function (win) {
    1.17 +    win.addEventListener("SSWindowClosing", function onWindowClosing() {
    1.18 +      win.removeEventListener("SSWindowClosing", onWindowClosing, false);
    1.19 +      eventReceived = true;
    1.20 +      waitForFocus(finish);
    1.21 +    }, false);
    1.22 +
    1.23 +    win.close();
    1.24 +  });
    1.25 +}
    1.26 +
    1.27 +function newWindow(callback) {
    1.28 +  let opts = "chrome,all,dialog=no,height=800,width=800";
    1.29 +  let win = window.openDialog(getBrowserURL(), "_blank", opts);
    1.30 +
    1.31 +  win.addEventListener("load", function onLoad() {
    1.32 +    win.removeEventListener("load", onLoad, false);
    1.33 +    executeSoon(function () callback(win));
    1.34 +  }, false);
    1.35 +}

mercurial