browser/components/sessionstore/test/browser_694378.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/sessionstore/test/browser_694378.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// Test Summary:
     1.8 +// 1.  call ss.setWindowState with a broken state
     1.9 +// 1a. ensure that it doesn't throw.
    1.10 +
    1.11 +function test() {
    1.12 +  waitForExplicitFinish();
    1.13 +
    1.14 +  let brokenState = {
    1.15 +    windows: [
    1.16 +      { tabs: [{ entries: [{ url: "about:mozilla" }] }] }
    1.17 +    ],
    1.18 +    selectedWindow: 2
    1.19 +  };
    1.20 +  let brokenStateString = JSON.stringify(brokenState);
    1.21 +
    1.22 +  let gotError = false;
    1.23 +  try {
    1.24 +    ss.setWindowState(window, brokenStateString, true);
    1.25 +  }
    1.26 +  catch (ex) {
    1.27 +    gotError = true;
    1.28 +    info(ex);
    1.29 +  }
    1.30 +
    1.31 +  ok(!gotError, "ss.setWindowState did not throw an error");
    1.32 +
    1.33 +  // Make sure that we reset the state. Use a full state just in case things get crazy.
    1.34 +  let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
    1.35 +  waitForBrowserState(blankState, finish);
    1.36 +}

mercurial