browser/components/sessionstore/test/browser_480893.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:37d3c8254cde
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/. */
4
5 function test() {
6 /** Test for Bug 480893 **/
7
8 waitForExplicitFinish();
9
10 // Test that starting a new session loads a blank page if Firefox is
11 // configured to display a blank page at startup (browser.startup.page = 0)
12 gPrefService.setIntPref("browser.startup.page", 0);
13 let tab = gBrowser.addTab("about:sessionrestore");
14 gBrowser.selectedTab = tab;
15 let browser = tab.linkedBrowser;
16 whenBrowserLoaded(browser, function() {
17 let doc = browser.contentDocument;
18
19 // click on the "Start New Session" button after about:sessionrestore is loaded
20 doc.getElementById("errorCancel").click();
21 whenBrowserLoaded(browser, function() {
22 let doc = browser.contentDocument;
23
24 is(doc.URL, "about:blank", "loaded page is about:blank");
25
26 // Test that starting a new session loads the homepage (set to http://mochi.test:8888)
27 // if Firefox is configured to display a homepage at startup (browser.startup.page = 1)
28 let homepage = "http://mochi.test:8888/";
29 gPrefService.setCharPref("browser.startup.homepage", homepage);
30 gPrefService.setIntPref("browser.startup.page", 1);
31 gBrowser.loadURI("about:sessionrestore");
32 whenBrowserLoaded(browser, function() {
33 let doc = browser.contentDocument;
34
35 // click on the "Start New Session" button after about:sessionrestore is loaded
36 doc.getElementById("errorCancel").click();
37 whenBrowserLoaded(browser, function() {
38 let doc = browser.contentDocument;
39
40 is(doc.URL, homepage, "loaded page is the homepage");
41
42 // close tab, restore default values and finish the test
43 gBrowser.removeTab(tab);
44 gPrefService.clearUserPref("browser.startup.page");
45 gPrefService.clearUserPref("browser.startup.homepage");
46 finish();
47 });
48 });
49 });
50 });
51 }

mercurial