browser/components/sessionstore/test/browser_345898.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     5 function test() {
     6   /** Test for Bug 345898 **/
     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   }
    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 }

mercurial