Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/idb-binary-key-detached.htm

Issue 2673603003: Upstream IndexedDB binary key tests to WPT. (Closed)
Patch Set: Addressed feedback. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/IndexedDB/idb-binary-key-roundtrip.htm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/idb-binary-key-detached.htm
diff --git a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/idb-binary-key-detached.htm b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/idb-binary-key-detached.htm
new file mode 100644
index 0000000000000000000000000000000000000000..ab672fa8bbe24a7493dd4ee5394c0c658ef8fb1c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/idb-binary-key-detached.htm
@@ -0,0 +1,51 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>IndexedDB: Detached buffers supplied as binary keys</title>
+<meta name="help" href="http://w3c.github.io/IndexedDB/#convert-a-value-to-a-key">
+<meta name="help" href="https://heycam.github.io/webidl/#dfn-get-buffer-source-copy">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="support.js"></script>
+<script>
+
+indexeddb_test(
+ (t, db) => { db.createObjectStore('store'); },
+ (t, db) => {
+ const tx = db.transaction('store', 'readwrite');
+ const store = tx.objectStore('store');
+
+ const buffer = new Uint8Array([1,2,3,4]).buffer;
+ assert_equals(buffer.byteLength, 4);
+
+ // Detach the ArrayBuffer by transferring it to a worker.
+ const worker = new Worker(URL.createObjectURL(new Blob([])));
+ worker.postMessage('', [buffer]);
+ assert_equals(buffer.byteLength, 0);
+
+ assert_throws(new TypeError, () => { store.put('', buffer); });
+ t.done();
+ },
+ 'Detached ArrayBuffer'
+);
+
+indexeddb_test(
+ (t, db) => { db.createObjectStore('store'); },
+ (t, db) => {
+ const tx = db.transaction('store', 'readwrite');
+ const store = tx.objectStore('store');
+
+ const array = new Uint8Array([1,2,3,4]);
+ assert_equals(array.length, 4);
+
+ // Detach the ArrayBuffer by transferring it to a worker.
+ const worker = new Worker(URL.createObjectURL(new Blob([])));
+ worker.postMessage('', [array.buffer]);
+ assert_equals(array.length, 0);
+
+ assert_throws(new TypeError, () => { store.put('', array); });
+ t.done();
+ },
+ 'Detached TypedArray'
+);
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/IndexedDB/idb-binary-key-roundtrip.htm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698