diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 04:16:43 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 04:16:43 +0000 |
commit | 99ddfd29900cc4caa1f1ffd979cc09be3f104336 (patch) | |
tree | dd3987a5578e15a27340a43c32027099050cfb8d /webkit/api | |
parent | 9c5645b5f8af3c04528caef61c59e2754f79288b (diff) | |
download | chromium_src-99ddfd29900cc4caa1f1ffd979cc09be3f104336.zip chromium_src-99ddfd29900cc4caa1f1ffd979cc09be3f104336.tar.gz chromium_src-99ddfd29900cc4caa1f1ffd979cc09be3f104336.tar.bz2 |
The spec for ____storage.key() changed. Now, instead of raising an exception when you try to access a key
at an index that's greater than or equal to ___Storage.length, it simply returns a null.
This is yet another demonstration of why we need a NullableString16 (rather than passing around a string and
a bool) but this cannot block on that work.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/165289
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23011 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/api')
-rw-r--r-- | webkit/api/public/WebStorageArea.h | 7 | ||||
-rw-r--r-- | webkit/api/src/StorageAreaProxy.cpp | 7 | ||||
-rw-r--r-- | webkit/api/src/StorageAreaProxy.h | 2 | ||||
-rw-r--r-- | webkit/api/src/WebStorageAreaImpl.cpp | 12 | ||||
-rw-r--r-- | webkit/api/src/WebStorageAreaImpl.h | 2 |
5 files changed, 9 insertions, 21 deletions
diff --git a/webkit/api/public/WebStorageArea.h b/webkit/api/public/WebStorageArea.h index 6febe35..664b418 100644 --- a/webkit/api/public/WebStorageArea.h +++ b/webkit/api/public/WebStorageArea.h @@ -59,10 +59,9 @@ namespace WebKit { virtual unsigned length() = 0; // Get a value for a specific key. Valid key indices are 0 through length() - 1. - // Indexes may change on any set/removeItem call. KeyException is true if the - // index provided was out of range. When KeyException is true, the returned - // string is undefined. - virtual WebString key(unsigned index, bool& keyException) = 0; + // Indexes may change on any set/removeItem call. Will return null if the index + // provided is out of range. + virtual WebString key(unsigned index) = 0; // Get the value that corresponds to a specific key. This returns null if there is // no entry for that key. diff --git a/webkit/api/src/StorageAreaProxy.cpp b/webkit/api/src/StorageAreaProxy.cpp index 0709a2b..4e56372 100644 --- a/webkit/api/src/StorageAreaProxy.cpp +++ b/webkit/api/src/StorageAreaProxy.cpp @@ -51,12 +51,9 @@ unsigned StorageAreaProxy::length() const return m_storageArea->length(); } -String StorageAreaProxy::key(unsigned index, ExceptionCode& ec) const +String StorageAreaProxy::key(unsigned index) const { - bool keyException = false; - String value = m_storageArea->key(index, keyException); - ec = keyException ? INDEX_SIZE_ERR : 0; - return value; + return m_storageArea->key(index); } String StorageAreaProxy::getItem(const String& key) const diff --git a/webkit/api/src/StorageAreaProxy.h b/webkit/api/src/StorageAreaProxy.h index 6b6b565..172bd49 100644 --- a/webkit/api/src/StorageAreaProxy.h +++ b/webkit/api/src/StorageAreaProxy.h @@ -41,7 +41,7 @@ namespace WebCore { // The HTML5 DOM Storage API virtual unsigned length() const; - virtual String key(unsigned index, ExceptionCode& ec) const; + virtual String key(unsigned index) const; virtual String getItem(const String& key) const; virtual void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame); virtual void removeItem(const String& key, Frame* sourceFrame); diff --git a/webkit/api/src/WebStorageAreaImpl.cpp b/webkit/api/src/WebStorageAreaImpl.cpp index 6a5a762..13f79d2 100644 --- a/webkit/api/src/WebStorageAreaImpl.cpp +++ b/webkit/api/src/WebStorageAreaImpl.cpp @@ -65,17 +65,9 @@ unsigned WebStorageAreaImpl::length() return m_storageArea->length(); } -WebString WebStorageAreaImpl::key(unsigned index, bool& keyException) +WebString WebStorageAreaImpl::key(unsigned index) { - int exceptionCode = 0; - WebString value = m_storageArea->key(index, exceptionCode); - if (exceptionCode != 0) { - ASSERT(exceptionCode == WebCore::INDEX_SIZE_ERR); - keyException = true; - } else { - keyException = false; - } - return value; + return m_storageArea->key(index); } WebString WebStorageAreaImpl::getItem(const WebString& key) diff --git a/webkit/api/src/WebStorageAreaImpl.h b/webkit/api/src/WebStorageAreaImpl.h index 5e5ffc4..648ee3e 100644 --- a/webkit/api/src/WebStorageAreaImpl.h +++ b/webkit/api/src/WebStorageAreaImpl.h @@ -45,7 +45,7 @@ namespace WebKit { virtual void lock(bool& invalidateCache, size_t& bytesLeftInQuota); virtual void unlock(); virtual unsigned length(); - virtual WebString key(unsigned index, bool& keyException); + virtual WebString key(unsigned index); virtual WebString getItem(const WebString& key); virtual void setItem(const WebString& key, const WebString& value, bool& quotaException); virtual void removeItem(const WebString& key); |