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 345898 **/ michael@0: michael@0: function test(aLambda) { michael@0: try { michael@0: aLambda(); michael@0: return false; michael@0: } michael@0: catch (ex) { michael@0: return ex.name == "NS_ERROR_ILLEGAL_VALUE"; michael@0: } michael@0: } michael@0: michael@0: // all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE michael@0: ok(test(function() ss.getWindowState({})), michael@0: "Invalid window for getWindowState throws"); michael@0: ok(test(function() ss.setWindowState({}, "", false)), michael@0: "Invalid window for setWindowState throws"); michael@0: ok(test(function() ss.getTabState({})), michael@0: "Invalid tab for getTabState throws"); michael@0: ok(test(function() ss.setTabState({}, "{}")), michael@0: "Invalid tab state for setTabState throws"); michael@0: ok(test(function() ss.setTabState({}, JSON.stringify({ entries: [] }))), michael@0: "Invalid tab for setTabState throws"); michael@0: ok(test(function() ss.duplicateTab({}, {})), michael@0: "Invalid tab for duplicateTab throws"); michael@0: ok(test(function() ss.duplicateTab({}, gBrowser.selectedTab)), michael@0: "Invalid window for duplicateTab throws"); michael@0: ok(test(function() ss.getClosedTabData({})), michael@0: "Invalid window for getClosedTabData throws"); michael@0: ok(test(function() ss.undoCloseTab({}, 0)), michael@0: "Invalid window for undoCloseTab throws"); michael@0: ok(test(function() ss.undoCloseTab(window, -1)), michael@0: "Invalid index for undoCloseTab throws"); michael@0: ok(test(function() ss.getWindowValue({}, "")), michael@0: "Invalid window for getWindowValue throws"); michael@0: ok(test(function() ss.setWindowValue({}, "", "")), michael@0: "Invalid window for setWindowValue throws"); michael@0: }