Bug 62300 - IndexedDB test: key sort order for Date objects
Summary: IndexedDB test: key sort order for Date objects
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-08 11:24 PDT by Mark Pilgrim (Google)
Modified: 2011-06-08 15:08 PDT (History)
4 users (show)

See Also:


Attachments
Patch (6.03 KB, patch)
2011-06-08 11:25 PDT, Mark Pilgrim (Google)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.