dom/indexedDB/test/unit/test_odd_result_order.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 data = { key: 5, index: 10 };
    12   let request = indexedDB.open(this.window ? window.location.pathname : "Splendid Test", 1);
    13   request.onerror = errorHandler;
    14   request.onupgradeneeded = grabEventAndContinueHandler;
    15   let event = yield undefined;
    17   let db = event.target.result;
    19   ok(db instanceof IDBDatabase, "Got a real database");
    21   db.onerror = errorHandler;
    23   let objectStore = db.createObjectStore("foo", { keyPath: "key",
    24                                                   autoIncrement: true });
    25   let index = objectStore.createIndex("foo", "index");
    27   event.target.onsuccess = continueToNextStep;
    28   yield undefined;
    30   objectStore = db.transaction("foo", "readwrite")
    31                   .objectStore("foo");
    32   request = objectStore.add(data);
    33   request.onsuccess = grabEventAndContinueHandler;
    34   event = yield undefined;
    36   let key;
    37   executeSoon(function() {
    38     key = request.result;
    39     continueToNextStep();
    40   });
    41   yield undefined;
    43   is(key, data.key, "Got the right key");
    45   objectStore = db.transaction("foo").objectStore("foo");
    46   objectStore.get(data.key).onsuccess = grabEventAndContinueHandler;
    47   event = yield undefined;
    49   let obj;
    50   executeSoon(function() {
    51     obj = event.target.result;
    52     continueToNextStep();
    53   });
    54   yield undefined;
    56   is(obj.key, data.key, "Got the right key");
    57   is(obj.index, data.index, "Got the right property value");
    59   objectStore = db.transaction("foo", "readwrite")
    60                   .objectStore("foo");
    61   request = objectStore.delete(data.key);
    62   request.onsuccess = grabEventAndContinueHandler;
    63   event = yield undefined;
    65   key = undefined;
    66   executeSoon(function() {
    67     key = request.result;
    68     continueToNextStep();
    69   }, 0);
    70   yield undefined;
    72   ok(key === undefined, "Got the right value");
    74   finishTest();
    75   yield undefined;
    76 }

mercurial