Bug 62300

Summary: IndexedDB test: key sort order for Date objects
Product: WebKit Reporter: Mark Pilgrim (Google) <pilgrim>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: dgrogan, hans, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Mark Pilgrim (Google) 2011-06-08 11:24:50 PDT
http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#key-construct states "Values of type Date are compared to other Date values chronologically." This test creates an objectstore and fills it with Date keys in non-chronological order, then opens and iterates a cursor to verify that the keys appear in chronological order.

WebKit passes this test.
Comment 1 Mark Pilgrim (Google) 2011-06-08 11:25:52 PDT
Created attachment 96443 [details]
Patch
Comment 2 David Grogan 2011-06-08 12:56:24 PDT
Comment on attachment 96443 [details]
Patch

LGTM
Comment 3 David Grogan 2011-06-08 13:31:11 PDT
Comment on attachment 96443 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=96443&action=review

LGTM

> LayoutTests/storage/indexeddb/key-sort-order-date.html:89
> +            shouldBe("cursor.key.toString()", "sortedKeys[keyIndex]");

So the problem with dates is that shouldBe will try to compare Date objects using == ?  If so you might be able to use shouldEvaluateTo:
shouldEvaluateTo("cursor.key", sortedKeys[keyIndex])

if sortedKeys[keyIndex] holds a date.toString(), the == might call the Date object's toString method before comparing.

It's no big deal, the test is fine as is.  Only do this if you want to play around with javascript.
Comment 4 Tony Chang 2011-06-08 14:16:06 PDT
Comment on attachment 96443 [details]
Patch

Mark, if you want to land this patch as-is, please set cq?.  Otherwise, just upload a new patch.
Comment 5 WebKit Review Bot 2011-06-08 15:08:08 PDT
Comment on attachment 96443 [details]
Patch

Clearing flags on attachment: 96443

Committed r88395: <http://trac.webkit.org/changeset/88395>
Comment 6 WebKit Review Bot 2011-06-08 15:08:12 PDT
All reviewed patches have been landed.  Closing bug.