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

RESOLVED FIXED in Firefox 57

Status

()

defect
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: david.fahlander, Assigned: bevis)

Tracking

55 Branch
mozilla57
Points:
---

Firefox Tracking Flags

(firefox-esr52 affected, firefox55 wontfix, firefox56 wontfix, firefox57 fixed)

Details

Attachments

(1 attachment)

Reporter

Description

2 years ago
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: http://dexie.org/test/firefox-bug-binary-keys/



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:
http://searchfox.org/mozilla-central/rev/51b3d67a5ec1758bd2fe7d7b6e75ad6b6b5da223/dom/indexedDB/IDBKeyRange.cpp#101

I'll update a fix to unify the type checking in single place(Key::EncodeJSValInternal):
http://searchfox.org/mozilla-central/rev/51b3d67a5ec1758bd2fe7d7b6e75ad6b6b5da223/dom/indexedDB/Key.cpp#213
Flags: needinfo?(btseng)
Reporter

Comment 4

2 years ago
I'm happy to help. Thanks for jumping into it so quickly!
/David
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+

Comment 7

2 years ago
Pushed by btseng@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/90691dd0694f
Unify the key validation using Key::EncodeJSValInternal. r=baku
https://hg.mozilla.org/mozilla-central/rev/90691dd0694f
Status: UNCONFIRMED → RESOLVED
Closed: 2 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.