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 465223 **/
8 // test setup
9 waitForExplicitFinish();
11 let uniqueKey1 = "bug 465223.1";
12 let uniqueKey2 = "bug 465223.2";
13 let uniqueValue1 = "unik" + Date.now();
14 let uniqueValue2 = "pi != " + Math.random();
16 // open a window and set a value on it
17 let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
18 newWin.addEventListener("load", function(aEvent) {
19 newWin.removeEventListener("load", arguments.callee, false);
21 ss.setWindowValue(newWin, uniqueKey1, uniqueValue1);
23 let newState = { windows: [{ tabs:[{ entries: [] }], extData: {} }] };
24 newState.windows[0].extData[uniqueKey2] = uniqueValue2;
25 ss.setWindowState(newWin, JSON.stringify(newState), false);
27 is(newWin.gBrowser.tabs.length, 2,
28 "original tab wasn't overwritten");
29 is(ss.getWindowValue(newWin, uniqueKey1), uniqueValue1,
30 "window value wasn't overwritten when the tabs weren't");
31 is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue2,
32 "new window value was correctly added");
34 newState.windows[0].extData[uniqueKey2] = uniqueValue1;
35 ss.setWindowState(newWin, JSON.stringify(newState), true);
37 is(newWin.gBrowser.tabs.length, 1,
38 "original tabs were overwritten");
39 is(ss.getWindowValue(newWin, uniqueKey1), "",
40 "window value was cleared");
41 is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue1,
42 "window value was correctly overwritten");
44 // clean up
45 newWin.close();
46 finish();
47 }, false);
48 }