void StorageAreaImpl::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { ASSERT(!m_isShutdown); ASSERT(!value.isNull()); blockUntilImportComplete(); if (disabledByPrivateBrowsingInFrame(frame)) { ec = QUOTA_EXCEEDED_ERR; return; } String oldValue; bool quotaException; RefPtr<StorageMap> newMap = m_storageMap->setItem(key, value, oldValue, quotaException); if (newMap) m_storageMap = newMap.release(); if (quotaException) { ec = QUOTA_EXCEEDED_ERR; return; } if (oldValue == value) return; if (m_storageAreaSync) m_storageAreaSync->scheduleItemForSync(key, value); StorageEventDispatcher::dispatch(key, oldValue, value, m_storageType, m_securityOrigin.get(), frame); }
void StorageAreaImpl::removeItem(const String& key, ExceptionCode& ec, Frame* frame) { ec = 0; if (!canAccessStorage(frame)) { ec = SECURITY_ERR; return; } ASSERT(!m_isShutdown); blockUntilImportComplete(); if (disabledByPrivateBrowsingInFrame(frame)) return; String oldValue; RefPtr<StorageMap> newMap = m_storageMap->removeItem(key, oldValue); if (newMap) m_storageMap = newMap.release(); if (oldValue.isNull()) return; if (m_storageAreaSync) m_storageAreaSync->scheduleItemForSync(key, String()); StorageEventDispatcher::dispatch(key, oldValue, String(), m_storageType, m_securityOrigin.get(), frame); }
void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame) { ec = 0; if (!canAccessStorage(sourceFrame)) { ec = SECURITY_ERR; return; } ASSERT(!value.isNull()); if (disabledByPrivateBrowsingInFrame(sourceFrame)) { ec = QUOTA_EXCEEDED_ERR; return; } loadValuesIfNeeded(); ASSERT(m_storageMap->hasOneRef()); String oldValue; bool quotaException; m_storageMap->setItem(key, value, oldValue, quotaException); if (quotaException) { ec = QUOTA_EXCEEDED_ERR; return; } if (oldValue == value) return; m_pendingValueChanges.add(key); WebProcess::shared().connection()->send(Messages::StorageManager::SetItem(m_storageAreaID, key, value, sourceFrame->document()->url()), 0); }
String StorageAreaProxy::getItem(const String& key, ExceptionCode& ec, Frame* sourceFrame) { ec = 0; if (!canAccessStorage(sourceFrame)) { ec = SECURITY_ERR; return String(); } if (disabledByPrivateBrowsingInFrame(sourceFrame)) return String(); loadValuesIfNeeded(); return m_storageMap->getItem(key); }
String StorageAreaProxy::key(unsigned index, ExceptionCode& ec, Frame* sourceFrame) { ec = 0; if (!canAccessStorage(sourceFrame)) { ec = SECURITY_ERR; return String(); } if (disabledByPrivateBrowsingInFrame(sourceFrame)) return String(); loadValuesIfNeeded(); return m_storageMap->key(index); }
unsigned StorageAreaProxy::length(ExceptionCode& ec, Frame* sourceFrame) { ec = 0; if (!canAccessStorage(sourceFrame)) { ec = SECURITY_ERR; return 0; } if (disabledByPrivateBrowsingInFrame(sourceFrame)) return 0; loadValuesIfNeeded(); return m_storageMap->length(); }
bool StorageAreaImpl::contains(const String& key, ExceptionCode& ec, Frame* frame) const { ec = 0; if (!canAccessStorage(frame)) { ec = SECURITY_ERR; return false; } if (disabledByPrivateBrowsingInFrame(frame)) return false; ASSERT(!m_isShutdown); blockUntilImportComplete(); return m_storageMap->contains(key); }
String StorageAreaImpl::key(unsigned index, ExceptionCode& ec, Frame* frame) const { ec = 0; if (!canAccessStorage(frame)) { ec = SECURITY_ERR; return String(); } if (disabledByPrivateBrowsingInFrame(frame)) return String(); ASSERT(!m_isShutdown); blockUntilImportComplete(); return m_storageMap->key(index); }
unsigned StorageAreaImpl::length(ExceptionCode& ec, Frame* frame) const { ec = 0; if (!canAccessStorage(frame)) { ec = SECURITY_ERR; return 0; } if (disabledByPrivateBrowsingInFrame(frame)) return 0; ASSERT(!m_isShutdown); blockUntilImportComplete(); return m_storageMap->length(); }
void StorageAreaImpl::clear(Frame* frame) { ASSERT(!m_isShutdown); blockUntilImportComplete(); if (disabledByPrivateBrowsingInFrame(frame)) return; if (!m_storageMap->length()) return; unsigned quota = m_storageMap->quota(); m_storageMap = StorageMap::create(quota); if (m_storageAreaSync) m_storageAreaSync->scheduleClear(); StorageEventDispatcher::dispatch(String(), String(), String(), m_storageType, m_securityOrigin.get(), frame); }