browser/components/sessionstore/test/browser_495495.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:b409b18126aa
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 495495 **/
7
8 waitForExplicitFinish();
9
10 let newWin = openDialog(location, "_blank", "chrome,all,dialog=no,toolbar=yes");
11 newWin.addEventListener("load", function() {
12 newWin.removeEventListener("load", arguments.callee, false);
13
14 executeSoon(function() {
15 let state1 = ss.getWindowState(newWin);
16 newWin.close();
17
18 newWin = openDialog(location, "_blank",
19 "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar=no,location,personal,directories,dialog=no");
20 newWin.addEventListener("load", function() {
21 newWin.removeEventListener("load", arguments.callee, false);
22
23 executeSoon(function() {
24 let state2 = ss.getWindowState(newWin);
25 newWin.close();
26
27 function testState(state, expected, callback) {
28 let win = openDialog(location, "_blank", "chrome,all,dialog=no");
29 win.addEventListener("load", function() {
30 win.removeEventListener("load", arguments.callee, false);
31
32 is(win.gURLBar.readOnly, false,
33 "URL bar should not be read-only before setting the state");
34 is(win.gURLBar.getAttribute("enablehistory"), "true",
35 "URL bar autocomplete should be enabled before setting the state");
36 ss.setWindowState(win, state, true);
37 is(win.gURLBar.readOnly, expected.readOnly,
38 "URL bar read-only state should be restored correctly");
39 is(win.gURLBar.getAttribute("enablehistory"), expected.enablehistory,
40 "URL bar autocomplete state should be restored correctly");
41
42 win.close();
43 executeSoon(callback);
44 }, false);
45 }
46
47 testState(state1, {readOnly: false, enablehistory: "true"}, function() {
48 testState(state2, {readOnly: true, enablehistory: "false"}, finish);
49 });
50 });
51 }, false);
52 });
53 }, false);
54 }

mercurial