Bug 28112 - localStorage.key() does not return null for indicies >= localStorage.length
Summary: localStorage.key() does not return null for indicies >= localStorage.length
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: All All
: P2 Normal
Assignee: Jeremy Orlow
URL:
Keywords: EasyFix
Depends on:
Blocks:
 
Reported: 2009-08-08 13:03 PDT by Brett C.
Modified: 2009-08-10 21:03 PDT (History)
2 users (show)

See Also:


Attachments
Patch v1 (10.89 KB, patch)
2009-08-10 14:43 PDT, Jeremy Orlow
beidson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brett C. 2009-08-08 13:03:51 PDT
The W3C Web Storage spec says that for localStorage.key() (http://dev.w3.org/html5/webstorage/#dom-storage-key) null should be returned when the value passed in is equal to or greater than what localStorage.length returns (and the same obviously goes for sessionStorage). But if you do ``localStorage.key(localStorage.length)`` in Safari 4.0.2, instead of getting null you get ``Error: INDEX_SIZE_ERR: DOM Exception 1``.
Comment 1 Jeremy Orlow 2009-08-10 14:43:15 PDT
Created attachment 34517 [details]
Patch v1
Comment 2 Jeremy Orlow 2009-08-10 21:03:14 PDT
Sending        LayoutTests/ChangeLog
Sending        LayoutTests/storage/domstorage/localstorage/simple-usage-expected.txt
Sending        LayoutTests/storage/domstorage/localstorage/simple-usage.html
Sending        LayoutTests/storage/domstorage/sessionstorage/simple-usage-expected.txt
Sending        LayoutTests/storage/domstorage/sessionstorage/simple-usage.html
Sending        WebCore/ChangeLog
Sending        WebCore/bindings/js/JSStorageCustom.cpp
Sending        WebCore/bindings/v8/custom/V8StorageCustom.cpp
Sending        WebCore/storage/Storage.cpp
Sending        WebCore/storage/Storage.h
Sending        WebCore/storage/Storage.idl
Sending        WebCore/storage/StorageArea.h
Sending        WebCore/storage/StorageAreaImpl.cpp
Sending        WebCore/storage/StorageAreaImpl.h
Sending        WebCore/storage/StorageMap.cpp
Sending        WebCore/storage/StorageMap.h
Transmitting file data ................
Committed revision 47020.
http://trac.webkit.org/changeset/47020