|
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 function test(aLambda) { |
|
9 try { |
|
10 aLambda(); |
|
11 return false; |
|
12 } |
|
13 catch (ex) { |
|
14 return ex.name == "NS_ERROR_ILLEGAL_VALUE"; |
|
15 } |
|
16 } |
|
17 |
|
18 // all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE |
|
19 ok(test(function() ss.getWindowState({})), |
|
20 "Invalid window for getWindowState throws"); |
|
21 ok(test(function() ss.setWindowState({}, "", false)), |
|
22 "Invalid window for setWindowState throws"); |
|
23 ok(test(function() ss.getTabState({})), |
|
24 "Invalid tab for getTabState throws"); |
|
25 ok(test(function() ss.setTabState({}, "{}")), |
|
26 "Invalid tab state for setTabState throws"); |
|
27 ok(test(function() ss.setTabState({}, JSON.stringify({ entries: [] }))), |
|
28 "Invalid tab for setTabState throws"); |
|
29 ok(test(function() ss.duplicateTab({}, {})), |
|
30 "Invalid tab for duplicateTab throws"); |
|
31 ok(test(function() ss.duplicateTab({}, gBrowser.selectedTab)), |
|
32 "Invalid window for duplicateTab throws"); |
|
33 ok(test(function() ss.getClosedTabData({})), |
|
34 "Invalid window for getClosedTabData throws"); |
|
35 ok(test(function() ss.undoCloseTab({}, 0)), |
|
36 "Invalid window for undoCloseTab throws"); |
|
37 ok(test(function() ss.undoCloseTab(window, -1)), |
|
38 "Invalid index for undoCloseTab throws"); |
|
39 ok(test(function() ss.getWindowValue({}, "")), |
|
40 "Invalid window for getWindowValue throws"); |
|
41 ok(test(function() ss.setWindowValue({}, "", "")), |
|
42 "Invalid window for setWindowValue throws"); |
|
43 } |