WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
192987
IndexedDB: cursor.update breaks cursor.continue functionality for indexes
https://bugs.webkit.org/show_bug.cgi?id=192987
Summary
IndexedDB: cursor.update breaks cursor.continue functionality for indexes
jdscheff
Reported
2018-12-21 10:55:01 PST
I'm mostly copying this bug report from
https://stackoverflow.com/questions/53840474/indexeddb-cursor-does-not-get-next-record-after-update-on-ios
I ran this code in Firefox 64, Chrome 71, and Safari 11.1: var errorHandler = function(event) { console.error(event.target.error); }; console.log("Deleting database..."); var deleteRequest = indexedDB.deleteDatabase("myDatabase"); deleteRequest.onerror = deleteRequest.onblocked = deleteRequest.onsuccess = function() { console.log("Opening database..."); var openRequest = indexedDB.open("myDatabase", 1); openRequest.onupgradeneeded = function(event) { var objStore = event.target.result.createObjectStore("customers", { keyPath: "ID", autoIncrement: true }); objStore.createIndex("fName", "fName", { unique: false }); objStore.add({ fName: "James", lName: "Smith", reviewStatus: "pending" }); objStore.add({ fName: "Tim", lName: "Jones", reviewStatus: "pending" }); objStore.add({ fName: "James", lName: "Miller", reviewStatus: "pending" }); }; openRequest.onsuccess = function(event) { var db = event.target.result; var tx = db.transaction("customers", "readwrite"); var objStore = tx.objectStore("customers"); var index = objStore.index("fName"); var cursorRequest = index.openCursor(IDBKeyRange.only("James")); cursorRequest.onsuccess = function(event2) { var cursor = event2.target.result; if (cursor) { var record = cursor.value; record.reviewStatus = "reviewed"; console.log("Updating record..."); cursor.update(record); cursor.continue(); } }; cursorRequest.onerror = errorHandler; tx.oncomplete = function() { console.log("Done!"); }; tx.onerror = errorHandler; }; openRequest.onerror = errorHandler; }; In Firefox and Chrome, I get this output: Deleting database... Opening database... Updating record... Updating record... Done! But in Safari I get this output: Deleting database... Opening database... Updating record... Done! Based on my understanding of the IndexedDB spec, Safari is the one in the wrong here. Updating an object should not affect cursor.continue, especially since the update does not affect the indexed property. Commenting out `cursor.update(record);` results in Safari producing the same output as Firefox and Chrome.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2022-02-01 11:20:31 PST
<
rdar://problem/88339095
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug