browser_345898.js (2026B)
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 345898 */ 7 8 // all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE 9 Assert.throws( 10 () => ss.getWindowState({}), 11 /NS_ERROR_ILLEGAL_VALUE/, 12 "Invalid window for getWindowState throws" 13 ); 14 Assert.throws( 15 () => ss.setWindowState({}, "", false), 16 /NS_ERROR_ILLEGAL_VALUE/, 17 "Invalid window for setWindowState throws" 18 ); 19 Assert.throws( 20 () => ss.getTabState({}), 21 /NS_ERROR_ILLEGAL_VALUE/, 22 "Invalid tab for getTabState throws" 23 ); 24 Assert.throws( 25 () => ss.setTabState({}, "{}"), 26 /NS_ERROR_ILLEGAL_VALUE/, 27 "Invalid tab state for setTabState throws" 28 ); 29 Assert.throws( 30 () => ss.setTabState({}, JSON.stringify({ entries: [] })), 31 /NS_ERROR_ILLEGAL_VALUE/, 32 "Invalid tab for setTabState throws" 33 ); 34 Assert.throws( 35 () => ss.duplicateTab({}, {}), 36 /NS_ERROR_ILLEGAL_VALUE/, 37 "Invalid tab for duplicateTab throws" 38 ); 39 Assert.throws( 40 () => ss.duplicateTab({}, gBrowser.selectedTab), 41 /NS_ERROR_ILLEGAL_VALUE/, 42 "Invalid window for duplicateTab throws" 43 ); 44 Assert.throws( 45 () => ss.getClosedTabDataForWindow({}), 46 /NS_ERROR_ILLEGAL_VALUE/, 47 "Invalid window for getClosedTabData throws" 48 ); 49 Assert.throws( 50 () => ss.undoCloseTab({}, 0), 51 /NS_ERROR_ILLEGAL_VALUE/, 52 "Invalid window for undoCloseTab throws" 53 ); 54 Assert.throws( 55 () => ss.undoCloseTab(window, -1), 56 /NS_ERROR_ILLEGAL_VALUE/, 57 "Invalid index for undoCloseTab throws" 58 ); 59 Assert.throws( 60 () => ss.getCustomWindowValue({}, ""), 61 /NS_ERROR_ILLEGAL_VALUE/, 62 "Invalid window for getCustomWindowValue throws" 63 ); 64 Assert.throws( 65 () => ss.setCustomWindowValue({}, "", ""), 66 /NS_ERROR_ILLEGAL_VALUE/, 67 "Invalid window for setCustomWindowValue throws" 68 ); 69 }