Bug 62286

Summary: IndexedDB add() should fail if key is NaN
Product: WebKit Reporter: Mark Pilgrim (Google) <pilgrim>
Component: New BugsAssignee: Joshua Bell <jsbell>
Status: RESOLVED FIXED    
Severity: Normal CC: dgrogan, hans, jsbell, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case
none
Patch
none
Patch none

Mark Pilgrim (Google)
Reported 2011-06-08 08:55:35 PDT
Created attachment 96428 [details] test case http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#key-construct states "Additionally, if the value is of type float, it is only a valid key if it is not NaN." This test attempts to add a record to an objectstore with NaN as the key. Expected behavior: throw TYPE_MISMATCH_ERR Actual behavior: no exception thrown, record added Test case attached.
Attachments
test case (1.83 KB, text/html)
2011-06-08 08:55 PDT, Mark Pilgrim (Google)
no flags
Patch (7.54 KB, patch)
2011-10-03 14:51 PDT, Joshua Bell
no flags
Patch (7.62 KB, patch)
2011-10-03 15:39 PDT, Joshua Bell
no flags
Joshua Bell
Comment 1 2011-10-03 14:51:31 PDT
Joshua Bell
Comment 2 2011-10-03 14:54:03 PDT
NOTE: The layout tests for this and https://bugs.webkit.org/show_bug.cgi?id=62293 will conflict; that issue's expected.txt will need updating after this lands.
David Grogan
Comment 3 2011-10-03 15:27:28 PDT
LGTM Being paranoid, could you (just locally) switch the stored value from [] to a string or int and ensure that the exception thrown is still type_mismatch? Unless you've already done something like that to convince yourself that the type_mismatch_err isn't thrown b/c of the value.
Joshua Bell
Comment 4 2011-10-03 15:39:48 PDT
Joshua Bell
Comment 5 2011-10-03 15:41:38 PDT
(In reply to comment #3) > Being paranoid, could you (just locally) switch the stored value from [] to a string or int and ensure that the exception thrown is still type_mismatch? Unless you've already done something like that to convince yourself that the type_mismatch_err isn't thrown b/c of the value. Yeah... the use of [] for a dummy value came from another test file. I changed it in the latest patch to the string 'value' which is more obvious. Also, changed the test from add() (which would throw on collision) to put(). Shouldn't matter, but removes one more plausible bit of confusion.
Joshua Bell
Comment 6 2011-10-03 17:21:02 PDT
Comment on attachment 109541 [details] Patch Tony, can you review?
WebKit Review Bot
Comment 7 2011-10-04 12:34:30 PDT
Comment on attachment 109541 [details] Patch Clearing flags on attachment: 109541 Committed r96631: <http://trac.webkit.org/changeset/96631>
WebKit Review Bot
Comment 8 2011-10-04 12:34:34 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.