Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | function test() { |
michael@0 | 6 | /** Test for Bug 345898 **/ |
michael@0 | 7 | |
michael@0 | 8 | function test(aLambda) { |
michael@0 | 9 | try { |
michael@0 | 10 | aLambda(); |
michael@0 | 11 | return false; |
michael@0 | 12 | } |
michael@0 | 13 | catch (ex) { |
michael@0 | 14 | return ex.name == "NS_ERROR_ILLEGAL_VALUE"; |
michael@0 | 15 | } |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | // all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE |
michael@0 | 19 | ok(test(function() ss.getWindowState({})), |
michael@0 | 20 | "Invalid window for getWindowState throws"); |
michael@0 | 21 | ok(test(function() ss.setWindowState({}, "", false)), |
michael@0 | 22 | "Invalid window for setWindowState throws"); |
michael@0 | 23 | ok(test(function() ss.getTabState({})), |
michael@0 | 24 | "Invalid tab for getTabState throws"); |
michael@0 | 25 | ok(test(function() ss.setTabState({}, "{}")), |
michael@0 | 26 | "Invalid tab state for setTabState throws"); |
michael@0 | 27 | ok(test(function() ss.setTabState({}, JSON.stringify({ entries: [] }))), |
michael@0 | 28 | "Invalid tab for setTabState throws"); |
michael@0 | 29 | ok(test(function() ss.duplicateTab({}, {})), |
michael@0 | 30 | "Invalid tab for duplicateTab throws"); |
michael@0 | 31 | ok(test(function() ss.duplicateTab({}, gBrowser.selectedTab)), |
michael@0 | 32 | "Invalid window for duplicateTab throws"); |
michael@0 | 33 | ok(test(function() ss.getClosedTabData({})), |
michael@0 | 34 | "Invalid window for getClosedTabData throws"); |
michael@0 | 35 | ok(test(function() ss.undoCloseTab({}, 0)), |
michael@0 | 36 | "Invalid window for undoCloseTab throws"); |
michael@0 | 37 | ok(test(function() ss.undoCloseTab(window, -1)), |
michael@0 | 38 | "Invalid index for undoCloseTab throws"); |
michael@0 | 39 | ok(test(function() ss.getWindowValue({}, "")), |
michael@0 | 40 | "Invalid window for getWindowValue throws"); |
michael@0 | 41 | ok(test(function() ss.setWindowValue({}, "", "")), |
michael@0 | 42 | "Invalid window for setWindowValue throws"); |
michael@0 | 43 | } |