diff options
Diffstat (limited to 'WebKit/chromium/src/StorageAreaProxy.cpp')
-rw-r--r-- | WebKit/chromium/src/StorageAreaProxy.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/WebKit/chromium/src/StorageAreaProxy.cpp b/WebKit/chromium/src/StorageAreaProxy.cpp index c9185fe..5311b65 100644 --- a/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/WebKit/chromium/src/StorageAreaProxy.cpp @@ -40,6 +40,7 @@ #include "StorageAreaImpl.h" #include "StorageEvent.h" +#include "WebFrameImpl.h" #include "WebStorageArea.h" #include "WebString.h" #include "WebURL.h" @@ -73,12 +74,13 @@ String StorageAreaProxy::getItem(const String& key) const String StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { - bool quotaException = false; + WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; WebKit::WebString oldValue; - m_storageArea->setItem(key, value, frame->document()->url(), quotaException, oldValue); - ec = quotaException ? QUOTA_EXCEEDED_ERR : 0; + WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); + m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue, webFrame); + ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR; String oldValueString = oldValue; - if (oldValueString != value) + if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK) storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame); return oldValue; } @@ -123,8 +125,12 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c frames.append(frame); } - for (unsigned i = 0; i < frames.size(); ++i) - frames[i]->document()->enqueueStorageEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage())); + for (unsigned i = 0; i < frames.size(); ++i) { + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->sessionStorage(ec); + if (!ec) + frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); + } } else { // Send events to every page. const HashSet<Page*>& pages = page->group().pages(); @@ -136,8 +142,12 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c } } - for (unsigned i = 0; i < frames.size(); ++i) - frames[i]->document()->enqueueStorageEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->localStorage())); + for (unsigned i = 0; i < frames.size(); ++i) { + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->localStorage(ec); + if (!ec) + frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); + } } } |