40 let ss =
Cc[
"@mozilla.org/browser/sessionstore;1"].getService(
Ci.nsISessionStore);
43 let newWin = openDialog(location,
"_blank",
"chrome,all,dialog=no");
44 newWin.addEventListener(
"load",
function(aEvent) {
46 tabs: [{ entries: [] }],
48 state: { entries: [{
url:
"about:" }]},
54 let uniqueKey =
"bug 477657";
55 let uniqueValue =
"unik" + Date.now();
57 ss.setWindowValue(newWin, uniqueKey, uniqueValue);
58 is(ss.getWindowValue(newWin, uniqueKey), uniqueValue,
59 "window value was set before the window was overwritten");
60 ss.setWindowState(newWin,
JSON.stringify(newState),
true);
64 is(ss.getWindowValue(newWin, uniqueKey),
"",
65 "window value was implicitly cleared");
67 is(newWin.windowState, newWin.STATE_MAXIMIZED,
68 "the window was maximized");
70 is(
JSON.parse(ss.getClosedTabData(newWin)).length, 1,
71 "the closed tab was added before the window was overwritten");
72 delete newState.windows[0]._closedTabs;
73 delete newState.windows[0].sizemode;
74 ss.setWindowState(newWin,
JSON.stringify(newState),
true);
77 is(
JSON.parse(ss.getClosedTabData(newWin)).length, 0,
78 "closed tabs were implicitly cleared");
80 is(newWin.windowState, newWin.STATE_MAXIMIZED,
81 "the window remains maximized");
82 newState.windows[0].sizemode =
"normal";
83 ss.setWindowState(newWin,
JSON.stringify(newState),
true);
86 isnot(newWin.windowState, newWin.STATE_MAXIMIZED,
87 "the window was explicitly unmaximized");
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)