summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/test/unit/test_object_identity.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/indexedDB/test/unit/test_object_identity.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/indexedDB/test/unit/test_object_identity.js')
-rw-r--r--dom/indexedDB/test/unit/test_object_identity.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/dom/indexedDB/test/unit/test_object_identity.js b/dom/indexedDB/test/unit/test_object_identity.js
new file mode 100644
index 000000000..fa7b91339
--- /dev/null
+++ b/dom/indexedDB/test/unit/test_object_identity.js
@@ -0,0 +1,48 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+var testGenerator = testSteps();
+
+function testSteps()
+{
+ let request = indexedDB.open(this.window ? window.location.pathname : "Splendid Test", 1);
+ request.onerror = errorHandler;
+ request.onupgradeneeded = grabEventAndContinueHandler;
+ let event = yield undefined;
+
+ let db = event.target.result;
+ let transaction = event.target.transaction;
+
+ let objectStore1 = db.createObjectStore("foo");
+ let objectStore2 = transaction.objectStore("foo");
+ ok(objectStore1 === objectStore2, "Got same objectStores");
+
+ let index1 = objectStore1.createIndex("bar", "key");
+ let index2 = objectStore2.index("bar");
+ ok(index1 === index2, "Got same indexes");
+
+ request.onsuccess = continueToNextStep;
+ yield undefined;
+
+ transaction = db.transaction(db.objectStoreNames);
+
+ let objectStore3 = transaction.objectStore("foo");
+ let objectStore4 = transaction.objectStore("foo");
+ ok(objectStore3 === objectStore4, "Got same objectStores");
+
+ ok(objectStore3 !== objectStore1, "Different objectStores");
+ ok(objectStore4 !== objectStore2, "Different objectStores");
+
+ let index3 = objectStore3.index("bar");
+ let index4 = objectStore4.index("bar");
+ ok(index3 === index4, "Got same indexes");
+
+ ok(index3 !== index1, "Different indexes");
+ ok(index4 !== index2, "Different indexes");
+
+ finishTest();
+ yield undefined;
+}
+