Bug 28112

Summary: localStorage.key() does not return null for indicies >= localStorage.length
Product: WebKit Reporter: Brett C. <brett>
Component: DOMAssignee: Jeremy Orlow <jorlow>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, jorlow
Priority: P2 Keywords: EasyFix
Version: 420+   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch v1 beidson: review+

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