Skip to content

Commit

Permalink
Merge r186225 - [GTK] WebSQL doesn't work because openDatabase always…
Browse files Browse the repository at this point in the history
… fails with DOM Exception 18

https://bugs.webkit.org/show_bug.cgi?id=146234

Reviewed by Sergio Villar Senin.

Source/WebKit2:

This is because we don't provide any quota, and 0 is used by
default, so there's never enough quota and openDatabase fails. We
should expose this in the API, but for now, we could use a default
quota of 5MB like WTR does.

* UIProcess/API/gtk/WebKitUIClient.cpp: Override
exceededDatabaseQuota and return always the default quota.
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::exceededDatabaseQuota): Return the quota based on the
expected usage and current database usabe like mac does.
(WebKit::WebInspectorProxy::platformCreateInspectorPage): Add
custom UI client to implement exceededDatabaseQuota.
  • Loading branch information
carlosgcampos committed Jul 7, 2015
1 parent e10d746 commit e97b9db
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
20 changes: 20 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,23 @@
2015-07-02 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] WebSQL doesn't work because openDatabase always fails with DOM Exception 18
https://bugs.webkit.org/show_bug.cgi?id=146234

Reviewed by Sergio Villar Senin.

This is because we don't provide any quota, and 0 is used by
default, so there's never enough quota and openDatabase fails. We
should expose this in the API, but for now, we could use a default
quota of 5MB like WTR does.

* UIProcess/API/gtk/WebKitUIClient.cpp: Override
exceededDatabaseQuota and return always the default quota.
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::exceededDatabaseQuota): Return the quota based on the
expected usage and current database usabe like mac does.
(WebKit::WebInspectorProxy::platformCreateInspectorPage): Add
custom UI client to implement exceededDatabaseQuota.

2015-07-06 Zan Dobersek <zdobersek@igalia.com>

[GTK] Guard X11-specific code in webkitWebViewBaseDidRelaunchWebProcess()
Expand Down
7 changes: 7 additions & 0 deletions Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
Expand Up @@ -146,6 +146,13 @@ class UIClient : public API::UIClient {
return WebCore::FloatRect(geometry);
}

virtual void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, const String&, const String&, unsigned long long /*currentQuota*/, unsigned long long /*currentOriginUsage*/, unsigned long long /*currentDatabaseUsage*/, unsigned long long /*expectedUsage*/, std::function<void (unsigned long long)> completionHandler) override
{
static const unsigned long long defaultQuota = 5 * 1024 * 1204; // 5 MB
// FIXME: Provide API for this.
completionHandler(defaultQuota);
}

virtual bool runOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override
{
GRefPtr<WebKitFileChooserRequest> request = adoptGRef(webkitFileChooserRequestCreate(parameters, listener));
Expand Down
61 changes: 60 additions & 1 deletion Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
Expand Up @@ -52,6 +52,11 @@ static void inspectorViewDestroyed(GtkWidget*, gpointer userData)
inspectorProxy->close();
}

static unsigned long long exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef, WKStringRef, unsigned long long, unsigned long long, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void*)
{
return std::max<unsigned long long>(expectedUsage, currentDatabaseUsage * 1.25);
}

void WebInspectorProxy::initializeInspectorClientGtk(const WKInspectorClientGtkBase* inspectorClient)
{
m_client.initialize(inspectorClient);
Expand All @@ -76,7 +81,61 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(&inspectorProcessPool(), preferences.get(), pageGroup.get(), nullptr, nullptr));
g_object_add_weak_pointer(G_OBJECT(m_inspectorView), reinterpret_cast<void**>(&m_inspectorView));

return webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView));
WKPageUIClientV2 uiClient = {
{ 2, this },
nullptr, // createNewPage_deprecatedForUseWithV0
nullptr, // showPage
nullptr, // closePage
nullptr, // takeFocus
nullptr, // focus
nullptr, // unfocus
nullptr, // runJavaScriptAlert
nullptr, // runJavaScriptConfirm
nullptr, // runJavaScriptPrompt
nullptr, // setStatusText
nullptr, // mouseDidMoveOverElement_deprecatedForUseWithV0
nullptr, // missingPluginButtonClicked_deprecatedForUseWithV0
nullptr, // didNotHandleKeyEvent
nullptr, // didNotHandleWheelEvent
nullptr, // areToolbarsVisible
nullptr, // setToolbarsVisible
nullptr, // isMenuBarVisible
nullptr, // setMenuBarVisible
nullptr, // isStatusBarVisible
nullptr, // setStatusBarVisible
nullptr, // isResizable
nullptr, // setResizable
nullptr, // getWindowFrame,
nullptr, // setWindowFrame,
nullptr, // runBeforeUnloadConfirmPanel
nullptr, // didDraw
nullptr, // pageDidScroll
exceededDatabaseQuota,
nullptr, // runOpenPanel,
nullptr, // decidePolicyForGeolocationPermissionRequest
nullptr, // headerHeight
nullptr, // footerHeight
nullptr, // drawHeader
nullptr, // drawFooter
nullptr, // printFrame
nullptr, // runModal
nullptr, // unused
nullptr, // saveDataToFileInDownloadsFolder
nullptr, // shouldInterruptJavaScript
nullptr, // createPage
nullptr, // mouseDidMoveOverElement
nullptr, // decidePolicyForNotificationPermissionRequest
nullptr, // unavailablePluginButtonClicked_deprecatedForUseWithV1
nullptr, // showColorPicker
nullptr, // hideColorPicker
nullptr, // unavailablePluginButtonClicked
};

WebPageProxy* inspectorPage = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView));
ASSERT(inspectorPage);
WKPageSetPageUIClient(toAPI(inspectorPage), &uiClient.base);

return inspectorPage;
}

void WebInspectorProxy::dockButtonClicked(GtkWidget* button, WebInspectorProxy* inspector)
Expand Down

0 comments on commit e97b9db

Please sign in to comment.