WebKit Bugzilla
Attachment 340983 Details for
Bug 185869
: IndexedDB: breaks if binary data (Uint8Array) and autoIncrement key in store
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test case
ko-indexeddb-both.html (text/html), 1.65 KB, created by
Maxime Réty
on 2018-05-22 08:24:35 PDT
(
hide
)
Description:
Test case
Filename:
MIME Type:
Creator:
Maxime Réty
Created:
2018-05-22 08:24:35 PDT
Size:
1.65 KB
patch
obsolete
><!DOCTYPE html> ><meta charset="utf-8"> ><title>KO: add a record containing binary data in a store having an autoIncrement key.</title> > ><!-- Logging --> ><style type="text/css"> > textarea#log { > width: 100%; > height: 1000px; > } ></style> > ><h3>Log</h3> ><textarea id="log"></textarea> > ><script type="text/javascript"> > const log = (...args) => { > console.log(...args); > document.getElementById('log').value += args.join(' ') + "\n"; > }; ></script> > ><!-- Test script --> ><script type="text/javascript"> > let db; > > const record = { > // id: 1, <- automatically added due to autoIncrement > property: Uint8Array.from([42, 255]) > }; > > const open_rq = window.indexedDB.open("TestBinaryAndAutoIncrement", 1); > > open_rq.onupgradeneeded = function (e) { > db = e.target.result; > > const objStore = db.createObjectStore("store", { keyPath: "id", autoIncrement: true }); > const add_rq = objStore.add(record); > > add_rq.onerror = function (e) { > log("failed to add record (see console)"); > console.error(e); > } > > add_rq.onsuccess = function (e) { > log("added record"); > } > }; > > open_rq.onsuccess = function (e) { > if (!db) { > db = e.target.result; > } > > const rq = db.transaction("store") > .objectStore("store") > .get(1); > > rq.onsuccess = function (e) { > const result = e.target.result; > log("result.property instanceof Uint8Array:", result.property instanceof Uint8Array); > log("result.property.length === 2:", result.property.length === 2); > log("result.property[0] === 42:", result.property[0] === 42); > log("result.property[1] === 255:", result.property[1] === 255); > }; > }; ></script>
<!DOCTYPE html> <meta charset="utf-8"> <title>KO: add a record containing binary data in a store having an autoIncrement key.</title> <!-- Logging --> <style type="text/css"> textarea#log { width: 100%; height: 1000px; } </style> <h3>Log</h3> <textarea id="log"></textarea> <script type="text/javascript"> const log = (...args) => { console.log(...args); document.getElementById('log').value += args.join(' ') + "\n"; }; </script> <!-- Test script --> <script type="text/javascript"> let db; const record = { // id: 1, <- automatically added due to autoIncrement property: Uint8Array.from([42, 255]) }; const open_rq = window.indexedDB.open("TestBinaryAndAutoIncrement", 1); open_rq.onupgradeneeded = function (e) { db = e.target.result; const objStore = db.createObjectStore("store", { keyPath: "id", autoIncrement: true }); const add_rq = objStore.add(record); add_rq.onerror = function (e) { log("failed to add record (see console)"); console.error(e); } add_rq.onsuccess = function (e) { log("added record"); } }; open_rq.onsuccess = function (e) { if (!db) { db = e.target.result; } const rq = db.transaction("store") .objectStore("store") .get(1); rq.onsuccess = function (e) { const result = e.target.result; log("result.property instanceof Uint8Array:", result.property instanceof Uint8Array); log("result.property.length === 2:", result.property.length === 2); log("result.property[0] === 42:", result.property[0] === 42); log("result.property[1] === 255:", result.property[1] === 255); }; }; </script>
View Attachment As Raw
Actions:
View
Attachments on
bug 185869
: 340983 |
355704