dom/indexedDB/test/unit/test_invalid_version.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /**
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     6 var testGenerator = testSteps();
     8 function testSteps()
     9 {
    10   const name = this.window ? window.location.pathname : "Splendid Test";
    12   try {
    13     indexedDB.open(name, 0);
    14     ok(false, "Should have thrown!");
    15   }
    16   catch (e) {
    17     ok(e instanceof TypeError, "Got TypeError.");
    18     is(e.name, "TypeError", "Good error name.");
    19   }
    21   try {
    22     indexedDB.open(name, -1);
    23     ok(false, "Should have thrown!");
    24   }
    25   catch (e) {
    26     ok(e instanceof TypeError, "Got TypeError.");
    27     is(e.name, "TypeError", "Good error name.");
    28   }
    30   try {
    31     indexedDB.open(name, { version: 0 });
    32     ok(false, "Should have thrown!");
    33   }
    34   catch (e) {
    35     ok(e instanceof TypeError, "Got TypeError.");
    36     is(e.name, "TypeError", "Good error name.");
    37   }
    39   try {
    40     indexedDB.open(name, { version: -1 });
    41     ok(false, "Should have thrown!");
    42   }
    43   catch (e) {
    44     ok(e instanceof TypeError, "Got TypeError.");
    45     is(e.name, "TypeError", "Good error name.");
    46   }
    48   finishTest();
    49   yield undefined;
    50 }

mercurial