browser_659591.js (850B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 function test() { 5 waitForExplicitFinish(); 6 7 let eventReceived = false; 8 9 registerCleanupFunction(function () { 10 ok(eventReceived, "SSWindowClosing event received"); 11 }); 12 13 newWindow(function (win) { 14 win.addEventListener( 15 "SSWindowClosing", 16 function () { 17 eventReceived = true; 18 }, 19 { once: true } 20 ); 21 22 BrowserTestUtils.closeWindow(win).then(() => { 23 waitForFocus(finish); 24 }); 25 }); 26 } 27 28 function newWindow(callback) { 29 let opts = "chrome,all,dialog=no,height=800,width=800"; 30 let win = window.openDialog(AppConstants.BROWSER_CHROME_URL, "_blank", opts); 31 32 win.addEventListener( 33 "load", 34 function () { 35 executeSoon(() => callback(win)); 36 }, 37 { once: true } 38 ); 39 }