Closed Bug 1395071 Opened 5 years ago Closed 5 years ago

IndexedDB2.0: IDBObjectStore.get() and delete() fails if argument is a binary key


(Core :: Storage: IndexedDB, defect)

55 Branch
Not set



Tracking Status
firefox-esr52 --- affected
firefox55 --- wontfix
firefox56 --- wontfix
firefox57 --- fixed


(Reporter: david.fahlander, Assigned: bevis)



(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36 OPR/47.0.2631.71

Steps to reproduce:

Call IDBObjectStore.get() or IDBObjectStore.delete() using a typed array or an array buffer. It throws directly.

A repro is here:

Actual results:

The methods throws DataError even though binary keys should be allowed also for primary keys.

Expected results:

I should have been able to get() or delete() an object by its binary primary key.
Component: Untriaged → DOM: IndexedDB
Product: Firefox → Core
Bevis, you did work to support this in bug 1271500. Maybe you know what's up here?
Flags: needinfo?(btseng)
I'll look into it. keep the NI on me.
Assignee: nobody → btseng
Thanks for reporting this, David.

After further review, I found that there is another place(IDBKeyRange::FromJSVal) to check the type of the passed JS value that wasn't identified when fixing bug 1271500:

I'll update a fix to unify the type checking in single place(Key::EncodeJSValInternal):
Flags: needinfo?(btseng)
I'm happy to help. Thanks for jumping into it so quickly!
Comment on attachment 8903505 [details] [diff] [review]
(v1) Patch: Unify the key validation using Key::EncodeJSValInternal.

Review of attachment 8903505 [details] [diff] [review]:

::: dom/indexedDB/IDBKeyRange.cpp
@@ +95,3 @@
> +  // Unwrap an IDBKeyRange object if possible.
> +  if (aVal.isObject() &&

if (obj && ...
Attachment #8903505 - Flags: review?(amarchesini) → review+
Pushed by
Unify the key validation using Key::EncodeJSValInternal. r=baku
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Too late for 56. Mass won't fix for 56.
You need to log in before you can comment on or make changes to this bug.