michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: let eventReceived = false; michael@0: michael@0: registerCleanupFunction(function () { michael@0: ok(eventReceived, "SSWindowClosing event received"); michael@0: }); michael@0: michael@0: newWindow(function (win) { michael@0: win.addEventListener("SSWindowClosing", function onWindowClosing() { michael@0: win.removeEventListener("SSWindowClosing", onWindowClosing, false); michael@0: eventReceived = true; michael@0: waitForFocus(finish); michael@0: }, false); michael@0: michael@0: win.close(); michael@0: }); michael@0: } michael@0: michael@0: function newWindow(callback) { michael@0: let opts = "chrome,all,dialog=no,height=800,width=800"; michael@0: let win = window.openDialog(getBrowserURL(), "_blank", opts); michael@0: michael@0: win.addEventListener("load", function onLoad() { michael@0: win.removeEventListener("load", onLoad, false); michael@0: executeSoon(function () callback(win)); michael@0: }, false); michael@0: }