summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/test/test_filehandle_iteration.html
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/test_filehandle_iteration.html
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/test_filehandle_iteration.html')
-rw-r--r--dom/indexedDB/test/test_filehandle_iteration.html77
1 files changed, 77 insertions, 0 deletions
diff --git a/dom/indexedDB/test/test_filehandle_iteration.html b/dom/indexedDB/test/test_filehandle_iteration.html
new file mode 100644
index 000000000..ebbc8b8be
--- /dev/null
+++ b/dom/indexedDB/test/test_filehandle_iteration.html
@@ -0,0 +1,77 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+ <title>Indexed Database Property Test</title>
+
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+
+ <script type="text/javascript;version=1.7">
+ function testSteps()
+ {
+ const dbName = window.location.pathname;
+ const dbVersion = 1;
+ const objectStoreName = "foo";
+ const entryCount = 10;
+
+ let request = indexedDB.open(dbName, dbVersion);
+ request.onerror = errorHandler;
+ request.onupgradeneeded = grabEventAndContinueHandler;
+ request.onsuccess = unexpectedSuccessHandler;
+ let event = yield undefined;
+
+ is(event.type, "upgradeneeded", "Got correct event type");
+
+ let db = event.target.result;
+ db.onerror = errorHandler;
+
+ db.createObjectStore(objectStoreName, { autoIncrement: true });
+
+ request.onupgradeneeded = unexpectedSuccessHandler;
+ request.onsuccess = grabEventAndContinueHandler;
+ event = yield undefined;
+
+ is(event.type, "success", "Got correct event type");
+
+ request = db.createMutableFile("bar");
+ request.onsuccess = grabEventAndContinueHandler;
+ event = yield undefined;
+
+ let mutableFile = event.target.result;
+
+ let trans = db.transaction(objectStoreName, "readwrite");
+ let objectStore = trans.objectStore(objectStoreName);
+
+ for (let i = 0; i < entryCount; i++) {
+ request = objectStore.add(mutableFile);
+ }
+
+ let seenEntryCount = 0;
+
+ request = objectStore.openCursor().onsuccess = event => {
+ let cursor = event.target.result;
+ if (cursor) {
+ seenEntryCount++;
+ cursor.continue();
+ } else {
+ continueToNextStep();
+ }
+ }
+ yield undefined;
+
+ is(seenEntryCount, entryCount, "Correct entry count");
+
+ finishTest();
+ yield undefined;
+ }
+ </script>
+ <script type="text/javascript;version=1.7" src="helpers.js"></script>
+
+</head>
+
+<body onload="runTest();"></body>
+
+</html>