michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function test() { michael@0: /** Test for Bug 495495 **/ michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: let newWin = openDialog(location, "_blank", "chrome,all,dialog=no,toolbar=yes"); michael@0: newWin.addEventListener("load", function() { michael@0: newWin.removeEventListener("load", arguments.callee, false); michael@0: michael@0: executeSoon(function() { michael@0: let state1 = ss.getWindowState(newWin); michael@0: newWin.close(); michael@0: michael@0: newWin = openDialog(location, "_blank", michael@0: "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar=no,location,personal,directories,dialog=no"); michael@0: newWin.addEventListener("load", function() { michael@0: newWin.removeEventListener("load", arguments.callee, false); michael@0: michael@0: executeSoon(function() { michael@0: let state2 = ss.getWindowState(newWin); michael@0: newWin.close(); michael@0: michael@0: function testState(state, expected, callback) { michael@0: let win = openDialog(location, "_blank", "chrome,all,dialog=no"); michael@0: win.addEventListener("load", function() { michael@0: win.removeEventListener("load", arguments.callee, false); michael@0: michael@0: is(win.gURLBar.readOnly, false, michael@0: "URL bar should not be read-only before setting the state"); michael@0: is(win.gURLBar.getAttribute("enablehistory"), "true", michael@0: "URL bar autocomplete should be enabled before setting the state"); michael@0: ss.setWindowState(win, state, true); michael@0: is(win.gURLBar.readOnly, expected.readOnly, michael@0: "URL bar read-only state should be restored correctly"); michael@0: is(win.gURLBar.getAttribute("enablehistory"), expected.enablehistory, michael@0: "URL bar autocomplete state should be restored correctly"); michael@0: michael@0: win.close(); michael@0: executeSoon(callback); michael@0: }, false); michael@0: } michael@0: michael@0: testState(state1, {readOnly: false, enablehistory: "true"}, function() { michael@0: testState(state2, {readOnly: true, enablehistory: "false"}, finish); michael@0: }); michael@0: }); michael@0: }, false); michael@0: }); michael@0: }, false); michael@0: }