dom/indexedDB/test/unit/test_open_objectStore.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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";
    11   const objectStoreName = "Objects";
    13   let request = indexedDB.open(name, 1);
    14   request.onerror = errorHandler;
    15   request.onupgradeneeded = grabEventAndContinueHandler;
    16   request.onsuccess = grabEventAndContinueHandler;
    17   let event = yield undefined;
    19   let db = event.target.result;
    20   is(db.objectStoreNames.length, 0, "Bad objectStores list");
    22   let objectStore = db.createObjectStore(objectStoreName,
    23                                          { keyPath: "foo" });
    25   is(db.objectStoreNames.length, 1, "Bad objectStores list");
    26   is(db.objectStoreNames.item(0), objectStoreName, "Bad name");
    28   yield undefined;
    30   objectStore = db.transaction(objectStoreName).objectStore(objectStoreName);
    32   is(objectStore.name, objectStoreName, "Bad name");
    33   is(objectStore.keyPath, "foo", "Bad keyPath");
    34   if(objectStore.indexNames.length, 0, "Bad indexNames");
    36   finishTest();
    37   yield undefined;
    38 }

mercurial