Changeset 73533 in webkit


Ignore:
Timestamp:
Dec 8, 2010 11:06:42 AM (13 years ago)
Author:
jberlin@webkit.org
Message:

WebKit2: Implement WebChromeClient::exceededDatabaseQuota
https://bugs.webkit.org/show_bug.cgi?id=50656

Reviewed by Adam Roben.

WebCore:

  • WebCore.exp.in:

Export the symbol for SecurityOrigin::databaseIdentifier.

WebKit2:

The exceededDatabaseQuota call from the WebProcess to the UIProcess needs to be synchronous
because the new quota is checked directly after exceededDatabaseQuota returns in order to
determine if the new Database can be created.

Pass all of the details from the WebProcess to the UIProcess in order to inform the
decision in the UIProcess about the new quota. In WebKit1, these details were
fetched through an additional call to the API detailsForDatabase (which is infeasible in
WebKit2 since exceededDatabaseQuota is a synchronous call).

  • Platform/CoreIPC/HandleMessage.h:

(CoreIPC::callMemberFunction):
Add a version that takes 7 parameters.

  • UIProcess/API/C/WKPage.h:
  • UIProcess/API/qt/qwkpage.cpp:

(QWKPage::QWKPage):
Indicate that exceededDatabaseQuota is not implemented.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::exceededDatabaseQuota):
Call the UIClient's exceededDatabaseQuota

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/WebUIClient.cpp:

(WebKit::WebUIClient::exceededDatabaseQuota):
If the client does not implement exceededDatabaseQuota, return a the current quota.

  • UIProcess/WebUIClient.h:
  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::exceededDatabaseQuota):
Send a synchronous message to the UIProcess to ask for the new quota for the origin for the
given frame.

WebKitTools:

  • MiniBrowser/mac/BrowserWindowController.m:

(-[BrowserWindowController awakeFromNib]):
Indicate that exceededDatabaseQuota is not implemented.

  • MiniBrowser/win/BrowserView.cpp:

(BrowserView::create):
Ditto.

  • WebKitTestRunner/TestController.cpp:

(WTR::createOtherPage):
Ditto.
(WTR::TestController::initialize):
Ditto.

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r73532 r73533  
     12010-12-08  Jessie Berlin  <jberlin@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Implement WebChromeClient::exceededDatabaseQuota
     6        https://bugs.webkit.org/show_bug.cgi?id=50656
     7
     8        * WebCore.exp.in:
     9        Export the symbol for SecurityOrigin::databaseIdentifier.
     10
    1112010-12-08  Csaba Osztrogonác  <ossy@webkit.org>
    212
  • trunk/WebCore/WebCore.exp.in

    r73469 r73533  
    10081008__ZNK7WebCore14ResourceLoader11frameLoaderEv
    10091009__ZNK7WebCore14SecurityOrigin10canDisplayERKNS_4KURLE
     1010__ZNK7WebCore14SecurityOrigin18databaseIdentifierEv
    10101011__ZNK7WebCore14SecurityOrigin5equalEPKS0_
    10111012__ZNK7WebCore15FocusController18focusedOrMainFrameEv
  • trunk/WebKit2/ChangeLog

    r73463 r73533  
     12010-12-08  Jessie Berlin  <jberlin@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Implement WebChromeClient::exceededDatabaseQuota
     6        https://bugs.webkit.org/show_bug.cgi?id=50656
     7
     8        The exceededDatabaseQuota call from the WebProcess to the UIProcess needs to be synchronous
     9        because the new quota is checked directly after exceededDatabaseQuota returns in order to
     10        determine if the new Database can be created.
     11
     12        Pass all of the details from the WebProcess to the UIProcess in order to inform the
     13        decision in the UIProcess about the new quota. In WebKit1, these details were
     14        fetched through an additional call to the API detailsForDatabase (which is infeasible in
     15        WebKit2 since exceededDatabaseQuota is a synchronous call).
     16
     17        * Platform/CoreIPC/HandleMessage.h:
     18        (CoreIPC::callMemberFunction):
     19        Add a version that takes 7 parameters.
     20
     21        * UIProcess/API/C/WKPage.h:
     22
     23        * UIProcess/API/qt/qwkpage.cpp:
     24        (QWKPage::QWKPage):
     25        Indicate that exceededDatabaseQuota is not implemented.
     26
     27        * UIProcess/WebPageProxy.cpp:
     28        (WebKit::WebPageProxy::exceededDatabaseQuota):
     29        Call the UIClient's exceededDatabaseQuota
     30        * UIProcess/WebPageProxy.h:
     31        * UIProcess/WebPageProxy.messages.in:
     32
     33        * UIProcess/WebUIClient.cpp:
     34        (WebKit::WebUIClient::exceededDatabaseQuota):
     35        If the client does not implement exceededDatabaseQuota, return a the current quota.
     36        * UIProcess/WebUIClient.h:
     37
     38        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     39        (WebKit::WebChromeClient::exceededDatabaseQuota):
     40        Send a synchronous message to the UIProcess to ask for the new quota for the origin for the
     41        given frame.
     42
    1432010-12-07  Anders Carlsson  <andersca@apple.com>
    244
  • trunk/WebKit2/Platform/CoreIPC/HandleMessage.h

    r72456 r73533  
    132132{
    133133    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1);
     134}
     135
     136template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename R1>
     137void callMemberFunction(const Arguments7<P1, P2, P3, P4, P5, P6, P7>& args, Arguments1<R1>& replyArgs, C* object, MF function)
     138{
     139    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, args.argument7, replyArgs.argument1);
    134140}
    135141
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r73412 r73533  
    154154typedef void (*WKPageDidDrawCallback)(WKPageRef page, const void *clientInfo);
    155155typedef void (*WKPageDidScrollCallback)(WKPageRef page, const void *clientInfo);
     156typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage, const void *clientInfo);
    156157
    157158
     
    181182    WKPageDidDrawCallback                                               didDraw;
    182183    WKPageDidScrollCallback                                             pageDidScroll;
     184    WKPageExceededDatabaseQuotaCallback                                 exceededDatabaseQuota;
    183185};
    184186typedef struct WKPageUIClient WKPageUIClient;
  • trunk/WebKit2/UIProcess/API/qt/qwkpage.cpp

    r73412 r73533  
    361361        0,  /* runBeforeUnloadConfirmPanel */
    362362        0,  /* didDraw */
    363         0   /* pageDidScroll */
     363        0,  /* pageDidScroll */
     364        0   /* exceededDatabaseQuota */
    364365    };
    365366    WKPageSetPageUIClient(pageRef(), &uiClient);
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r73412 r73533  
    5959#include "WebProcessProxy.h"
    6060#include "WebProtectionSpace.h"
     61#include "WebSecurityOrigin.h"
    6162#include "WebURLRequest.h"
    6263#include <WebCore/FloatRect.h>
     
    15621563}
    15631564
     1565void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota)
     1566{
     1567    WebFrameProxy* frame = process()->webFrame(frameID);
     1568    RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
     1569
     1570    newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentUsage, expectedUsage);
     1571}
     1572
    15641573} // namespace WebKit
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r73412 r73533  
    328328    void pageDidRequestScroll(const WebCore::IntSize&);
    329329#endif
     330    void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
    330331#if PLATFORM(QT)
    331332    void didChangeContentsSize(const WebCore::IntSize&);
  • trunk/WebKit2/UIProcess/WebPageProxy.messages.in

    r73412 r73533  
    141141    CanAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, WebCore::ProtectionSpace protectionSpace) -> (bool canAuthenticate)
    142142    DidReceiveAuthenticationChallenge(uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
     143
     144    # Databases
     145    ExceededDatabaseQuota(uint64_t frameID, WTF::String originIdentifier, WTF::String databaseName, WTF::String databaseDisplayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage) -> (uint64_t newQuota)
    143146}
  • trunk/WebKit2/UIProcess/WebUIClient.cpp

    r71746 r73533  
    238238}
    239239
     240unsigned long long WebUIClient::exceededDatabaseQuota(WebPageProxy* page, WebFrameProxy* frame, WebSecurityOrigin* origin, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage)
     241{
     242    if (!m_client.exceededDatabaseQuota)
     243        return currentQuota;
     244
     245    return m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentUsage, expectedUsage, m_client.clientInfo);
     246}
     247
    240248} // namespace WebKit
  • trunk/WebKit2/UIProcess/WebUIClient.h

    r71746 r73533  
    4545class WebFrameProxy;
    4646class WebPageProxy;
     47class WebSecurityOrigin;
    4748
    4849class WebUIClient : public APIClient<WKPageUIClient> {
     
    7879    void didDraw(WebPageProxy*);
    7980    void pageDidScroll(WebPageProxy*);
     81
     82    unsigned long long exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage);
    8083};
    8184
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r72086 r73533  
    4444#include "WebProcessProxyMessageKinds.h"
    4545#include "WebSearchPopupMenu.h"
     46#include <WebCore/DatabaseTracker.h>
    4647#include <WebCore/FileChooser.h>
    4748#include <WebCore/Frame.h>
     
    421422
    422423#if ENABLE(DATABASE)
    423 void WebChromeClient::exceededDatabaseQuota(Frame*, const String& databaseName)
    424 {
    425     notImplemented();
     424void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
     425{
     426    WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
     427    SecurityOrigin* origin = frame->document()->securityOrigin();
     428
     429    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseName, origin);
     430    unsigned long long currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin);
     431    unsigned long long newQuota = 0;
     432    WebProcess::shared().connection()->sendSync(
     433        Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, details.currentUsage(), details.expectedUsage()),
     434        Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID());
     435
     436    DatabaseTracker::tracker().setQuota(origin, newQuota);
    426437}
    427438#endif
  • trunk/WebKitTools/ChangeLog

    r73527 r73533  
     12010-12-08  Jessie Berlin  <jberlin@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Implement WebChromeClient::exceededDatabaseQuota
     6        https://bugs.webkit.org/show_bug.cgi?id=50656
     7
     8        * MiniBrowser/mac/BrowserWindowController.m:
     9        (-[BrowserWindowController awakeFromNib]):
     10        Indicate that exceededDatabaseQuota is not implemented.
     11        * MiniBrowser/win/BrowserView.cpp:
     12        (BrowserView::create):
     13        Ditto.
     14        * WebKitTestRunner/TestController.cpp:
     15        (WTR::createOtherPage):
     16        Ditto.
     17        (WTR::TestController::initialize):
     18        Ditto.
     19
    1202010-12-08  Antonio Gomes  <agomes@rim.com>
    221
  • trunk/WebKitTools/MiniBrowser/mac/BrowserWindowController.m

    r73412 r73533  
    607607        runBeforeUnloadConfirmPanel,
    608608        0,          /* didDraw */
    609         0           /* pageDidScroll */
     609        0,          /* pageDidScroll */
     610        0           /* exceededDatabaseQuota */
    610611    };
    611612    WKPageSetPageUIClient(_webView.pageRef, &uiClient);
  • trunk/WebKitTools/MiniBrowser/win/BrowserView.cpp

    r73070 r73533  
    119119        0,          /* runBeforeUnloadConfirmPanel */
    120120        0,          /* didDraw */
    121         0           /* pageDidScroll */
     121        0,          /* pageDidScroll */
     122        0           /* exceededDatabaseQuota */
    122123    };
    123124
  • trunk/WebKitTools/WebKitTestRunner/TestController.cpp

    r73412 r73533  
    136136        0, // runBeforeUnloadConfirmPanel
    137137        0, // didDraw
    138         0  // pageDidScroll
     138        0, // pageDidScroll
     139        0  // exceededDatabaseQuota
    139140    };
    140141    WKPageSetPageUIClient(newPage, &otherPageUIClient);
     
    238239        0, // runBeforeUnloadConfirmPanel
    239240        0, // didDraw
    240         0  // pageDidScroll
     241        0, // pageDidScroll
     242        0  // exceededDatabaseQuota
    241243    };
    242244    WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
Note: See TracChangeset for help on using the changeset viewer.