summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB/idbcursor-source.htm
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 /testing/web-platform/tests/IndexedDB/idbcursor-source.htm
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 'testing/web-platform/tests/IndexedDB/idbcursor-source.htm')
-rw-r--r--testing/web-platform/tests/IndexedDB/idbcursor-source.htm68
1 files changed, 68 insertions, 0 deletions
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-source.htm b/testing/web-platform/tests/IndexedDB/idbcursor-source.htm
new file mode 100644
index 000000000..7e3746ae7
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbcursor-source.htm
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<title>IDBCursor.source</title>
+<link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="support.js"></script>
+
+<script>
+ setup({ explicit_done: true });
+
+ var db;
+ var open_rq = indexedDB.open('testdb-' + new Date().getTime());
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ var objStore = db.createObjectStore("my_objectstore");
+ objStore.createIndex("my_index", "");
+
+ objStore.add("data", 1);
+ objStore.add("data2", 2);
+ };
+
+ function cursor_source(name, stringified_object, cursor_rq) {
+ var cursor;
+
+ cursor_rq.onsuccess = this.step_func(function(e) {
+ if (!e.target.result) {
+ return;
+ }
+ cursor = e.target.result;
+ assert_readonly(cursor, 'source');
+
+ // Direct try
+ assert_true(cursor.source instanceof Object, "source isobject");
+ assert_equals(cursor.source + "", stringified_object, "source");
+ assert_equals(cursor.source.name, name, "name");
+
+ cursor.continue();
+ });
+
+ cursor_rq.transaction.oncomplete = this.step_func(function(e) {
+ this.done();
+ });
+
+ cursor_rq.transaction.onerror = this.step_func(function(e) {
+ assert_unreached("Transaction got error. " + (e.target.error ? e.target.error.name : "unknown"));
+ });
+ }
+
+ open_rq.onsuccess = function() {
+ async_test(document.title + ' - IDBObjectStore').step(function() {
+ cursor_source.call(this, "my_objectstore", "[object IDBObjectStore]", db.transaction("my_objectstore")
+ .objectStore("my_objectstore")
+ .openCursor());
+ });
+
+ async_test(document.title + ' - IDBIndex').step(function() {
+ cursor_source.call(this, "my_index", "[object IDBIndex]", db.transaction("my_objectstore")
+ .objectStore("my_objectstore")
+ .index("my_index")
+ .openCursor());
+ });
+
+ done();
+ };
+
+</script>
+
+<div id="log"></div>