Commit b646cd5e authored by jberlin@webkit.org's avatar jberlin@webkit.org

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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73533 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8212c7dd
2010-12-08 Jessie Berlin <jberlin@apple.com>
Reviewed by Adam Roben.
WebKit2: Implement WebChromeClient::exceededDatabaseQuota
https://bugs.webkit.org/show_bug.cgi?id=50656
* WebCore.exp.in:
Export the symbol for SecurityOrigin::databaseIdentifier.
2010-12-08 Csaba Osztrogonác <ossy@webkit.org>
Unreviewed, rolling out r73521.
......
......@@ -1007,6 +1007,7 @@ __ZNK7WebCore14RenderListItem10markerTextEv
__ZNK7WebCore14ResourceHandle10connectionEv
__ZNK7WebCore14ResourceLoader11frameLoaderEv
__ZNK7WebCore14SecurityOrigin10canDisplayERKNS_4KURLE
__ZNK7WebCore14SecurityOrigin18databaseIdentifierEv
__ZNK7WebCore14SecurityOrigin5equalEPKS0_
__ZNK7WebCore15FocusController18focusedOrMainFrameEv
__ZNK7WebCore15GraphicsContext15platformContextEv
......
2010-12-08 Jessie Berlin <jberlin@apple.com>
Reviewed by Adam Roben.
WebKit2: Implement WebChromeClient::exceededDatabaseQuota
https://bugs.webkit.org/show_bug.cgi?id=50656
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.
2010-12-07 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
......@@ -133,6 +133,12 @@ void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments1<R1>&
(object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1);
}
template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename R1>
void callMemberFunction(const Arguments7<P1, P2, P3, P4, P5, P6, P7>& args, Arguments1<R1>& replyArgs, C* object, MF function)
{
(object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, args.argument7, replyArgs.argument1);
}
template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2>
void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function)
{
......
......@@ -153,6 +153,7 @@ typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const
typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageDidDrawCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageDidScrollCallback)(WKPageRef page, const void *clientInfo);
typedef 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);
struct WKPageUIClient {
......@@ -180,6 +181,7 @@ struct WKPageUIClient {
WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel;
WKPageDidDrawCallback didDraw;
WKPageDidScrollCallback pageDidScroll;
WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota;
};
typedef struct WKPageUIClient WKPageUIClient;
......
......@@ -360,7 +360,8 @@ QWKPage::QWKPage(WKPageNamespaceRef namespaceRef)
0, /* setWindowFrame */
0, /* runBeforeUnloadConfirmPanel */
0, /* didDraw */
0 /* pageDidScroll */
0, /* pageDidScroll */
0 /* exceededDatabaseQuota */
};
WKPageSetPageUIClient(pageRef(), &uiClient);
}
......
......@@ -58,6 +58,7 @@
#include "WebProcessMessages.h"
#include "WebProcessProxy.h"
#include "WebProtectionSpace.h"
#include "WebSecurityOrigin.h"
#include "WebURLRequest.h"
#include <WebCore/FloatRect.h>
#include <WebCore/MIMETypeRegistry.h>
......@@ -1561,4 +1562,12 @@ void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const Web
m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get(), authenticationChallenge->listener());
}
void 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)
{
WebFrameProxy* frame = process()->webFrame(frameID);
RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentUsage, expectedUsage);
}
} // namespace WebKit
......@@ -327,6 +327,7 @@ private:
#if ENABLE(TILED_BACKING_STORE)
void pageDidRequestScroll(const WebCore::IntSize&);
#endif
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);
#if PLATFORM(QT)
void didChangeContentsSize(const WebCore::IntSize&);
void didFindZoomableArea(const WebCore::IntRect&);
......
......@@ -140,4 +140,7 @@ messages -> WebPageProxy {
# Authentication
CanAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, WebCore::ProtectionSpace protectionSpace) -> (bool canAuthenticate)
DidReceiveAuthenticationChallenge(uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
# Databases
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)
}
......@@ -237,4 +237,12 @@ void WebUIClient::pageDidScroll(WebPageProxy* page)
m_client.pageDidScroll(toAPI(page), m_client.clientInfo);
}
unsigned 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)
{
if (!m_client.exceededDatabaseQuota)
return currentQuota;
return m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentUsage, expectedUsage, m_client.clientInfo);
}
} // namespace WebKit
......@@ -44,6 +44,7 @@ class APIObject;
class NativeWebKeyboardEvent;
class WebFrameProxy;
class WebPageProxy;
class WebSecurityOrigin;
class WebUIClient : public APIClient<WKPageUIClient> {
public:
......@@ -77,6 +78,8 @@ public:
void didDraw(WebPageProxy*);
void pageDidScroll(WebPageProxy*);
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);
};
} // namespace WebKit
......
......@@ -43,6 +43,7 @@
#include "WebProcess.h"
#include "WebProcessProxyMessageKinds.h"
#include "WebSearchPopupMenu.h"
#include <WebCore/DatabaseTracker.h>
#include <WebCore/FileChooser.h>
#include <WebCore/Frame.h>
#include <WebCore/FrameLoader.h>
......@@ -420,9 +421,19 @@ void WebChromeClient::print(Frame*)
}
#if ENABLE(DATABASE)
void WebChromeClient::exceededDatabaseQuota(Frame*, const String& databaseName)
void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
{
notImplemented();
WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
SecurityOrigin* origin = frame->document()->securityOrigin();
DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseName, origin);
unsigned long long currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin);
unsigned long long newQuota = 0;
WebProcess::shared().connection()->sendSync(
Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, details.currentUsage(), details.expectedUsage()),
Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID());
DatabaseTracker::tracker().setQuota(origin, newQuota);
}
#endif
......
2010-12-08 Jessie Berlin <jberlin@apple.com>
Reviewed by Adam Roben.
WebKit2: Implement WebChromeClient::exceededDatabaseQuota
https://bugs.webkit.org/show_bug.cgi?id=50656
* 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.
2010-12-08 Antonio Gomes <agomes@rim.com>
Reviewed by Martin Robinson.
......
......@@ -606,7 +606,8 @@ - (void)awakeFromNib
setWindowFrame,
runBeforeUnloadConfirmPanel,
0, /* didDraw */
0 /* pageDidScroll */
0, /* pageDidScroll */
0 /* exceededDatabaseQuota */
};
WKPageSetPageUIClient(_webView.pageRef, &uiClient);
}
......
......@@ -118,7 +118,8 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow)
0, /* setWindowFrame */
0, /* runBeforeUnloadConfirmPanel */
0, /* didDraw */
0 /* pageDidScroll */
0, /* pageDidScroll */
0 /* exceededDatabaseQuota */
};
WKPageSetPageUIClient(WKViewGetPage(m_webView), &uiClient);
......
......@@ -135,7 +135,8 @@ static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModi
setWindowFrameOtherPage,
0, // runBeforeUnloadConfirmPanel
0, // didDraw
0 // pageDidScroll
0, // pageDidScroll
0 // exceededDatabaseQuota
};
WKPageSetPageUIClient(newPage, &otherPageUIClient);
......@@ -237,7 +238,8 @@ void TestController::initialize(int argc, const char* argv[])
setWindowFrameMainPage,
0, // runBeforeUnloadConfirmPanel
0, // didDraw
0 // pageDidScroll
0, // pageDidScroll
0 // exceededDatabaseQuota
};
WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment