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 /chrome/renderer | |
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 'chrome/renderer')
-rw-r--r-- | chrome/renderer/renderer_webstoragearea_impl.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/renderer_webstoragearea_impl.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/chrome/renderer/renderer_webstoragearea_impl.cc b/chrome/renderer/renderer_webstoragearea_impl.cc index c438cdfe..14f2273 100644 --- a/chrome/renderer/renderer_webstoragearea_impl.cc +++ b/chrome/renderer/renderer_webstoragearea_impl.cc @@ -45,18 +45,18 @@ unsigned RendererWebStorageAreaImpl::length() { return length; } -WebKit::WebString RendererWebStorageAreaImpl::key(unsigned index, - bool& key_exception) { +WebKit::WebString RendererWebStorageAreaImpl::key(unsigned index) { EnsureInitializedAndLocked(); // Right now this is always sync. We may want to optimize this by fetching // chunks of keys rather than single keys (and flushing the cache on every // mutation of the storage area) since this will most often be used to fetch // all the keys at once. string16 key; + bool key_is_null; RenderThread::current()->Send( new ViewHostMsg_DOMStorageKey(storage_area_id_, index, - &key_exception, &key)); - return key; + &key, &key_is_null)); + return key_is_null ? WebKit::WebString() : WebKit::WebString(key); } WebKit::WebString RendererWebStorageAreaImpl::getItem( diff --git a/chrome/renderer/renderer_webstoragearea_impl.h b/chrome/renderer/renderer_webstoragearea_impl.h index 0a313c2..0b734e8 100644 --- a/chrome/renderer/renderer_webstoragearea_impl.h +++ b/chrome/renderer/renderer_webstoragearea_impl.h @@ -21,7 +21,7 @@ class RendererWebStorageAreaImpl : public WebKit::WebStorageArea { virtual void lock(bool& invalidate_cache, size_t& bytes_left_in_quota); virtual void unlock(); virtual unsigned length(); - virtual WebKit::WebString key(unsigned index, bool& key_exception); + virtual WebKit::WebString key(unsigned index); virtual WebKit::WebString getItem(const WebKit::WebString& key); virtual void setItem(const WebKit::WebString& key, const WebKit::WebString& value, |