Changeset 85703 in webkit


Ignore:
Timestamp:
May 3, 2011 7:08:54 PM (13 years ago)
Author:
jam@chromium.org
Message:

2011-05-03 John Abd-El-Malek <jam@chromium.org>

Reviewed by James Robinson.

[chromium] Go through WebPermissionClient for local storage access. Also cleanup left over code from previous WebPermissionClient change.
https://bugs.webkit.org/show_bug.cgi?id=60066

  • public/WebFrameClient.h:
  • public/WebPermissionClient.h: (WebKit::WebPermissionClient::allowLocalStorage):
  • src/DatabaseObserver.cpp: (WebCore::DatabaseObserver::canEstablishDatabase):
  • src/FrameLoaderClientImpl.cpp: (WebKit::FrameLoaderClientImpl::allowScriptExtension): (WebKit::FrameLoaderClientImpl::allowJavaScript): (WebKit::FrameLoaderClientImpl::allowPlugins): (WebKit::FrameLoaderClientImpl::allowImages): (WebKit::FrameLoaderClientImpl::didNotAllowScript): (WebKit::FrameLoaderClientImpl::didNotAllowPlugins):
  • src/StorageAreaProxy.cpp: (WebCore::StorageAreaProxy::setItem):
Location:
trunk/Source/WebKit/chromium
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r85660 r85703  
     12011-05-03  John Abd-El-Malek  <jam@chromium.org>
     2
     3        Reviewed by James Robinson.
     4
     5        [chromium] Go through WebPermissionClient for local storage access.  Also cleanup left over code from previous WebPermissionClient change.
     6        https://bugs.webkit.org/show_bug.cgi?id=60066
     7
     8        * public/WebFrameClient.h:
     9        * public/WebPermissionClient.h:
     10        (WebKit::WebPermissionClient::allowLocalStorage):
     11        * src/DatabaseObserver.cpp:
     12        (WebCore::DatabaseObserver::canEstablishDatabase):
     13        * src/FrameLoaderClientImpl.cpp:
     14        (WebKit::FrameLoaderClientImpl::allowScriptExtension):
     15        (WebKit::FrameLoaderClientImpl::allowJavaScript):
     16        (WebKit::FrameLoaderClientImpl::allowPlugins):
     17        (WebKit::FrameLoaderClientImpl::allowImages):
     18        (WebKit::FrameLoaderClientImpl::didNotAllowScript):
     19        (WebKit::FrameLoaderClientImpl::didNotAllowPlugins):
     20        * src/StorageAreaProxy.cpp:
     21        (WebCore::StorageAreaProxy::setItem):
     22
    1232011-05-03  Tony Chang  <tony@chromium.org>
    224
  • trunk/Source/WebKit/chromium/DEPS

    r85660 r85703  
    3333vars = {
    3434  'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
    35   'chromium_rev': '83922'
     35  'chromium_rev': '84023'
    3636}
    3737
  • trunk/Source/WebKit/chromium/public/WebFrameClient.h

    r85241 r85703  
    295295    virtual void didCreateIsolatedScriptContext(WebFrame*) { }
    296296
    297     // FIXME(jam): remove me once Chrome's WebKit is rolled.
    298     virtual bool allowPlugins(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; }
    299     virtual void didNotAllowPlugins(WebFrame*) { }
    300     virtual bool allowImages(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; }
    301     virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; }
    302     virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) { return true; }
    303     virtual void didNotAllowScript(WebFrame*) { }
    304     virtual bool allowScriptExtension(WebFrame*, const WebString& extensionName, int extensionGroup) { return true; }
    305 
    306297
    307298    // Geometry notifications ----------------------------------------------
  • trunk/Source/WebKit/chromium/public/WebPermissionClient.h

    r85241 r85703  
    5858    virtual bool allowScriptExtension(WebFrame*, const WebString& extensionName, int extensionGroup) { return true; }
    5959
     60    // Controls whether HTML5 Web Storage is allowed for this frame.
     61    // If local is true, then this is for local storage, otherwise it's for session storage.
     62    virtual bool allowStorage(WebFrame*, bool local) { return true; }
     63
    6064    // Controls whether access to read the clipboard is allowed for this frame.
    6165    virtual bool allowReadFromClipboard(WebFrame*, bool defaultValue) { return defaultValue; }
  • trunk/Source/WebKit/chromium/public/WebStorageArea.h

    r55659 r85703  
    4949    enum Result {
    5050        ResultOK = 0,
    51         ResultBlockedByQuota,
    52         ResultBlockedByPolicy
     51        ResultBlockedByQuota
    5352    };
    5453
  • trunk/Source/WebKit/chromium/src/DatabaseObserver.cpp

    r85241 r85703  
    6262        if (webView->permissionClient())
    6363            return webView->permissionClient()->allowDatabase(webFrame, name, displayName, estimatedSize);
    64         // FIXME(jam): remove this.
    65         return webFrame->client()->allowDatabase(webFrame, name, displayName, estimatedSize);
    6664    } else {
    6765        WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext);
  • trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp

    r85287 r85703  
    159159        return webview->permissionClient()->allowScriptExtension(m_webFrame, extensionName, extensionGroup);
    160160
    161     // FIXME(jam): remove this.
    162     if (m_webFrame->client())
    163         return m_webFrame->client()->allowScriptExtension(m_webFrame, extensionName, extensionGroup);
    164 
    165161    return true;
    166162}
     
    186182        return webview->permissionClient()->allowScript(m_webFrame, enabledPerSettings);
    187183
    188     // FIXME(jam): remove this.
    189     if (m_webFrame->client())
    190         return m_webFrame->client()->allowScript(m_webFrame, enabledPerSettings);
    191 
    192184    return enabledPerSettings;
    193185}
     
    199191        return webview->permissionClient()->allowPlugins(m_webFrame, enabledPerSettings);
    200192
    201     // FIXME(jam): remove this.
    202     if (m_webFrame->client())
    203         return m_webFrame->client()->allowPlugins(m_webFrame, enabledPerSettings);
    204 
    205193    return enabledPerSettings;
    206194}
     
    212200        return webview->permissionClient()->allowImages(m_webFrame, enabledPerSettings);
    213201
    214     // FIXME(jam): remove this.
    215     if (m_webFrame->client())
    216         return m_webFrame->client()->allowImages(m_webFrame, enabledPerSettings);
    217 
    218202    return enabledPerSettings;
    219203}
     
    224208    if (webview && webview->permissionClient())
    225209        webview->permissionClient()->didNotAllowScript(m_webFrame);
    226 
    227     // FIXME(jam): remove this.
    228     if (m_webFrame->client())
    229         m_webFrame->client()->didNotAllowScript(m_webFrame);
    230210}
    231211
     
    236216        webview->permissionClient()->didNotAllowPlugins(m_webFrame);
    237217
    238     // FIXME(jam): remove this.
    239     if (m_webFrame->client())
    240         m_webFrame->client()->didNotAllowPlugins(m_webFrame);
    241218}
    242219
  • trunk/Source/WebKit/chromium/src/StorageAreaProxy.cpp

    r84933 r85703  
    4646
    4747#include "WebFrameImpl.h"
     48#include "WebPermissionClient.h"
    4849#include "WebStorageArea.h"
    4950#include "WebString.h"
    5051#include "WebURL.h"
     52#include "WebViewImpl.h"
    5153
    5254namespace WebCore {
     
    8183    WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK;
    8284    WebKit::WebString oldValue;
    83     WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame);
    84     m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue, webFrame);
    85     ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR;
    86     String oldValueString = oldValue;
    87     if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK)
    88         storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame);
     85    WebKit::WebFrameImpl* webFrame = WebKit::WebFrameImpl::fromFrame(frame);
     86    WebKit::WebViewImpl* webView = webFrame->viewImpl();
     87    if (webView->permissionClient() && !webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage))
     88        ec = QUOTA_EXCEEDED_ERR;
     89    else {
     90        m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue, webFrame);
     91        ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR;
     92        String oldValueString = oldValue;
     93        if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK)
     94            storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame);
     95    }
    8996    return oldValue;
    9097}
Note: See TracChangeset for help on using the changeset viewer.