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 const stateBackup = ss.getBrowserState();
6 const testState = {
7 windows: [{
8 tabs: [
9 { entries: [{ url: "about:blank" }] },
10 { entries: [{ url: "about:mozilla" }] }
11 ]
12 }]
13 };
16 function test() {
17 /** Test for Bug 618151 - Overwriting state can lead to unrestored tabs **/
18 waitForExplicitFinish();
19 runNextTest();
20 }
22 // Just a subset of tests from bug 615394 that causes a timeout.
23 let tests = [test_setup, test_hang];
24 function runNextTest() {
25 // set an empty state & run the next test, or finish
26 if (tests.length) {
27 // Enumerate windows and close everything but our primary window. We can't
28 // use waitForFocus() because apparently it's buggy. See bug 599253.
29 var windowsEnum = Services.wm.getEnumerator("navigator:browser");
30 while (windowsEnum.hasMoreElements()) {
31 var currentWindow = windowsEnum.getNext();
32 if (currentWindow != window) {
33 currentWindow.close();
34 }
35 }
37 let currentTest = tests.shift();
38 info("running " + currentTest.name);
39 waitForBrowserState(testState, currentTest);
40 }
41 else {
42 ss.setBrowserState(stateBackup);
43 executeSoon(finish);
44 }
45 }
47 function test_setup() {
48 function onSSTabRestored(aEvent) {
49 gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, false);
50 runNextTest();
51 }
53 gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
54 ss.setTabState(gBrowser.tabs[1], JSON.stringify({
55 entries: [{ url: "http://example.org" }],
56 extData: { foo: "bar" } }));
57 }
59 function test_hang() {
60 ok(true, "test didn't time out");
61 runNextTest();
62 }