browser_495495.js (1397B)
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 add_task(async function test_urlbarFocus() { 6 /** Test for Bug 495495 */ 7 8 let newWin = openDialog( 9 location, 10 "_blank", 11 "chrome,all,dialog=no,toolbar=yes" 12 ); 13 await promiseWindowLoaded(newWin); 14 let state1 = ss.getWindowState(newWin); 15 await BrowserTestUtils.closeWindow(newWin); 16 17 newWin = openDialog( 18 location, 19 "_blank", 20 "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar=no,location,personal,directories,dialog=no" 21 ); 22 await promiseWindowLoaded(newWin); 23 let state2 = ss.getWindowState(newWin); 24 25 async function testState(state, expected) { 26 let win = openDialog(location, "_blank", "chrome,all,dialog=no"); 27 await promiseWindowLoaded(win); 28 29 is( 30 win.gURLBar.readOnly, 31 false, 32 "URL bar should not be read-only before setting the state" 33 ); 34 await setWindowState(win, state, true); 35 is( 36 win.gURLBar.readOnly, 37 expected.readOnly, 38 "URL bar read-only state should be restored correctly" 39 ); 40 41 await BrowserTestUtils.closeWindow(win); 42 } 43 44 await BrowserTestUtils.closeWindow(newWin); 45 await testState(state1, { readOnly: false }); 46 await testState(state2, { readOnly: true }); 47 });