41 let ss =
Cc[
"@mozilla.org/browser/sessionstore;1"].getService(
Ci.nsISessionStore);
44 let uniqueKey1 =
"bug 465223.1";
45 let uniqueKey2 =
"bug 465223.2";
46 let uniqueValue1 =
"unik" + Date.now();
47 let uniqueValue2 =
"pi != " + Math.random();
50 let newWin = openDialog(location,
"_blank",
"chrome,all,dialog=no");
51 newWin.addEventListener(
"load",
function(aEvent) {
52 ss.setWindowValue(newWin, uniqueKey1, uniqueValue1);
54 let newState = {
windows: [{
tabs:[{ entries: [] }], extData: {} }] };
55 newState.windows[0].extData[uniqueKey2] = uniqueValue2;
56 ss.setWindowState(newWin,
JSON.stringify(newState),
false);
58 is(newWin.gBrowser.tabContainer.childNodes.length, 2,
59 "original tab wasn't overwritten");
60 is(ss.getWindowValue(newWin, uniqueKey1), uniqueValue1,
61 "window value wasn't overwritten when the tabs weren't");
62 is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue2,
63 "new window value was correctly added");
65 newState.windows[0].extData[uniqueKey2] = uniqueValue1;
66 ss.setWindowState(newWin,
JSON.stringify(newState),
true);
68 is(newWin.gBrowser.tabContainer.childNodes.length, 1,
69 "original tabs were overwritten");
70 is(ss.getWindowValue(newWin, uniqueKey1),
"",
71 "window value was cleared");
72 is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue1,
73 "window value was correctly overwritten");