From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- dom/indexedDB/test/unit/test_object_identity.js | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 dom/indexedDB/test/unit/test_object_identity.js (limited to 'dom/indexedDB/test/unit/test_object_identity.js') 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 0000000000..6b23fa5243 --- /dev/null +++ b/dom/indexedDB/test/unit/test_object_identity.js @@ -0,0 +1,49 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/* exported testGenerator */ +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(); +} -- cgit v1.2.3