dom/indexedDB/test/unit/test_setVersion.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   let request = indexedDB.open(name, 1);
    13   request.onerror = errorHandler;
    14   request.onsuccess = grabEventAndContinueHandler;
    15   let event = yield undefined;
    17   let db = event.target.result;
    19   // Check default state.
    20   is(db.version, 1, "Correct default version for a new database.");
    22   const versions = [
    23     7,
    24     42,
    25   ];
    27   db.close();
    29   for (let i = 0; i < versions.length; i++) {
    30     let version = versions[i];
    32     let request = indexedDB.open(name, version);
    33     request.onerror = errorHandler;
    34     request.onupgradeneeded = grabEventAndContinueHandler;
    35     let event = yield undefined;
    37     let db = event.target.result;
    39     is(db.version, version, "Database version number updated correctly");
    40     is(event.target.transaction.mode, "versionchange", "Correct mode");
    42     executeSoon(function() { testGenerator.next(); });
    43     yield undefined;
    44     db.close();
    45   }
    47   finishTest();
    48   yield undefined;
    49 }

mercurial