dom/indexedDB/test/unit/GlobalObjectsComponent.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 const Cu = Components.utils;
     8 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
     9 Cu.importGlobalProperties(["indexedDB"]);
    11 function GlobalObjectsComponent() {
    12   this.wrappedJSObject = this;
    13 }
    15 GlobalObjectsComponent.prototype =
    16 {
    17   classID: Components.ID("{949ebf50-e0da-44b9-8335-cbfd4febfdcc}"),
    19   QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),
    21   runTest: function() {
    22     const name = "Splendid Test";
    24     let ok = this.ok;
    25     let finishTest = this.finishTest;
    27     let keyRange = IDBKeyRange.only(42);
    28     ok(keyRange, "Got keyRange");
    30     let request = indexedDB.open(name, 1);
    31     request.onerror = function(event) {
    32       ok(false, "indexedDB error, '" + event.target.error.name + "'");
    33       finishTest();
    34     }
    35     request.onsuccess = function(event) {
    36       let db = event.target.result;
    37       ok(db, "Got database");
    38       finishTest();
    39     }
    40   }
    41 };
    43 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([GlobalObjectsComponent]);

mercurial