Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 function test() {
6 /** Test for Bug 477657 **/
7 waitForExplicitFinish();
9 let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
10 newWin.addEventListener("load", function(aEvent) {
11 newWin.removeEventListener("load", arguments.callee, false);
13 let newState = { windows: [{
14 tabs: [{ entries: [] }],
15 _closedTabs: [{
16 state: { entries: [{ url: "about:" }]},
17 title: "About:"
18 }],
19 sizemode: "maximized"
20 }] };
22 let uniqueKey = "bug 477657";
23 let uniqueValue = "unik" + Date.now();
25 ss.setWindowValue(newWin, uniqueKey, uniqueValue);
26 is(ss.getWindowValue(newWin, uniqueKey), uniqueValue,
27 "window value was set before the window was overwritten");
28 ss.setWindowState(newWin, JSON.stringify(newState), true);
30 // use newWin.setTimeout(..., 0) to mirror sss_restoreWindowFeatures
31 newWin.setTimeout(function() {
32 is(ss.getWindowValue(newWin, uniqueKey), "",
33 "window value was implicitly cleared");
35 is(newWin.windowState, newWin.STATE_MAXIMIZED,
36 "the window was maximized");
38 is(JSON.parse(ss.getClosedTabData(newWin)).length, 1,
39 "the closed tab was added before the window was overwritten");
40 delete newState.windows[0]._closedTabs;
41 delete newState.windows[0].sizemode;
42 ss.setWindowState(newWin, JSON.stringify(newState), true);
44 newWin.setTimeout(function() {
45 is(JSON.parse(ss.getClosedTabData(newWin)).length, 0,
46 "closed tabs were implicitly cleared");
48 is(newWin.windowState, newWin.STATE_MAXIMIZED,
49 "the window remains maximized");
50 newState.windows[0].sizemode = "normal";
51 ss.setWindowState(newWin, JSON.stringify(newState), true);
53 newWin.setTimeout(function() {
54 isnot(newWin.windowState, newWin.STATE_MAXIMIZED,
55 "the window was explicitly unmaximized");
57 newWin.close();
58 finish();
59 }, 0);
60 }, 0);
61 }, 0);
62 }, false);
63 }