summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml9
-rw-r--r--src/core/content_browser_client_qt.cpp12
-rw-r--r--src/core/core_chromium.pri5
-rw-r--r--src/core/quota_permission_context_qt.cpp107
-rw-r--r--src/core/quota_permission_context_qt.h61
-rw-r--r--src/core/quota_permission_controller.cpp98
-rw-r--r--src/core/quota_permission_controller.h70
-rw-r--r--src/core/quota_permission_controller_p.h66
-rw-r--r--src/core/web_contents_adapter_client.h2
-rw-r--r--src/webengine/api/qquickwebengineview.cpp37
-rw-r--r--src/webengine/api/qquickwebengineview_p.h28
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h1
-rw-r--r--src/webengine/doc/src/webengineview.qdoc58
-rw-r--r--src/webengine/plugin/plugin.cpp2
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp19
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h2
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h1
-rw-r--r--src/webenginewidgets/api/qwebenginequotapermissionrequest.cpp98
-rw-r--r--src/webenginewidgets/api/qwebenginequotapermissionrequest.h71
-rw-r--r--src/webenginewidgets/webenginewidgets.pro2
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp6
-rw-r--r--tests/auto/quick/qmltests/data/TestWebEngineView.qml2
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp42
23 files changed, 786 insertions, 13 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index 16efc9e37..633ec7a98 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -57,7 +57,7 @@ import QtQuick.Controls.Styles 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.0
import QtQuick.Window 2.1
-import QtWebEngine 1.3
+import QtWebEngine 1.7
ApplicationWindow {
id: browserWindow
@@ -423,6 +423,13 @@ ApplicationWindow {
request.accept();
}
+ onQuotaPermissionRequested: {
+ if (request.requestedSize <= 5 * 1024 * 1024)
+ request.accept();
+ else
+ request.reject();
+ }
+
onRenderProcessTerminated: {
var status = "";
switch (terminationStatus) {
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 5bce81f25..42c3f8951 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -54,7 +54,6 @@
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/media_observer.h"
-#include "content/public/browser/quota_permission_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -97,6 +96,7 @@
#include "printing_message_filter_qt.h"
#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
#include "qrc_protocol_handler_qt.h"
+#include "quota_permission_context_qt.h"
#include "renderer_host/resource_dispatcher_host_delegate_qt.h"
#include "renderer_host/user_resource_controller_host.h"
#include "web_contents_delegate_qt.h"
@@ -374,16 +374,6 @@ void ShareGroupQtQuick::AboutToAddFirstContext()
#endif
}
-class QuotaPermissionContextQt : public content::QuotaPermissionContext {
-public:
- void RequestQuotaPermission(const content::StorageQuotaParams &params, int render_process_id, const PermissionCallback &callback) override
- {
- Q_UNUSED(params);
- Q_UNUSED(render_process_id);
- callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
- }
-};
-
ContentBrowserClientQt::ContentBrowserClientQt()
: m_browserMainParts(0)
{
diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri
index f13095bfe..7b55394a4 100644
--- a/src/core/core_chromium.pri
+++ b/src/core/core_chromium.pri
@@ -77,6 +77,8 @@ SOURCES = \
process_main.cpp \
proxy_config_service_qt.cpp \
qrc_protocol_handler_qt.cpp \
+ quota_permission_context_qt.cpp \
+ quota_permission_controller.cpp \
render_view_observer_host_qt.cpp \
render_widget_host_view_qt.cpp \
render_widget_host_view_qt_delegate.cpp \
@@ -153,6 +155,9 @@ HEADERS = \
process_main.h \
proxy_config_service_qt.h \
qrc_protocol_handler_qt.h \
+ quota_permission_context_qt.h \
+ quota_permission_controller.h \
+ quota_permission_controller_p.h \
render_view_observer_host_qt.h \
render_widget_host_view_qt.h \
render_widget_host_view_qt_delegate.h \
diff --git a/src/core/quota_permission_context_qt.cpp b/src/core/quota_permission_context_qt.cpp
new file mode 100644
index 000000000..10249bbf0
--- /dev/null
+++ b/src/core/quota_permission_context_qt.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quota_permission_context_qt.h"
+
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
+#include "quota_permission_controller.h"
+#include "quota_permission_controller_p.h"
+#include "web_contents_delegate_qt.h"
+#include "web_contents_view_qt.h"
+
+using content::QuotaPermissionContext;
+using content::RenderFrameHost;
+using content::StorageQuotaParams;
+using content::WebContents;
+
+namespace QtWebEngineCore {
+
+void QuotaPermissionContextQt::RequestQuotaPermission(const StorageQuotaParams &params, int render_process_id, const PermissionCallback &callback)
+{
+ if (params.storage_type != storage::kStorageTypePersistent) {
+ // For now we only support requesting quota with this interface
+ // for Persistent storage type.
+ callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
+ return;
+ }
+
+ if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(&QuotaPermissionContextQt::RequestQuotaPermission, this,
+ params, render_process_id, callback));
+ return;
+ }
+
+ RenderFrameHost *renderFrameHost = RenderFrameHost::FromID(render_process_id, params.render_frame_id);
+ if (!renderFrameHost)
+ return;
+
+ WebContents *webContents = WebContents::FromRenderFrameHost(renderFrameHost);
+ if (!webContents)
+ return;
+
+ WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(webContents)->GetView())->client();
+ if (!client)
+ return;
+
+ QSharedPointer<QuotaPermissionController> controller(new QuotaPermissionController(new QuotaPermissionControllerPrivate(this, params, callback)));
+ client->runQuotaPermissionRequest(controller);
+}
+
+void QuotaPermissionContextQt::dispatchCallbackOnIOThread(const PermissionCallback &callback,
+ QuotaPermissionContext::QuotaPermissionResponse response)
+{
+ if (callback.is_null())
+ return;
+
+ if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(&QuotaPermissionContextQt::dispatchCallbackOnIOThread,
+ this, callback, response));
+ return;
+ }
+
+ callback.Run(response);
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/quota_permission_context_qt.h b/src/core/quota_permission_context_qt.h
new file mode 100644
index 000000000..68d768ac6
--- /dev/null
+++ b/src/core/quota_permission_context_qt.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QUOTA_PERMISSION_CONTEXT_QT_H
+#define QUOTA_PERMISSION_CONTEXT_QT_H
+
+#include "content/public/browser/quota_permission_context.h"
+
+#include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE
+
+namespace QtWebEngineCore {
+
+class QuotaPermissionContextQt : public content::QuotaPermissionContext {
+public:
+ void RequestQuotaPermission(const content::StorageQuotaParams &params,
+ int render_process_id,
+ const PermissionCallback &callback) Q_DECL_OVERRIDE;
+
+ void dispatchCallbackOnIOThread(const PermissionCallback &callback,
+ QuotaPermissionContext::QuotaPermissionResponse response);
+};
+
+} // namespace QtWebEngineCore
+
+#endif // QUOTA_PERMISSION_CONTEXT_QT_H
diff --git a/src/core/quota_permission_controller.cpp b/src/core/quota_permission_controller.cpp
new file mode 100644
index 000000000..59fc6198d
--- /dev/null
+++ b/src/core/quota_permission_controller.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quota_permission_controller.h"
+#include "quota_permission_controller_p.h"
+
+#include "quota_permission_context_qt.h"
+#include "type_conversion.h"
+
+namespace QtWebEngineCore {
+
+QuotaPermissionControllerPrivate::QuotaPermissionControllerPrivate(QuotaPermissionContextQt *context,
+ const content::StorageQuotaParams &params,
+ const content::QuotaPermissionContext::PermissionCallback &callback)
+ : m_context(context),
+ m_originUrl(toQt(params.origin_url)),
+ m_requestedSize(params.requested_size),
+ m_callback(callback)
+{
+}
+
+QuotaPermissionControllerPrivate::~QuotaPermissionControllerPrivate()
+{
+}
+
+QuotaPermissionController::QuotaPermissionController(QuotaPermissionControllerPrivate *controllerPrivate)
+ : d(controllerPrivate)
+ , m_answered(false)
+{
+}
+
+QuotaPermissionController::~QuotaPermissionController()
+{
+}
+
+void QuotaPermissionController::accept()
+{
+ if (!m_answered) {
+ d->m_context->dispatchCallbackOnIOThread(d->m_callback, QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_ALLOW);
+ m_answered = true;
+ }
+}
+
+void QuotaPermissionController::cancel()
+{
+ if (!m_answered) {
+ d->m_context->dispatchCallbackOnIOThread(d->m_callback, QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_DISALLOW);
+ m_answered = true;
+ }
+}
+
+QUrl QuotaPermissionController::origin()
+{
+ return d->m_originUrl;
+}
+
+qint64 QuotaPermissionController::requestedSize()
+{
+ return d->m_requestedSize;
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/quota_permission_controller.h b/src/core/quota_permission_controller.h
new file mode 100644
index 000000000..36f751c2c
--- /dev/null
+++ b/src/core/quota_permission_controller.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QUOTA_PERMISSION_CONTROLLER_H
+#define QUOTA_PERMISSION_CONTROLLER_H
+
+#include "qtwebenginecoreglobal.h"
+#include <QtCore/qscopedpointer.h>
+#include <QtCore/qurl.h>
+
+namespace QtWebEngineCore {
+
+class QuotaPermissionContextQt;
+class QuotaPermissionControllerPrivate;
+
+class QWEBENGINE_EXPORT QuotaPermissionController {
+public:
+ QuotaPermissionController(QuotaPermissionControllerPrivate *controllerPrivate);
+ ~QuotaPermissionController();
+
+ void accept();
+ void cancel();
+
+ QUrl origin();
+ qint64 requestedSize();
+
+private:
+ QScopedPointer<QuotaPermissionControllerPrivate> d;
+ bool m_answered;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // QUOTA_PERMISSION_CONTROLLER_H
diff --git a/src/core/quota_permission_controller_p.h b/src/core/quota_permission_controller_p.h
new file mode 100644
index 000000000..c00ae42c9
--- /dev/null
+++ b/src/core/quota_permission_controller_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QUOTA_PERMISSION_CONTROLLER_P_H
+#define QUOTA_PERMISSION_CONTROLLER_P_H
+
+#include "quota_permission_context_qt.h"
+#include <QtCore/qurl.h>
+
+namespace QtWebEngineCore {
+
+class QuotaPermissionControllerPrivate {
+public:
+ QuotaPermissionControllerPrivate(QuotaPermissionContextQt *context,
+ const content::StorageQuotaParams &params,
+ const content::QuotaPermissionContext::PermissionCallback &callback);
+ ~QuotaPermissionControllerPrivate();
+
+private:
+ scoped_refptr<QuotaPermissionContextQt> m_context;
+ QUrl m_originUrl;
+ qint64 m_requestedSize;
+ content::QuotaPermissionContext::PermissionCallback m_callback;
+
+ friend class QuotaPermissionController;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // QUOTA_PERMISSION_CONTROLLER_P_H
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 8b7365342..075f0a84b 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -64,6 +64,7 @@ class BrowserContextAdapter;
class ColorChooserController;
class FilePickerController;
class JavaScriptDialogController;
+class QuotaPermissionController;
class RenderWidgetHostViewQt;
class RenderWidgetHostViewQtDelegate;
class RenderWidgetHostViewQtDelegateClient;
@@ -367,6 +368,7 @@ public:
virtual void runGeolocationPermissionRequest(const QUrl &securityOrigin) = 0;
virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) = 0;
virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) = 0;
+ virtual void runQuotaPermissionRequest(QSharedPointer<QuotaPermissionController>) = 0;
virtual WebEngineSettings *webEngineSettings() const = 0;
virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) = 0;
virtual void hideValidationMessage() = 0;
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 123acb20c..f8fcb5793 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -45,6 +45,7 @@
#include "certificate_error_controller.h"
#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
+#include "quota_permission_controller.h"
#include "qquickwebenginehistory_p.h"
#include "qquickwebenginecertificateerror_p.h"
#include "qquickwebenginecontextmenurequest_p.h"
@@ -722,6 +723,13 @@ void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &secur
adapter->grantMouseLockPermission(false);
}
+void QQuickWebEngineViewPrivate::runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+{
+ Q_Q(QQuickWebEngineView);
+ QQuickWebEngineQuotaPermissionRequest request(controller);
+ Q_EMIT q->quotaPermissionRequested(request);
+}
+
QObject *QQuickWebEngineViewPrivate::accessibilityParentObject()
{
Q_Q(QQuickWebEngineView);
@@ -1854,5 +1862,34 @@ void QQuickWebEngineFullScreenRequest::reject()
m_viewPrivate->setFullScreenMode(!m_toggleOn);
}
+QQuickWebEngineQuotaPermissionRequest::QQuickWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+ : d_ptr(controller)
+{
+}
+
+QQuickWebEngineQuotaPermissionRequest::~QQuickWebEngineQuotaPermissionRequest()
+{
+}
+
+void QQuickWebEngineQuotaPermissionRequest::accept()
+{
+ d_ptr->accept();
+}
+
+void QQuickWebEngineQuotaPermissionRequest::reject()
+{
+ d_ptr->cancel();
+}
+
+QUrl QQuickWebEngineQuotaPermissionRequest::origin() const
+{
+ return d_ptr->origin();
+}
+
+qint64 QQuickWebEngineQuotaPermissionRequest::requestedSize() const
+{
+ return d_ptr->requestedSize();
+}
+
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index ae0523460..57f74ad01 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -56,6 +56,12 @@
#include <QQuickItem>
#include <QtGui/qcolor.h>
+
+namespace QtWebEngineCore {
+ class QuotaPermissionController;
+}
+
+
QT_BEGIN_NAMESPACE
class QQmlWebChannel;
@@ -98,6 +104,26 @@ private:
const bool m_toggleOn;
};
+class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineQuotaPermissionRequest {
+ Q_GADGET
+ Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL)
+ Q_PROPERTY(qint64 requestedSize READ requestedSize CONSTANT FINAL)
+public:
+ QQuickWebEngineQuotaPermissionRequest() {}
+ QQuickWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller);
+ ~QQuickWebEngineQuotaPermissionRequest();
+
+ Q_INVOKABLE void accept();
+ Q_INVOKABLE void reject();
+ QUrl origin() const;
+ qint64 requestedSize() const;
+
+private:
+ QSharedPointer<QtWebEngineCore::QuotaPermissionController> d_ptr;
+};
+
+#define LATEST_WEBENGINEVIEW_REVISION 7
+
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_OBJECT
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged FINAL)
@@ -529,6 +555,7 @@ Q_SIGNALS:
Q_REVISION(4) void fileDialogRequested(QQuickWebEngineFileDialogRequest *request);
Q_REVISION(4) void formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest *request);
Q_REVISION(5) void pdfPrintingFinished(const QString &filePath, bool success);
+ Q_REVISION(7) void quotaPermissionRequested(const QQuickWebEngineQuotaPermissionRequest &request);
#ifdef ENABLE_QML_TESTSUPPORT_API
void testSupportChanged();
@@ -557,5 +584,6 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickWebEngineView)
Q_DECLARE_METATYPE(QQuickWebEngineFullScreenRequest)
+Q_DECLARE_METATYPE(QQuickWebEngineQuotaPermissionRequest)
#endif // QQUICKWEBENGINEVIEW_P_H
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 19ecf5e1f..af19c7765 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -129,6 +129,7 @@ public:
virtual void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) Q_DECL_OVERRIDE;
virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE;
virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
+ virtual void runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController>) Q_DECL_OVERRIDE;
virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE;
virtual QtWebEngineCore::WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE;
virtual void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) Q_DECL_OVERRIDE;
diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc
index e14448aa4..fead1b443 100644
--- a/src/webengine/doc/src/webengineview.qdoc
+++ b/src/webengine/doc/src/webengineview.qdoc
@@ -1297,3 +1297,61 @@
/*! \qmlsignal WebEngineView::navigationRequested(WebEngineNavigationRequest request)
This signal is emitted when the navigation request \a request is issued.
*/
+
+/*!
+ \qmlsignal WebEngineView::quotaPermissionRequested(QuotaPermissionRequest request)
+ \since QtWebEngine 1.7
+
+ This signal is emitted when the web page requests larger persistent storage
+ than the application's current allocation in File System API. The default quota
+ is 0 bytes.
+
+ \sa QuotaPermissionRequest
+*/
+
+/*!
+ \qmltype QuotaPermissionRequest
+ \instantiates QQuickWebEngineQuotaPermissionRequest
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.7
+
+ \brief A utility type for the WebEngineView::quotaPermissionRequested() signal.
+
+ \sa WebEngineView::quotaPermissionRequested()
+*/
+
+/*!
+ \qmlproperty url QuotaPermissionRequest::origin
+ \readonly
+
+ The URL of the web page that issued the quota permission request.
+*/
+
+/*!
+ \qmlproperty qint64 QuotaPermissionRequest::requestedSize
+ \readonly
+
+ Contains the size of the requested disk space in bytes.
+*/
+
+/*!
+ \qmlmethod void QuotaPermissionRequest::accept()
+
+ Accepts the quota permission request.
+
+ \qml
+ WebEngineView {
+ onQuotaPermissionRequested: function(request) {
+ if (request.requestedSize <= 5 * 1024 * 1024)
+ request.accept();
+ else
+ request.reject();
+ }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlmethod void QuotaPermissionRequest::reject()
+ Rejects a quota permission request.
+*/
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 5ab792699..ddd748f41 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -133,6 +133,8 @@ public:
msgUncreatableType("FileDialogRequest"));
qmlRegisterUncreatableType<QQuickWebEngineFormValidationMessageRequest>(uri, 1, 4, "FormValidationMessageRequest",
msgUncreatableType("FormValidationMessageRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineQuotaPermissionRequest>(uri, 1, 7, "QuotaPermissionRequest",
+ tr("Cannot create a separate instance of QuotaPermissionRequest"));
}
private:
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 178f6ec98..41034e43c 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -53,6 +53,7 @@
#include "qwebenginehistory_p.h"
#include "qwebengineprofile.h"
#include "qwebengineprofile_p.h"
+#include "qwebenginequotapermissionrequest.h"
#include "qwebenginescriptcollection_p.h"
#include "qwebenginesettings.h"
#include "qwebengineview.h"
@@ -579,6 +580,13 @@ void QWebEnginePagePrivate::runMouseLockPermissionRequest(const QUrl &securityOr
Q_EMIT q->featurePermissionRequested(securityOrigin, QWebEnginePage::MouseLock);
}
+void QWebEnginePagePrivate::runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+{
+ Q_Q(QWebEnginePage);
+ QWebEngineQuotaPermissionRequest request(controller);
+ Q_EMIT q->quotaPermissionRequested(request);
+}
+
QObject *QWebEnginePagePrivate::accessibilityParentObject()
{
return view;
@@ -740,6 +748,17 @@ QWebEnginePage::QWebEnginePage(QObject* parent)
*/
/*!
+ \fn QWebEnginePage::quotaPermissionRequested(QWebEngineQuotaPermissionRequest request)
+ \since 5.11
+
+ This signal is emitted when the web page requests larger persistent storage
+ than the application's current allocation in File System API. The default quota
+ is 0 bytes.
+
+ The request object \a request can be used to accept or reject the request.
+*/
+
+/*!
\fn void QWebEnginePage::pdfPrintingFinished(const QString &filePath, bool success)
\since 5.9
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index 295527e74..3fad6ca09 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -64,6 +64,7 @@ class QWebEngineHistory;
class QWebEnginePage;
class QWebEnginePagePrivate;
class QWebEngineProfile;
+class QWebEngineQuotaPermissionRequest;
class QWebEngineScriptCollection;
class QWebEngineSettings;
@@ -330,6 +331,7 @@ Q_SIGNALS:
void featurePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
void featurePermissionRequestCanceled(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
+ void quotaPermissionRequested(QWebEngineQuotaPermissionRequest quotaPermissionRequest);
void authenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator);
void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator, const QString &proxyHost);
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index ec84f05e1..0f18f8d8a 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -126,6 +126,7 @@ public:
virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE;
virtual void runGeolocationPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
+ virtual void runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController>) Q_DECL_OVERRIDE;
virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE;
virtual QtWebEngineCore::WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE;
virtual void allowCertificateError(const QSharedPointer<CertificateErrorController> &controller) Q_DECL_OVERRIDE;
diff --git a/src/webenginewidgets/api/qwebenginequotapermissionrequest.cpp b/src/webenginewidgets/api/qwebenginequotapermissionrequest.cpp
new file mode 100644
index 000000000..0841854ea
--- /dev/null
+++ b/src/webenginewidgets/api/qwebenginequotapermissionrequest.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwebenginequotapermissionrequest.h"
+
+#include "quota_permission_controller.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QWebEngineQuotaPermissionRequest
+ \brief The QWebEngineQuotaPermissionRequest class enables accepting or rejecting
+ requests for larger persistent storage than the application's current allocation
+ in File System API.
+
+ \since 5.11
+
+ \inmodule QtWebEngineWidgets
+*/
+
+QWebEngineQuotaPermissionRequest::QWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+ : d_ptr(controller)
+{
+}
+
+/*!
+ Rejects a request for larger persistent storage.
+*/
+void QWebEngineQuotaPermissionRequest::reject()
+{
+ d_ptr->cancel();
+}
+
+/*!
+ Accepts a request for larger persistent storage.
+*/
+void QWebEngineQuotaPermissionRequest::accept()
+{
+ d_ptr->accept();
+}
+
+/*!
+ \property QWebEngineQuotaPermissionRequest::origin
+ \brief The URL of the web page that issued the quota permission request.
+*/
+
+QUrl QWebEngineQuotaPermissionRequest::origin() const
+{
+ return d_ptr->origin();
+}
+
+/*!
+ \property QWebEngineQuotaPermissionRequest::requestedSize
+ \brief Contains the size of the requested disk space in bytes.
+*/
+
+qint64 QWebEngineQuotaPermissionRequest::requestedSize() const
+{
+ return d_ptr->requestedSize();
+}
+
+QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginequotapermissionrequest.h b/src/webenginewidgets/api/qwebenginequotapermissionrequest.h
new file mode 100644
index 000000000..aa0184fad
--- /dev/null
+++ b/src/webenginewidgets/api/qwebenginequotapermissionrequest.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWEBENGINEQUOTAPERMISSIONREQUEST_H
+#define QWEBENGINEQUOTAPERMISSIONREQUEST_H
+
+#include <QtCore/qsharedpointer.h>
+#include <QtCore/qurl.h>
+#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+
+namespace QtWebEngineCore {
+ class QuotaPermissionController;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QWEBENGINEWIDGETS_EXPORT QWebEngineQuotaPermissionRequest {
+ Q_GADGET
+ Q_PROPERTY(QUrl origin READ origin)
+ Q_PROPERTY(qint64 requestedSize READ requestedSize)
+public:
+ Q_INVOKABLE void accept();
+ Q_INVOKABLE void reject();
+ QUrl origin() const;
+ qint64 requestedSize() const;
+
+private:
+ QWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller);
+ QSharedPointer<QtWebEngineCore::QuotaPermissionController> d_ptr;
+ friend class QWebEnginePagePrivate;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWEBENGINEQUOTAPERMISSIONREQUEST_H
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index ad79c1ef9..96341d58c 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -17,6 +17,7 @@ SOURCES = \
api/qwebenginehistory.cpp \
api/qwebenginepage.cpp \
api/qwebengineprofile.cpp \
+ api/qwebenginequotapermissionrequest.cpp \
api/qwebenginescript.cpp \
api/qwebenginescriptcollection.cpp \
api/qwebenginesettings.cpp \
@@ -35,6 +36,7 @@ HEADERS = \
api/qwebenginepage_p.h \
api/qwebengineprofile.h \
api/qwebengineprofile_p.h \
+ api/qwebenginequotapermissionrequest.h \
api/qwebenginescriptcollection.h \
api/qwebenginescriptcollection_p.h \
api/qwebenginesettings.h \
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 5cc0d18df..7d793f1b3 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -66,6 +66,7 @@ static QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *>()
<< &QQuickWebEngineScript::staticMetaObject
<< &QQuickWebEngineSettings::staticMetaObject
<< &QQuickWebEngineFullScreenRequest::staticMetaObject
+ << &QQuickWebEngineQuotaPermissionRequest::staticMetaObject
<< &QQuickWebEngineSingleton::staticMetaObject
<< &QQuickWebEngineAuthenticationDialogRequest::staticMetaObject
<< &QQuickWebEngineJavaScriptDialogRequest::staticMetaObject
@@ -183,6 +184,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString) --> void"
<< "QQuickWebEngineView.certificateError(QQuickWebEngineCertificateError*) --> void"
<< "QQuickWebEngineView.fullScreenRequested(QQuickWebEngineFullScreenRequest) --> void"
+ << "QQuickWebEngineView.quotaPermissionRequested(QQuickWebEngineQuotaPermissionRequest) --> void"
<< "QQuickWebEngineView.isFullScreenChanged() --> void"
<< "QQuickWebEngineView.featurePermissionRequested(QUrl,Feature) --> void"
<< "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void"
@@ -529,6 +531,10 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineFullScreenRequest.toggleOn --> bool"
<< "QQuickWebEngineFullScreenRequest.accept() --> void"
<< "QQuickWebEngineFullScreenRequest.reject() --> void"
+ << "QQuickWebEngineQuotaPermissionRequest.origin --> QUrl"
+ << "QQuickWebEngineQuotaPermissionRequest.requestedSize --> qlonglong"
+ << "QQuickWebEngineQuotaPermissionRequest.accept() --> void"
+ << "QQuickWebEngineQuotaPermissionRequest.reject() --> void"
<< "QQuickWebEngineSingleton.settings --> QQuickWebEngineSettings*"
<< "QQuickWebEngineSingleton.defaultProfile --> QQuickWebEngineProfile*"
;
diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml
index a7d890072..25d9c8a3e 100644
--- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml
+++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml
@@ -28,7 +28,7 @@
import QtQuick 2.0
import QtTest 1.1
-import QtWebEngine 1.3
+import QtWebEngine 1.7
WebEngineView {
property var loadStatus: null
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index bea44f73c..8a5c61878 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -47,6 +47,7 @@
#include <qwebenginehistory.h>
#include <qwebenginepage.h>
#include <qwebengineprofile.h>
+#include <qwebenginequotapermissionrequest.h>
#include <qwebenginescript.h>
#include <qwebenginescriptcollection.h>
#include <qwebenginesettings.h>
@@ -165,6 +166,7 @@ private Q_SLOTS:
void runJavaScript();
void fullScreenRequested();
+ void quotaPermissionRequested();
// Tests from tst_QWebEngineFrame
@@ -3074,6 +3076,46 @@ void tst_QWebEnginePage::fullScreenRequested()
QVERIFY(watcher.wait());
}
+void tst_QWebEnginePage::quotaPermissionRequested()
+{
+ ConsolePage page;
+ QWebEngineView view;
+ view.setPage(&page);
+ QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
+ page.load(QUrl("qrc:///resources/content.html"));
+ QVERIFY(loadFinishedSpy.wait());
+
+ connect(&page, &QWebEnginePage::quotaPermissionRequested,
+ [] (QWebEngineQuotaPermissionRequest request)
+ {
+ if (request.requestedSize() <= 5000)
+ request.accept();
+ else
+ request.reject();
+ });
+
+ evaluateJavaScriptSync(&page,
+ "navigator.webkitPersistentStorage.requestQuota(1024, function(grantedSize) {" \
+ "console.log(grantedSize);" \
+ "});");
+ QTRY_COMPARE(page.messages.count(), 1);
+ QTRY_COMPARE(page.messages[0], QString("1024"));
+
+ evaluateJavaScriptSync(&page,
+ "navigator.webkitPersistentStorage.requestQuota(6000, function(grantedSize) {" \
+ "console.log(grantedSize);" \
+ "});");
+ QTRY_COMPARE(page.messages.count(), 2);
+ QTRY_COMPARE(page.messages[1], QString("1024"));
+
+ evaluateJavaScriptSync(&page,
+ "navigator.webkitPersistentStorage.queryUsageAndQuota(function(usedBytes, grantedBytes) {" \
+ "console.log(usedBytes + ', ' + grantedBytes);" \
+ "});");
+ QTRY_COMPARE(page.messages.count(), 3);
+ QTRY_COMPARE(page.messages[2], QString("0, 1024"));
+}
+
void tst_QWebEnginePage::symmetricUrl()
{
QWebEngineView view;