Example #1
0
void StorageArea::clear(ExceptionState& exceptionState, LocalFrame* frame) {
  if (!canAccessStorage(frame)) {
    exceptionState.throwSecurityError("access is denied for this document.");
    return;
  }
  m_storageArea->clear(frame->document()->url());
}
Example #2
0
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);
}
Example #3
0
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);
}
Example #4
0
bool StorageArea::contains(const String& key, ExceptionState& exceptionState, LocalFrame* frame)
{
    if (!canAccessStorage(frame)) {
        exceptionState.throwSecurityError("access is denied for this document.");
        return false;
    }
    return !getItem(key, exceptionState, frame).isNull();
}
Example #5
0
unsigned StorageArea::length(ExceptionState& exceptionState, LocalFrame* frame)
{
    if (!canAccessStorage(frame)) {
        exceptionState.throwSecurityError("access is denied for this document.");
        return 0;
    }
    return m_storageArea->length();
}
bool StorageAreaProxy::contains(const String& key, ExceptionCode& ec, Frame* frame)
{
    if (!canAccessStorage(frame)) {
        ec = SECURITY_ERR;
        return false;
    }
    return !getItem(key, ec, frame).isNull();
}
Example #7
0
String StorageArea::key(unsigned index, ExceptionState& exceptionState, LocalFrame* frame)
{
    if (!canAccessStorage(frame)) {
        exceptionState.throwSecurityError("access is denied for this document.");
        return String();
    }
    return m_storageArea->key(index);
}
Example #8
0
String StorageArea::getItem(const String& key, ExceptionState& exceptionState, LocalFrame* frame)
{
    if (!canAccessStorage(frame)) {
        exceptionState.throwSecurityError("access is denied for this document.");
        return String();
    }
    return m_storageArea->getItem(key);
}
Example #9
0
void StorageArea::removeItem(const String& key, ExceptionState& exceptionState, LocalFrame* frame)
{
    if (!canAccessStorage(frame)) {
        exceptionState.throwSecurityError("access is denied for this document.");
        return;
    }
    m_storageArea->removeItem(key, frame->document()->url());
}
String StorageAreaProxy::getItem(const String& key, ExceptionCode& ec, Frame* frame)
{
    if (!canAccessStorage(frame)) {
        ec = SECURITY_ERR;
        return String();
    }
    ec = 0;
    return m_storageArea->getItem(key);
}
String StorageAreaProxy::key(unsigned index, ExceptionCode& ec, Frame* frame)
{
    if (!canAccessStorage(frame)) {
        ec = SECURITY_ERR;
        return String();
    }
    ec = 0;
    return m_storageArea->key(index);
}
unsigned StorageAreaProxy::length(ExceptionCode& ec, Frame* frame)
{
    if (!canAccessStorage(frame)) {
        ec = SECURITY_ERR;
        return 0;
    }
    ec = 0;
    return m_storageArea->length();
}
void StorageAreaProxy::clear(ExceptionCode& ec, Frame* frame)
{
    if (!canAccessStorage(frame)) {
        ec = SECURITY_ERR;
        return;
    }
    ec = 0;
    m_storageArea->clear(frame->document()->url());
}
void StorageAreaProxy::removeItem(const String& key, ExceptionCode& ec, Frame* frame)
{
    if (!canAccessStorage(frame)) {
        ec = SECURITY_ERR;
        return;
    }
    ec = 0;
    m_storageArea->removeItem(key, frame->document()->url());
}
void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
{
    if (!canAccessStorage(frame)) {
        ec = SECURITY_ERR;
        return;
    }
    WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK;
    m_storageArea->setItem(key, value, frame->document()->url(), result);
    ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR;
}
Example #16
0
String StorageAreaProxy::removeItem(const String& key, Frame* frame)
{
    if (!canAccessStorage(frame))
        return String();
    WebKit::WebString oldValue;
    m_storageArea->removeItem(key, frame->document()->url(), oldValue);
    if (!oldValue.isNull())
        storageEvent(key, oldValue, String(), m_storageType, frame->document()->securityOrigin(), frame);
    return oldValue;
}
Example #17
0
bool StorageAreaProxy::clear(Frame* frame)
{
    if (!canAccessStorage(frame))
        return false;
    bool clearedSomething;
    m_storageArea->clear(frame->document()->url(), clearedSomething);
    if (clearedSomething)
        storageEvent(String(), String(), String(), m_storageType, frame->document()->securityOrigin(), frame);
    return clearedSomething;
}
Example #18
0
void StorageArea::setItem(const String& key, const String& value, ExceptionState& exceptionState, LocalFrame* frame)
{
    if (!canAccessStorage(frame)) {
        exceptionState.throwSecurityError("access is denied for this document.");
        return;
    }
    WebStorageArea::Result result = WebStorageArea::ResultOK;
    m_storageArea->setItem(key, value, frame->document()->url(), result);
    if (result != WebStorageArea::ResultOK)
        exceptionState.throwDOMException(QuotaExceededError, "Setting the value of '" + key + "' exceeded the quota.");
}
Example #19
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);
}
Example #20
0
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();
}
Example #21
0
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);
}
Example #22
0
String StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
{
    WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK;
    WebKit::WebString oldValue;
    if (!canAccessStorage(frame))
        ec = QUOTA_EXCEEDED_ERR;
    else {
        m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue);
        ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR;
        String oldValueString = oldValue;
        if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK)
            storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame);
    }
    return oldValue;
}
Example #23
0
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();
}
Example #24
0
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);
}
Example #25
0
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);
}
Example #26
0
void StorageAreaImpl::clear(ExceptionCode& ec, Frame* frame)
{
    ec = 0;
    if (!canAccessStorage(frame)) {
        ec = SECURITY_ERR;
        return;
    }

    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);
}
Example #27
0
String StorageAreaProxy::getItem(const String& key, Frame* frame) const
{
    if (canAccessStorage(frame))
        return m_storageArea->getItem(key);
    return String();
}
Example #28
0
String StorageAreaProxy::key(unsigned index, Frame* frame) const
{
    if (canAccessStorage(frame))
        return m_storageArea->key(index);
    return String();
}
Example #29
0
unsigned StorageAreaProxy::length(Frame* frame) const
{
    if (canAccessStorage(frame))
        return m_storageArea->length();
    return 0;
}