mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
f61d6d0d3e
--HG-- rename : browser/components/sessionstore/test/browser/Makefile.in => browser/components/sessionstore/test/Makefile.in rename : browser/components/sessionstore/test/browser/browser_248970_a.js => browser/components/sessionstore/test/browser_248970_a.js rename : browser/components/sessionstore/test/browser/browser_248970_b.js => browser/components/sessionstore/test/browser_248970_b.js rename : browser/components/sessionstore/test/browser/browser_248970_b_sample.html => browser/components/sessionstore/test/browser_248970_b_sample.html rename : browser/components/sessionstore/test/browser/browser_339445.js => browser/components/sessionstore/test/browser_339445.js rename : browser/components/sessionstore/test/browser/browser_339445_sample.html => browser/components/sessionstore/test/browser_339445_sample.html rename : browser/components/sessionstore/test/browser/browser_345898.js => browser/components/sessionstore/test/browser_345898.js rename : browser/components/sessionstore/test/browser/browser_346337.js => browser/components/sessionstore/test/browser_346337.js rename : browser/components/sessionstore/test/browser/browser_346337_sample.html => browser/components/sessionstore/test/browser_346337_sample.html rename : browser/components/sessionstore/test/browser/browser_350525.js => browser/components/sessionstore/test/browser_350525.js rename : browser/components/sessionstore/test/browser/browser_354894.js => browser/components/sessionstore/test/browser_354894.js rename : browser/components/sessionstore/test/browser/browser_367052.js => browser/components/sessionstore/test/browser_367052.js rename : browser/components/sessionstore/test/browser/browser_393716.js => browser/components/sessionstore/test/browser_393716.js rename : browser/components/sessionstore/test/browser/browser_394759_basic.js => browser/components/sessionstore/test/browser_394759_basic.js rename : browser/components/sessionstore/test/browser/browser_394759_behavior.js => browser/components/sessionstore/test/browser_394759_behavior.js rename : browser/components/sessionstore/test/browser/browser_394759_privatebrowsing.js => browser/components/sessionstore/test/browser_394759_privatebrowsing.js rename : browser/components/sessionstore/test/browser/browser_394759_purge.js => browser/components/sessionstore/test/browser_394759_purge.js rename : browser/components/sessionstore/test/browser/browser_408470.js => browser/components/sessionstore/test/browser_408470.js rename : browser/components/sessionstore/test/browser/browser_408470_sample.html => browser/components/sessionstore/test/browser_408470_sample.html rename : browser/components/sessionstore/test/browser/browser_423132.js => browser/components/sessionstore/test/browser_423132.js rename : browser/components/sessionstore/test/browser/browser_423132_sample.html => browser/components/sessionstore/test/browser_423132_sample.html rename : browser/components/sessionstore/test/browser/browser_447951.js => browser/components/sessionstore/test/browser_447951.js rename : browser/components/sessionstore/test/browser/browser_447951_sample.html => browser/components/sessionstore/test/browser_447951_sample.html rename : browser/components/sessionstore/test/browser/browser_448741.js => browser/components/sessionstore/test/browser_448741.js rename : browser/components/sessionstore/test/browser/browser_454908.js => browser/components/sessionstore/test/browser_454908.js rename : browser/components/sessionstore/test/browser/browser_454908_sample.html => browser/components/sessionstore/test/browser_454908_sample.html rename : browser/components/sessionstore/test/browser/browser_456342.js => browser/components/sessionstore/test/browser_456342.js rename : browser/components/sessionstore/test/browser/browser_456342_sample.xhtml => browser/components/sessionstore/test/browser_456342_sample.xhtml rename : browser/components/sessionstore/test/browser/browser_459906.js => browser/components/sessionstore/test/browser_459906.js rename : browser/components/sessionstore/test/browser/browser_459906_empty.html => browser/components/sessionstore/test/browser_459906_empty.html rename : browser/components/sessionstore/test/browser/browser_459906_sample.html => browser/components/sessionstore/test/browser_459906_sample.html rename : browser/components/sessionstore/test/browser/browser_461634.js => browser/components/sessionstore/test/browser_461634.js rename : browser/components/sessionstore/test/browser/browser_461743.js => browser/components/sessionstore/test/browser_461743.js rename : browser/components/sessionstore/test/browser/browser_461743_sample.html => browser/components/sessionstore/test/browser_461743_sample.html rename : browser/components/sessionstore/test/browser/browser_463205.js => browser/components/sessionstore/test/browser_463205.js rename : browser/components/sessionstore/test/browser/browser_463205_helper.html => browser/components/sessionstore/test/browser_463205_helper.html rename : browser/components/sessionstore/test/browser/browser_463205_sample.html => browser/components/sessionstore/test/browser_463205_sample.html rename : browser/components/sessionstore/test/browser/browser_463206.js => browser/components/sessionstore/test/browser_463206.js rename : browser/components/sessionstore/test/browser/browser_463206_sample.html => browser/components/sessionstore/test/browser_463206_sample.html rename : browser/components/sessionstore/test/browser/browser_464199.js => browser/components/sessionstore/test/browser_464199.js rename : browser/components/sessionstore/test/browser/browser_464620_a.html => browser/components/sessionstore/test/browser_464620_a.html rename : browser/components/sessionstore/test/browser/browser_464620_a.js => browser/components/sessionstore/test/browser_464620_a.js rename : browser/components/sessionstore/test/browser/browser_464620_b.html => browser/components/sessionstore/test/browser_464620_b.html rename : browser/components/sessionstore/test/browser/browser_464620_b.js => browser/components/sessionstore/test/browser_464620_b.js rename : browser/components/sessionstore/test/browser/browser_464620_xd.html => browser/components/sessionstore/test/browser_464620_xd.html rename : browser/components/sessionstore/test/browser/browser_465215.js => browser/components/sessionstore/test/browser_465215.js rename : browser/components/sessionstore/test/browser/browser_465223.js => browser/components/sessionstore/test/browser_465223.js rename : browser/components/sessionstore/test/browser/browser_466937.js => browser/components/sessionstore/test/browser_466937.js rename : browser/components/sessionstore/test/browser/browser_466937_sample.html => browser/components/sessionstore/test/browser_466937_sample.html rename : browser/components/sessionstore/test/browser/browser_467409-backslashplosion.js => browser/components/sessionstore/test/browser_467409-backslashplosion.js rename : browser/components/sessionstore/test/browser/browser_477657.js => browser/components/sessionstore/test/browser_477657.js rename : browser/components/sessionstore/test/browser/browser_480148.js => browser/components/sessionstore/test/browser_480148.js rename : browser/components/sessionstore/test/browser/browser_480893.js => browser/components/sessionstore/test/browser_480893.js rename : browser/components/sessionstore/test/browser/browser_483330.js => browser/components/sessionstore/test/browser_483330.js rename : browser/components/sessionstore/test/browser/browser_485482.js => browser/components/sessionstore/test/browser_485482.js rename : browser/components/sessionstore/test/browser/browser_485482_sample.html => browser/components/sessionstore/test/browser_485482_sample.html rename : browser/components/sessionstore/test/browser/browser_485563.js => browser/components/sessionstore/test/browser_485563.js rename : browser/components/sessionstore/test/browser/browser_490040.js => browser/components/sessionstore/test/browser_490040.js rename : browser/components/sessionstore/test/browser/browser_491168.js => browser/components/sessionstore/test/browser_491168.js rename : browser/components/sessionstore/test/browser/browser_491577.js => browser/components/sessionstore/test/browser_491577.js rename : browser/components/sessionstore/test/browser/browser_493467.js => browser/components/sessionstore/test/browser_493467.js rename : browser/components/sessionstore/test/browser/browser_495495.js => browser/components/sessionstore/test/browser_495495.js rename : browser/components/sessionstore/test/browser/browser_500328.js => browser/components/sessionstore/test/browser_500328.js rename : browser/components/sessionstore/test/browser/browser_506482.js => browser/components/sessionstore/test/browser_506482.js rename : browser/components/sessionstore/test/browser/browser_514751.js => browser/components/sessionstore/test/browser_514751.js rename : browser/components/sessionstore/test/browser/browser_522375.js => browser/components/sessionstore/test/browser_522375.js rename : browser/components/sessionstore/test/browser/browser_522545.js => browser/components/sessionstore/test/browser_522545.js rename : browser/components/sessionstore/test/browser/browser_524745.js => browser/components/sessionstore/test/browser_524745.js rename : browser/components/sessionstore/test/browser/browser_526613.js => browser/components/sessionstore/test/browser_526613.js rename : browser/components/sessionstore/test/browser/browser_528776.js => browser/components/sessionstore/test/browser_528776.js rename : browser/components/sessionstore/test/browser/browser_579868.js => browser/components/sessionstore/test/browser_579868.js rename : browser/components/sessionstore/test/browser/browser_579879.js => browser/components/sessionstore/test/browser_579879.js rename : browser/components/sessionstore/test/browser/browser_580512.js => browser/components/sessionstore/test/browser_580512.js rename : browser/components/sessionstore/test/browser/browser_581593.js => browser/components/sessionstore/test/browser_581593.js rename : browser/components/sessionstore/test/browser/browser_581937.js => browser/components/sessionstore/test/browser_581937.js rename : browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js => browser/components/sessionstore/test/browser_586068-cascaded_restore.js rename : browser/components/sessionstore/test/browser/browser_586147.js => browser/components/sessionstore/test/browser_586147.js rename : browser/components/sessionstore/test/browser/browser_588426.js => browser/components/sessionstore/test/browser_588426.js rename : browser/components/sessionstore/test/browser/browser_589246.js => browser/components/sessionstore/test/browser_589246.js rename : browser/components/sessionstore/test/browser/browser_590268.js => browser/components/sessionstore/test/browser_590268.js rename : browser/components/sessionstore/test/browser/browser_590563.js => browser/components/sessionstore/test/browser_590563.js rename : browser/components/sessionstore/test/browser/browser_595601-restore_hidden.js => browser/components/sessionstore/test/browser_595601-restore_hidden.js rename : browser/components/sessionstore/test/browser/browser_597071.js => browser/components/sessionstore/test/browser_597071.js rename : browser/components/sessionstore/test/browser/browser_597315.js => browser/components/sessionstore/test/browser_597315.js rename : browser/components/sessionstore/test/browser/browser_597315_a.html => browser/components/sessionstore/test/browser_597315_a.html rename : browser/components/sessionstore/test/browser/browser_597315_b.html => browser/components/sessionstore/test/browser_597315_b.html rename : browser/components/sessionstore/test/browser/browser_597315_c.html => browser/components/sessionstore/test/browser_597315_c.html rename : browser/components/sessionstore/test/browser/browser_597315_c1.html => browser/components/sessionstore/test/browser_597315_c1.html rename : browser/components/sessionstore/test/browser/browser_597315_c2.html => browser/components/sessionstore/test/browser_597315_c2.html rename : browser/components/sessionstore/test/browser/browser_597315_index.html => browser/components/sessionstore/test/browser_597315_index.html rename : browser/components/sessionstore/test/browser/browser_599909.js => browser/components/sessionstore/test/browser_599909.js rename : browser/components/sessionstore/test/browser/browser_600545.js => browser/components/sessionstore/test/browser_600545.js rename : browser/components/sessionstore/test/browser/browser_601955.js => browser/components/sessionstore/test/browser_601955.js rename : browser/components/sessionstore/test/browser/browser_607016.js => browser/components/sessionstore/test/browser_607016.js rename : browser/components/sessionstore/test/browser/browser_615394-SSWindowState_events.js => browser/components/sessionstore/test/browser_615394-SSWindowState_events.js rename : browser/components/sessionstore/test/browser/browser_618151.js => browser/components/sessionstore/test/browser_618151.js rename : browser/components/sessionstore/test/browser/browser_623779.js => browser/components/sessionstore/test/browser_623779.js rename : browser/components/sessionstore/test/browser/browser_624727.js => browser/components/sessionstore/test/browser_624727.js rename : browser/components/sessionstore/test/browser/browser_625016.js => browser/components/sessionstore/test/browser_625016.js rename : browser/components/sessionstore/test/browser/browser_625257.js => browser/components/sessionstore/test/browser_625257.js rename : browser/components/sessionstore/test/browser/browser_628270.js => browser/components/sessionstore/test/browser_628270.js rename : browser/components/sessionstore/test/browser/browser_635418.js => browser/components/sessionstore/test/browser_635418.js rename : browser/components/sessionstore/test/browser/browser_636279.js => browser/components/sessionstore/test/browser_636279.js rename : browser/components/sessionstore/test/browser/browser_644409-scratchpads.js => browser/components/sessionstore/test/browser_644409-scratchpads.js rename : browser/components/sessionstore/test/browser/browser_645428.js => browser/components/sessionstore/test/browser_645428.js rename : browser/components/sessionstore/test/browser/browser_659591.js => browser/components/sessionstore/test/browser_659591.js rename : browser/components/sessionstore/test/browser/browser_662812.js => browser/components/sessionstore/test/browser_662812.js rename : browser/components/sessionstore/test/browser/browser_665702-state_session.js => browser/components/sessionstore/test/browser_665702-state_session.js rename : browser/components/sessionstore/test/browser/browser_682507.js => browser/components/sessionstore/test/browser_682507.js rename : browser/components/sessionstore/test/browser/browser_687710.js => browser/components/sessionstore/test/browser_687710.js rename : browser/components/sessionstore/test/browser/browser_687710_2.js => browser/components/sessionstore/test/browser_687710_2.js rename : browser/components/sessionstore/test/browser/browser_694378.js => browser/components/sessionstore/test/browser_694378.js rename : browser/components/sessionstore/test/browser/browser_705597.js => browser/components/sessionstore/test/browser_705597.js rename : browser/components/sessionstore/test/browser/browser_form_restore_events.js => browser/components/sessionstore/test/browser_form_restore_events.js rename : browser/components/sessionstore/test/browser/browser_form_restore_events_sample.html => browser/components/sessionstore/test/browser_form_restore_events_sample.html rename : browser/components/sessionstore/test/browser/head.js => browser/components/sessionstore/test/head.js
277 lines
9.8 KiB
JavaScript
277 lines
9.8 KiB
JavaScript
/* ***** BEGIN LICENSE BLOCK *****
|
||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||
*
|
||
* The contents of this file are subject to the Mozilla Public License Version
|
||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||
* the License. You may obtain a copy of the License at
|
||
* http://www.mozilla.org/MPL/
|
||
*
|
||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||
* for the specific language governing rights and limitations under the
|
||
* License.
|
||
*
|
||
* The Original Code is sessionstore test code.
|
||
*
|
||
* The Initial Developer of the Original Code is
|
||
* Mozilla Foundation.
|
||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||
* the Initial Developer. All Rights Reserved.
|
||
*
|
||
* Contributor(s):
|
||
* Paul O’Shannessy <paul@oshannessy.com>
|
||
*
|
||
* Alternatively, the contents of this file may be used under the terms of
|
||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||
* of those above. If you wish to allow use of your version of this file only
|
||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||
* use your version of this file under the terms of the MPL, indicate your
|
||
* decision by deleting the provisions above and replace them with the notice
|
||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||
* the provisions above, a recipient may use your version of this file under
|
||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||
*
|
||
* ***** END LICENSE BLOCK ***** */
|
||
|
||
// Mirrors WINDOW_ATTRIBUTES IN nsSessionStore.js
|
||
const WINDOW_ATTRIBUTES = ["width", "height", "screenX", "screenY", "sizemode"];
|
||
|
||
let stateBackup = ss.getBrowserState();
|
||
|
||
let originalWarnOnClose = gPrefService.getBoolPref("browser.tabs.warnOnClose");
|
||
let originalStartupPage = gPrefService.getIntPref("browser.startup.page");
|
||
let originalWindowType = document.documentElement.getAttribute("windowtype");
|
||
|
||
let gotLastWindowClosedTopic = false;
|
||
let shouldPinTab = false;
|
||
let shouldOpenTabs = false;
|
||
let shouldCloseTab = false;
|
||
let testNum = 0;
|
||
let afterTestCallback;
|
||
|
||
// Set state so we know the closed windows content
|
||
let testState = {
|
||
windows: [
|
||
{ tabs: [{ entries: [{ url: "http://example.org" }] }] }
|
||
],
|
||
_closedWindows: []
|
||
};
|
||
|
||
// We'll push a set of conditions and callbacks into this array
|
||
// Ideally we would also test win/linux under a complete set of conditions, but
|
||
// the tests for osx mirror the other set of conditions possible on win/linux.
|
||
let tests = [];
|
||
|
||
// the third & fourth test share a condition check, keep it DRY
|
||
function checkOSX34Generator(num) {
|
||
return function(aPreviousState, aCurState) {
|
||
// In here, we should have restored the pinned tab, so only the unpinned tab
|
||
// should be in aCurState. So let's shape our expectations.
|
||
let expectedState = JSON.parse(aPreviousState);
|
||
expectedState[0].tabs.shift();
|
||
// size attributes are stripped out in _prepDataForDeferredRestore in nsSessionStore.
|
||
// This isn't the best approach, but neither is comparing JSON strings
|
||
WINDOW_ATTRIBUTES.forEach(function (attr) delete expectedState[0][attr]);
|
||
|
||
is(aCurState, JSON.stringify(expectedState),
|
||
"test #" + num + ": closedWindowState is as expected");
|
||
};
|
||
}
|
||
function checkNoWindowsGenerator(num) {
|
||
return function(aPreviousState, aCurState) {
|
||
is(aCurState, "[]", "test #" + num + ": there should be no closedWindowsLeft");
|
||
};
|
||
}
|
||
|
||
// The first test has 0 pinned tabs and 1 unpinned tab
|
||
tests.push({
|
||
pinned: false,
|
||
extra: false,
|
||
close: false,
|
||
checkWinLin: checkNoWindowsGenerator(1),
|
||
checkOSX: function(aPreviousState, aCurState) {
|
||
is(aCurState, aPreviousState, "test #1: closed window state is unchanged");
|
||
}
|
||
});
|
||
|
||
// The second test has 1 pinned tab and 0 unpinned tabs.
|
||
tests.push({
|
||
pinned: true,
|
||
extra: false,
|
||
close: false,
|
||
checkWinLin: checkNoWindowsGenerator(2),
|
||
checkOSX: checkNoWindowsGenerator(2)
|
||
});
|
||
|
||
// The third test has 1 pinned tab and 2 unpinned tabs.
|
||
tests.push({
|
||
pinned: true,
|
||
extra: true,
|
||
close: false,
|
||
checkWinLin: checkNoWindowsGenerator(3),
|
||
checkOSX: checkOSX34Generator(3)
|
||
});
|
||
|
||
// The fourth test has 1 pinned tab, 2 unpinned tabs, and closes one unpinned tab.
|
||
tests.push({
|
||
pinned: true,
|
||
extra: true,
|
||
close: "one",
|
||
checkWinLin: checkNoWindowsGenerator(4),
|
||
checkOSX: checkOSX34Generator(4)
|
||
});
|
||
|
||
// The fifth test has 1 pinned tab, 2 unpinned tabs, and closes both unpinned tabs.
|
||
tests.push({
|
||
pinned: true,
|
||
extra: true,
|
||
close: "both",
|
||
checkWinLin: checkNoWindowsGenerator(5),
|
||
checkOSX: checkNoWindowsGenerator(5)
|
||
});
|
||
|
||
|
||
function test() {
|
||
/** Test for Bug 589246 - Closed window state getting corrupted when closing
|
||
and reopening last browser window without exiting browser **/
|
||
waitForExplicitFinish();
|
||
// windows opening & closing, so extending the timeout
|
||
requestLongerTimeout(2);
|
||
|
||
// We don't want the quit dialog pref
|
||
gPrefService.setBoolPref("browser.tabs.warnOnClose", false);
|
||
// Ensure that we would restore the session (important for Windows)
|
||
gPrefService.setIntPref("browser.startup.page", 3);
|
||
|
||
runNextTestOrFinish();
|
||
}
|
||
|
||
function runNextTestOrFinish() {
|
||
if (tests.length) {
|
||
setupForTest(tests.shift())
|
||
}
|
||
else {
|
||
// some state is cleaned up at the end of each test, but not all
|
||
["browser.tabs.warnOnClose", "browser.startup.page"].forEach(function(p) {
|
||
if (gPrefService.prefHasUserValue(p))
|
||
gPrefService.clearUserPref(p);
|
||
});
|
||
|
||
ss.setBrowserState(stateBackup);
|
||
executeSoon(finish);
|
||
}
|
||
}
|
||
|
||
function setupForTest(aConditions) {
|
||
// reset some checks
|
||
gotLastWindowClosedTopic = false;
|
||
shouldPinTab = aConditions.pinned;
|
||
shouldOpenTabs = aConditions.extra;
|
||
shouldCloseTab = aConditions.close;
|
||
testNum++;
|
||
|
||
// set our test callback
|
||
afterTestCallback = /Mac/.test(navigator.platform) ? aConditions.checkOSX
|
||
: aConditions.checkWinLin;
|
||
|
||
// Add observers
|
||
Services.obs.addObserver(onLastWindowClosed, "browser-lastwindow-close-granted", false);
|
||
|
||
// Set the state
|
||
Services.obs.addObserver(onStateRestored, "sessionstore-browser-state-restored", false);
|
||
ss.setBrowserState(JSON.stringify(testState));
|
||
}
|
||
|
||
function onStateRestored(aSubject, aTopic, aData) {
|
||
info("test #" + testNum + ": onStateRestored");
|
||
Services.obs.removeObserver(onStateRestored, "sessionstore-browser-state-restored", false);
|
||
|
||
// change this window's windowtype so that closing a new window will trigger
|
||
// browser-lastwindow-close-granted.
|
||
document.documentElement.setAttribute("windowtype", "navigator:testrunner");
|
||
|
||
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "http://example.com");
|
||
newWin.addEventListener("load", function(aEvent) {
|
||
newWin.removeEventListener("load", arguments.callee, false);
|
||
|
||
newWin.gBrowser.selectedBrowser.addEventListener("load", function() {
|
||
newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||
|
||
// pin this tab
|
||
if (shouldPinTab)
|
||
newWin.gBrowser.pinTab(newWin.gBrowser.selectedTab);
|
||
|
||
newWin.addEventListener("unload", function () {
|
||
newWin.removeEventListener("unload", arguments.callee, false);
|
||
onWindowUnloaded();
|
||
}, false);
|
||
// Open a new tab as well. On Windows/Linux this will be restored when the
|
||
// new window is opened below (in onWindowUnloaded). On OS X we'll just
|
||
// restore the pinned tabs, leaving the unpinned tab in the closedWindowsData.
|
||
if (shouldOpenTabs) {
|
||
let newTab = newWin.gBrowser.addTab("about:config");
|
||
let newTab2 = newWin.gBrowser.addTab("about:buildconfig");
|
||
|
||
newTab.linkedBrowser.addEventListener("load", function() {
|
||
newTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||
|
||
if (shouldCloseTab == "one") {
|
||
newWin.gBrowser.removeTab(newTab2);
|
||
}
|
||
else if (shouldCloseTab == "both") {
|
||
newWin.gBrowser.removeTab(newTab);
|
||
newWin.gBrowser.removeTab(newTab2);
|
||
}
|
||
newWin.BrowserTryToCloseWindow();
|
||
}, true);
|
||
}
|
||
else {
|
||
newWin.BrowserTryToCloseWindow();
|
||
}
|
||
}, true);
|
||
}, false);
|
||
}
|
||
|
||
// This will be called before the window is actually closed
|
||
function onLastWindowClosed(aSubject, aTopic, aData) {
|
||
info("test #" + testNum + ": onLastWindowClosed");
|
||
Services.obs.removeObserver(onLastWindowClosed, "browser-lastwindow-close-granted", false);
|
||
gotLastWindowClosedTopic = true;
|
||
}
|
||
|
||
// This is the unload event listener on the new window (from onStateRestored).
|
||
// Unload is fired after the window is closed, so sessionstore has already
|
||
// updated _closedWindows (which is important). We'll open a new window here
|
||
// which should actually trigger the bug.
|
||
function onWindowUnloaded() {
|
||
info("test #" + testNum + ": onWindowClosed");
|
||
ok(gotLastWindowClosedTopic, "test #" + testNum + ": browser-lastwindow-close-granted was notified prior");
|
||
|
||
let previousClosedWindowData = ss.getClosedWindowData();
|
||
|
||
// Now we want to open a new window
|
||
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:robots");
|
||
newWin.addEventListener("load", function(aEvent) {
|
||
newWin.removeEventListener("load", arguments.callee, false);
|
||
|
||
newWin.gBrowser.selectedBrowser.addEventListener("load", function () {
|
||
newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||
|
||
// Good enough for checking the state
|
||
afterTestCallback(previousClosedWindowData, ss.getClosedWindowData());
|
||
afterTestCleanup(newWin);
|
||
}, true);
|
||
|
||
}, false);
|
||
}
|
||
|
||
function afterTestCleanup(aNewWin) {
|
||
executeSoon(function() {
|
||
aNewWin.close();
|
||
document.documentElement.setAttribute("windowtype", originalWindowType);
|
||
runNextTestOrFinish();
|
||
});
|
||
}
|