summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.6.074
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml19
-rw-r--r--examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc106
-rw-r--r--examples/webenginewidgets/demobrowser/downloaditem.ui11
-rw-r--r--examples/webenginewidgets/demobrowser/fullscreennotification.h3
-rw-r--r--examples/webenginewidgets/demobrowser/searchlineedit.cpp4
-rw-r--r--examples/webenginewidgets/demobrowser/tabwidget.cpp76
-rw-r--r--examples/webenginewidgets/demobrowser/tabwidget.h8
-rw-r--r--examples/webenginewidgets/demobrowser/urllineedit.cpp12
-rw-r--r--examples/webenginewidgets/demobrowser/urllineedit.h2
m---------src/3rdparty0
-rw-r--r--src/core/api/core_api.pro2
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp (renamed from src/webengine/api/qquickwebengineprofile_p_p.h)86
-rw-r--r--src/core/api/qtwebenginecoreglobal.h4
-rw-r--r--src/core/api/qwebenginecallback.h2
-rw-r--r--src/core/api/qwebenginecallback_p.h11
-rw-r--r--src/core/api/qwebenginecookiestore.cpp14
-rw-r--r--src/core/api/qwebenginecookiestore.h5
-rw-r--r--src/core/api/qwebenginecookiestore_p.h10
-rw-r--r--src/core/api/qwebengineurlrequestinfo.cpp3
-rw-r--r--src/core/api/qwebengineurlrequestinfo.h2
-rw-r--r--src/core/api/qwebengineurlrequestinfo_p.h11
-rw-r--r--src/core/api/qwebengineurlrequestinterceptor.h4
-rw-r--r--src/core/api/qwebengineurlrequestjob.h2
-rw-r--r--src/core/api/qwebengineurlschemehandler.h2
-rw-r--r--src/core/browser_context_adapter.cpp1
-rw-r--r--src/core/browser_context_adapter_client.h1
-rw-r--r--src/core/browser_context_qt.cpp4
-rw-r--r--src/core/browser_context_qt.h2
-rw-r--r--src/core/content_browser_client_qt.cpp2
-rw-r--r--src/core/content_client_qt.cpp19
-rw-r--r--src/core/cookie_monster_delegate_qt.cpp18
-rw-r--r--src/core/core.pro6
-rw-r--r--src/core/core_common.pri2
-rw-r--r--src/core/core_gyp_generator.pro1
-rw-r--r--src/core/core_headers.pro5
-rw-r--r--src/core/core_module.pro6
-rw-r--r--src/core/download_manager_delegate_qt.cpp29
-rw-r--r--src/core/gyp_run.pro2
-rw-r--r--src/core/render_widget_host_view_qt.cpp4
-rw-r--r--src/core/resources/resources.gyp6
-rw-r--r--src/core/url_request_context_getter_qt.cpp133
-rw-r--r--src/core/url_request_context_getter_qt.h9
-rw-r--r--src/core/web_contents_adapter_client.h1
-rw-r--r--src/core/web_engine_context.cpp18
-rw-r--r--src/core/web_engine_library_info.cpp58
-rw-r--r--src/webengine/api/qquickwebenginecertificateerror.cpp22
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem.cpp16
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem_p.h3
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem_p_p.h3
-rw-r--r--src/webengine/api/qquickwebenginehistory.cpp4
-rw-r--r--src/webengine/api/qquickwebengineloadrequest.cpp2
-rw-r--r--src/webengine/api/qquickwebenginenewviewrequest.cpp2
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp277
-rw-r--r--src/webengine/api/qquickwebengineprofile.h161
-rw-r--r--src/webengine/api/qquickwebengineprofile_p.h108
-rw-r--r--src/webengine/api/qquickwebenginescript.cpp1
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp2
-rw-r--r--src/webengine/api/qquickwebenginesingleton.cpp4
-rw-r--r--src/webengine/api/qquickwebengineview.cpp112
-rw-r--r--src/webengine/api/qquickwebengineview_p.h5
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h5
-rw-r--r--src/webengine/api/qtwebengineglobal.cpp52
-rw-r--r--src/webengine/doc/qtwebengine.qdocconf1
-rw-r--r--src/webengine/doc/src/external-resources.qdoc10
-rw-r--r--src/webengine/doc/src/qtwebengine-modules.qdoc3
-rw-r--r--src/webengine/doc/src/qtwebengine-overview.qdoc11
-rw-r--r--src/webengine/doc/src/qtwebengine-platform-notes.qdoc45
-rw-r--r--src/webengine/doc/src/qtwebengine-qmlmodule.qdoc2
-rw-r--r--src/webengine/doc/src/webengineview.qdoc4
-rw-r--r--src/webengine/plugin/plugin.cpp4
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp11
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h1
-rw-r--r--src/webengine/ui_delegates_manager.cpp8
-rw-r--r--src/webengine/webengine.pro2
-rw-r--r--src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp8
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp12
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.h1
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem_p.h1
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp22
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h2
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp1
-rw-r--r--src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc11
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp6
-rw-r--r--src/webenginewidgets/webenginewidgets.pro2
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp8
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml12
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadUrl.qml2
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp61
-rw-r--r--tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp6
-rw-r--r--tests/auto/quick/quick.pro3
-rw-r--r--tests/auto/widgets/qwebengineaccessibility/BLACKLIST6
-rw-r--r--tests/auto/widgets/qwebenginepage/BLACKLIST5
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp25
-rw-r--r--tests/auto/widgets/tests.pri4
-rw-r--r--tests/quicktestbrowser/main.cpp14
-rw-r--r--tools/qmake/mkspecs/features/functions.prf8
98 files changed, 1405 insertions, 498 deletions
diff --git a/dist/changes-5.6.0 b/dist/changes-5.6.0
new file mode 100644
index 000000000..f60338bfd
--- /dev/null
+++ b/dist/changes-5.6.0
@@ -0,0 +1,74 @@
+Qt 5.6 introduces many new features and improvements as well as bugfixes
+over the 5.5.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+ http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.6 series is binary compatible with the 5.5.x series.
+Applications compiled for 5.5 will continue to run with 5.6.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* General *
+****************************************************************************
+
+ - Chromium Snapshot:
+ * The Chromium version has been updated to 45.0.2554.101.
+ * In addition security fixes from Chromium 46 and 47 have been merged.
+
+ - General:
+ * The WebEngineCore module now contains shared C++ API.
+ * Will now follow Qt Network application proxy settings.
+
+ - Platforms:
+ * Linux builds can now link against system libraries instead of Chromium's
+ bundled versions.
+ * Support for the Aarch64 architecture.
+
+ - Web Features:
+ * PPAPI plugins are now supported, including the Flash plugin.
+
+****************************************************************************
+* Qt WebEngineCore *
+****************************************************************************
+
+ - QWebEngineCookieStore:
+ * A new API for monitoring and controlling cookies.
+
+ - QWebEngineUrlRequestInterceptor:
+ * A new API for blocking, modifying or redirecting URL requests.
+
+ - QWebEngineUrlSchemeHandler:
+ * A new API for implementing custom URL schemes.
+
+****************************************************************************
+* Qt WebEngineQML *
+****************************************************************************
+
+ - QQuickWebEngineProfile:
+ * Now a public C++ API for use with the new core APIs.
+
+ - QQuickWebEngineView:
+ * WebAction API added.
+
+
+****************************************************************************
+* Qt WebEngineWidgets *
+****************************************************************************
+
+ - QWebEnginePage:
+ * More WebActions added from the old QWebPage API.
+
+****************************************************************************
+* Examples *
+****************************************************************************
+
+ - General:
+ * Examples have been renamed to make their purpose more clear.
diff --git a/examples/examples.pro b/examples/examples.pro
index c93886989..fdd25664f 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -6,7 +6,7 @@ qtHaveModule(webengine) {
qtHaveModule(webenginewidgets) {
SUBDIRS += \
- webenginewidgets/demobrowser \
webenginewidgets/contentmanipulation \
+ webenginewidgets/demobrowser \
webenginewidgets/markdowneditor
}
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index e8a9cb9ce..ed49040ca 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -54,18 +54,6 @@ ApplicationWindow {
property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item : null
property int previousVisibility: Window.Windowed
- property bool isFullScreen: visibility == Window.FullScreen
- onIsFullScreenChanged: {
- // This is for the case where the system forces us to leave fullscreen.
- if (currentWebView && !isFullScreen) {
- currentWebView.state = ""
- if (currentWebView.isFullScreen) {
- currentWebView.fullScreenCancelled()
- fullScreenNotification.hide()
- }
- }
- }
-
width: 1300
height: 900
visible: true
@@ -127,8 +115,11 @@ ApplicationWindow {
Action {
shortcut: "Escape"
onTriggered: {
- if (browserWindow.isFullScreen)
+ if (currentWebView.state == "FullScreen") {
browserWindow.visibility = browserWindow.previousVisibility
+ fullScreenNotification.hide()
+ currentWebView.triggerWebAction(WebEngineView.ExitFullScreen);
+ }
}
}
Action {
@@ -271,7 +262,7 @@ ApplicationWindow {
id: pluginsEnabled
text: "Plugins On"
checkable: true
- checked: WebEngine.settings.pluginsEnabled
+ checked: true
}
MenuItem {
id: fullScreenSupportEnabled
diff --git a/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc b/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc
index 211951929..3643cfce7 100644
--- a/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc
+++ b/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc
@@ -31,11 +31,109 @@
\ingroup webengine-examples
\brief A web browser implemented using the WebEngineView QML type.
- The Quick Nano Browser demo shows the \l{Qt WebEngine} module in action,
- providing a little QML web browser with support for tabs and keyboard
- shortcuts.
-
\image quicknanobrowser-demo.jpg
+ \e {Quick Nano Browser} demonstrates how to use the \l{Qt WebEngine QML Types}
+ {Qt WebEngine QML types} to develop a small web browser application that consists of a browser
+ window with a title bar, toolbar, tab view, and status bar. The web content is loaded in a web
+ engine view within the tab view. If certificate errors occur, users are prompted for action in a
+ message dialog. The status bar pops up to display the URL of a hovered link.
+
+ A web page can issue a request for being displayed in fullscreen mode. Users can allow full
+ screen mode by using a toolbar button. They can leave fullscreen mode by using a keyboard
+ shortcut. Additional toolbar buttons enable moving backwards and forwards in the browser
+ history, reloading tab content, and opening a settings menu for enabling the following features:
+ JavaScript, plugins, fullscreen mode, off the record, HTTP disc cache, autoloading images, and
+ ignoring certificate errors.
+
\include examples-run.qdocinc
+
+ \section1 Creating the Main Browser Window
+
+ When the browser main window is loaded, it creates an empty tab using the default profile. Each
+ tab is a web engine view that fills the main window.
+
+ We create the main window in the \e BrowserWindow.qml file using the ApplicationWindow type:
+
+ \quotefromfile webengine/quicknanobrowser/BrowserWindow.qml
+ \skipto ApplicationWindow
+ \printuntil currentWebView
+ \dots
+ \skipto width
+ \printuntil title
+
+ We use the TabView Qt Quick control to create an empty tab view that fills the main window. We
+ set the tab active first, to make sure that the tab item is immediately instantiated:
+
+ \skipto TabView
+ \printuntil Component.onCompleted
+
+ The tab contains a web engine view that loads web content:
+
+ \printuntil focus
+
+ We use the \l Action type to create new tabs:
+
+ \quotefromfile webengine/quicknanobrowser/BrowserWindow.qml
+ \skipto reload
+ \skipto Action
+ \printuntil }
+
+ We use the \l TextField Qt Quick Control within a \l ToolBar to create an address bar that
+ shows the current URL and where users can enter another URL:
+
+ \skipto toolBar
+ \printuntil anchors.fill
+ \dots
+ \skipto TextField
+ \printuntil addressBar
+ \dots
+ \skipto focus
+ \printuntil /^\ {16}\}/
+
+ \section1 Handling Certificate Errors
+
+ If the certificate of the site being loaded triggers a certificate error, we call the
+ \l{WebEngineCertificateError::}{defer()} QML method to pause the URL request and wait for user
+ input:
+
+ \quotefromfile webengine/quicknanobrowser/BrowserWindow.qml
+ \skipto onCertificateError
+ \printuntil }
+
+ We use the MessageDialog type to prompt users to continue or cancel the loading of the web page.
+ If users select \uicontrol Yes, we call the
+ \l{WebEngineCertificateError::}{ignoreCertificateError()} method to ignore the error and
+ continue loading content from the URL. If users select \uicontrol No, we call the
+ \l{WebEngineCertificateError::}{rejectCertificate()} method to reject the request and stop
+ loading content from the URL:
+
+ \skipto MessageDialog
+ \printuntil /^\ {4}\}/
+
+ \section1 Entering and Leaving Fullscreen Mode
+
+ We create a menu item for allowing fullscreen mode in a settings menu that we place on the tool
+ bar. Also, we create an action for leaving fullscreen mode by using a keyboard shortcut.
+ We call the \l{WebEngineFullScreenRequest::}{accept()} method to accept the fullscreen request.
+ The methdod sets the \l{WebEngineView::}{isFullScreen} property to be equal to the
+ \l{WebEngineFullScreenRequest::}{toggleOn} property.
+
+ \quotefromfile webengine/quicknanobrowser/BrowserWindow.qml
+ \skipto onFullScreenRequested
+ \printuntil /^\ {16}\}/
+
+ When entering fullscreen mode, we display a notification using the FullScreenNotification custom
+ type that we create in \e FullScreenNotification.qml.
+
+ We use the \l Action type in the settings menu to create a shortcut for leaving fullscreen mode
+ by pressing the escape key:
+
+ \quotefromfile webengine/quicknanobrowser/BrowserWindow.qml
+ \skipto Settings
+ \printuntil appSettings
+ \skipto fullScreenSupportEnabled
+ \printuntil Action
+ \skipto Escape
+ \printuntil /^\ {4}\}/
*/
diff --git a/examples/webenginewidgets/demobrowser/downloaditem.ui b/examples/webenginewidgets/demobrowser/downloaditem.ui
index b7f7deb72..e506f28b6 100644
--- a/examples/webenginewidgets/demobrowser/downloaditem.ui
+++ b/examples/webenginewidgets/demobrowser/downloaditem.ui
@@ -13,7 +13,16 @@
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" >
- <property name="margin" >
+ <property name="leftMargin">
+ <number>5</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>5</number>
+ </property>
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
diff --git a/examples/webenginewidgets/demobrowser/fullscreennotification.h b/examples/webenginewidgets/demobrowser/fullscreennotification.h
index 051075ab3..f515bfecb 100644
--- a/examples/webenginewidgets/demobrowser/fullscreennotification.h
+++ b/examples/webenginewidgets/demobrowser/fullscreennotification.h
@@ -44,9 +44,11 @@
#include <QWidget>
+QT_BEGIN_NAMESPACE
class QLabel;
class QGridLayout;
class QPropertyAnimation;
+QT_END_NAMESPACE
class FullScreenNotification : public QWidget
{
@@ -72,5 +74,4 @@ private:
int y;
};
-
#endif // FULLSCREENNOTIFICATION_H
diff --git a/examples/webenginewidgets/demobrowser/searchlineedit.cpp b/examples/webenginewidgets/demobrowser/searchlineedit.cpp
index 5152ac1c0..1573b1046 100644
--- a/examples/webenginewidgets/demobrowser/searchlineedit.cpp
+++ b/examples/webenginewidgets/demobrowser/searchlineedit.cpp
@@ -45,7 +45,7 @@
#include <QtGui/QMouseEvent>
#include <QtWidgets/QMenu>
#include <QtWidgets/QStyle>
-#include <QtWidgets/QStyleOptionFrameV2>
+#include <QtWidgets/QStyleOptionFrame>
ClearButton::ClearButton(QWidget *parent)
: QAbstractButton(parent)
@@ -181,7 +181,7 @@ void SearchLineEdit::paintEvent(QPaintEvent *event)
{
if (lineEdit()->text().isEmpty() && !hasFocus() && !m_inactiveText.isEmpty()) {
ExLineEdit::paintEvent(event);
- QStyleOptionFrameV2 panel;
+ QStyleOptionFrame panel;
initStyleOption(&panel);
QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
QFontMetrics fm = fontMetrics();
diff --git a/examples/webenginewidgets/demobrowser/tabwidget.cpp b/examples/webenginewidgets/demobrowser/tabwidget.cpp
index 23903e88a..b744fad90 100644
--- a/examples/webenginewidgets/demobrowser/tabwidget.cpp
+++ b/examples/webenginewidgets/demobrowser/tabwidget.cpp
@@ -171,7 +171,17 @@ void TabBar::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
m_dragStartPos = event->pos();
+
QTabBar::mousePressEvent(event);
+
+ // Middle click on tab should close it.
+ if (event->button() == Qt::MiddleButton) {
+ const QPoint pos = event->pos();
+ int index = tabAt(pos);
+ if (index != -1) {
+ emit closeTab(index);
+ }
+ }
}
void TabBar::mouseMoveEvent(QMouseEvent *event)
@@ -259,6 +269,7 @@ TabWidget::TabWidget(QWidget *parent)
connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
connect(m_tabBar, SIGNAL(tabMoved(int,int)), this, SLOT(moveTab(int,int)));
+ connect(m_tabBar, SIGNAL(tabBarDoubleClicked(int)), this, SLOT(handleTabBarDoubleClicked(int)));
connect(m_tabBar, SIGNAL(muteTab(int,bool)), this, SLOT(setAudioMutedForTab(int,bool)));
setTabBar(m_tabBar);
setDocumentMode(true);
@@ -427,6 +438,12 @@ void TabWidget::fullScreenRequested(QWebEngineFullScreenRequest request)
}
}
+void TabWidget::handleTabBarDoubleClicked(int index)
+{
+ if (index != -1) return;
+ newTab();
+}
+
QAction *TabWidget::newTabAction() const
{
return m_newTabAction;
@@ -500,6 +517,36 @@ int TabWidget::webViewIndex(WebView *webView) const
return index;
}
+void TabWidget::setupPage(QWebEnginePage* page)
+{
+ connect(page, SIGNAL(windowCloseRequested()),
+ this, SLOT(windowCloseRequested()));
+ connect(page, SIGNAL(geometryChangeRequested(QRect)),
+ this, SIGNAL(geometryChangeRequested(QRect)));
+#if defined(QWEBENGINEPAGE_PRINTREQUESTED)
+ connect(page, SIGNAL(printRequested(QWebEngineFrame*)),
+ this, SIGNAL(printRequested(QWebEngineFrame*)));
+#endif
+#if defined(QWEBENGINEPAGE_MENUBARVISIBILITYCHANGEREQUESTED)
+ connect(page, SIGNAL(menuBarVisibilityChangeRequested(bool)),
+ this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
+#endif
+#if defined(QWEBENGINEPAGE_STATUSBARVISIBILITYCHANGEREQUESTED)
+ connect(page, SIGNAL(statusBarVisibilityChangeRequested(bool)),
+ this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
+#endif
+#if defined(QWEBENGINEPAGE_TOOLBARVISIBILITYCHANGEREQUESTED)
+ connect(page, SIGNAL(toolBarVisibilityChangeRequested(bool)),
+ this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
+#endif
+
+ // webview actions
+ for (int i = 0; i < m_actions.count(); ++i) {
+ WebActionMapper *mapper = m_actions[i];
+ mapper->addChild(page->action(mapper->webAction()));
+ }
+}
+
WebView *TabWidget::newTab(bool makeCurrent)
{
// line edit
@@ -551,35 +598,13 @@ WebView *TabWidget::newTab(bool makeCurrent)
this, SLOT(webPageMutedOrAudibleChanged()));
connect(webView, SIGNAL(urlChanged(QUrl)),
this, SLOT(webViewUrlChanged(QUrl)));
- connect(webView->page(), SIGNAL(windowCloseRequested()),
- this, SLOT(windowCloseRequested()));
- connect(webView->page(), SIGNAL(geometryChangeRequested(QRect)),
- this, SIGNAL(geometryChangeRequested(QRect)));
-#if defined(QWEBENGINEPAGE_PRINTREQUESTED)
- connect(webView->page(), SIGNAL(printRequested(QWebEngineFrame*)),
- this, SIGNAL(printRequested(QWebEngineFrame*)));
-#endif
-#if defined(QWEBENGINEPAGE_MENUBARVISIBILITYCHANGEREQUESTED)
- connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
- this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
-#endif
-#if defined(QWEBENGINEPAGE_STATUSBARVISIBILITYCHANGEREQUESTED)
- connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
- this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
-#endif
-#if defined(QWEBENGINEPAGE_TOOLBARVISIBILITYCHANGEREQUESTED)
- connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
- this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
-#endif
+
+
addTab(webView, tr("(Untitled)"));
if (makeCurrent)
setCurrentWidget(webView);
- // webview actions
- for (int i = 0; i < m_actions.count(); ++i) {
- WebActionMapper *mapper = m_actions[i];
- mapper->addChild(webView->page()->action(mapper->webAction()));
- }
+ setupPage(webView->page());
if (count() == 1)
currentChanged(currentIndex());
@@ -685,6 +710,7 @@ void TabWidget::setProfile(QWebEngineProfile *profile)
QWidget *tabWidget = widget(i);
if (WebView *tab = qobject_cast<WebView*>(tabWidget)) {
WebPage* webPage = new WebPage(m_profile, tab);
+ setupPage(webPage);
webPage->load(tab->page()->url());
tab->setPage(webPage);
}
diff --git a/examples/webenginewidgets/demobrowser/tabwidget.h b/examples/webenginewidgets/demobrowser/tabwidget.h
index f4ad9c02d..c6eef58f9 100644
--- a/examples/webenginewidgets/demobrowser/tabwidget.h
+++ b/examples/webenginewidgets/demobrowser/tabwidget.h
@@ -131,13 +131,16 @@ private:
#include <QtCore/QUrl>
#include <QtWidgets/QTabWidget>
-QT_BEGIN_NAMESPACE
+
class FullScreenNotification;
+
+QT_BEGIN_NAMESPACE
class QCompleter;
class QLineEdit;
class QMenu;
class QStackedWidget;
QT_END_NAMESPACE
+
/*!
TabWidget that contains WebViews and a stack widget of associated line edits.
@@ -222,9 +225,12 @@ private slots:
void windowCloseRequested();
void moveTab(int fromIndex, int toIndex);
void fullScreenRequested(QWebEngineFullScreenRequest request);
+ void handleTabBarDoubleClicked(int index);
void webPageMutedOrAudibleChanged();
private:
+ void setupPage(QWebEnginePage* page);
+
QAction *m_recentlyClosedTabsAction;
QAction *m_newTabAction;
QAction *m_closeTabAction;
diff --git a/examples/webenginewidgets/demobrowser/urllineedit.cpp b/examples/webenginewidgets/demobrowser/urllineedit.cpp
index 685277d9c..0f4e59c4b 100644
--- a/examples/webenginewidgets/demobrowser/urllineedit.cpp
+++ b/examples/webenginewidgets/demobrowser/urllineedit.cpp
@@ -57,7 +57,7 @@
#include <QtGui/QDrag>
#include <QtGui/QPainter>
#include <QtWidgets/QStyle>
-#include <QtWidgets/QStyleOptionFrameV2>
+#include <QtWidgets/QStyleOptionFrame>
#include <QtCore/QDebug>
@@ -112,7 +112,7 @@ void ExLineEdit::resizeEvent(QResizeEvent *event)
void ExLineEdit::updateGeometries()
{
- QStyleOptionFrameV2 panel;
+ QStyleOptionFrame panel;
initStyleOption(&panel);
QRect rect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
@@ -131,7 +131,7 @@ void ExLineEdit::updateGeometries()
clearButtonWidth, this->height());
}
-void ExLineEdit::initStyleOption(QStyleOptionFrameV2 *option) const
+void ExLineEdit::initStyleOption(QStyleOptionFrame *option) const
{
option->initFrom(this);
option->rect = contentsRect();
@@ -144,7 +144,7 @@ void ExLineEdit::initStyleOption(QStyleOptionFrameV2 *option) const
if (hasEditFocus())
option->state |= QStyle::State_HasEditFocus;
#endif
- option->features = QStyleOptionFrameV2::None;
+ option->features = QStyleOptionFrame::None;
}
QSize ExLineEdit::sizeHint() const
@@ -189,7 +189,7 @@ bool ExLineEdit::event(QEvent *event)
void ExLineEdit::paintEvent(QPaintEvent *)
{
QPainter p(this);
- QStyleOptionFrameV2 panel;
+ QStyleOptionFrame panel;
initStyleOption(&panel);
style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);
}
@@ -322,7 +322,7 @@ void UrlLineEdit::paintEvent(QPaintEvent *event)
ExLineEdit::paintEvent(event);
QPainter painter(this);
- QStyleOptionFrameV2 panel;
+ QStyleOptionFrame panel;
initStyleOption(&panel);
QRect backgroundRect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
if (m_webView && !hasFocus()) {
diff --git a/examples/webenginewidgets/demobrowser/urllineedit.h b/examples/webenginewidgets/demobrowser/urllineedit.h
index 775aa7d18..b9f2cff7c 100644
--- a/examples/webenginewidgets/demobrowser/urllineedit.h
+++ b/examples/webenginewidgets/demobrowser/urllineedit.h
@@ -77,7 +77,7 @@ protected:
protected:
void updateGeometries();
- void initStyleOption(QStyleOptionFrameV2 *option) const;
+ void initStyleOption(QStyleOptionFrame *option) const;
QWidget *m_leftWidget;
QLineEdit *m_lineEdit;
diff --git a/src/3rdparty b/src/3rdparty
-Subproject 2279234ce87ac6b0402cb370051a0adeafa25b8
+Subproject e921076fcf1736db4aeb76877c6f608f42f4acc
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index d11994e98..19b67876c 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -5,6 +5,7 @@ TEMPLATE = lib
CONFIG += staticlib c++11
QT += network core-private
+QT_PRIVATE += webenginecoreheaders-private
# Don't create .prl file for this intermediate library because
# their contents get used when linking against them, breaking
@@ -42,6 +43,7 @@ HEADERS = \
qwebengineurlschemehandler.h
SOURCES = \
+ qtwebenginecoreglobal.cpp \
qwebenginecookiestore.cpp \
qwebengineurlrequestinfo.cpp \
qwebengineurlrequestjob.cpp \
diff --git a/src/webengine/api/qquickwebengineprofile_p_p.h b/src/core/api/qtwebenginecoreglobal.cpp
index 4df5f1934..0e857d7d9 100644
--- a/src/webengine/api/qquickwebengineprofile_p_p.h
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -34,55 +34,61 @@
**
****************************************************************************/
-#ifndef QQUICKWEBENGINEPROFILE_P_P_H
-#define QQUICKWEBENGINEPROFILE_P_P_H
+#include "qtwebenginecoreglobal_p.h"
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
+#include <QGuiApplication>
+#include <QOpenGLContext>
+#include <QThread>
-#include "browser_context_adapter_client.h"
-#include "qquickwebengineprofile_p.h"
+QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
+Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
+QT_END_NAMESPACE
-#include <QExplicitlySharedDataPointer>
-#include <QMap>
-#include <QPointer>
+namespace QtWebEngineCore {
-QT_BEGIN_NAMESPACE
+static QOpenGLContext *shareContext;
-class QQuickWebEngineDownloadItem;
-class QQuickWebEngineSettings;
+static void deleteShareContext()
+{
+ delete shareContext;
+ shareContext = 0;
+}
-class QQuickWebEngineProfilePrivate : public QtWebEngineCore::BrowserContextAdapterClient {
-public:
- Q_DECLARE_PUBLIC(QQuickWebEngineProfile)
- QQuickWebEngineProfilePrivate(QtWebEngineCore::BrowserContextAdapter* browserContext);
- ~QQuickWebEngineProfilePrivate();
+// ### Qt 6: unify this logic and Qt::AA_ShareOpenGLContexts.
+// QtWebEngine::initialize was introduced first and meant to be called
+// after the QGuiApplication creation, when AA_ShareOpenGLContexts fills
+// the same need but the flag has to be set earlier.
- QtWebEngineCore::BrowserContextAdapter *browserContext() const { return m_browserContextRef.data(); }
- QQuickWebEngineSettings *settings() const { return m_settings.data(); }
+QWEBENGINE_PRIVATE_EXPORT void initialize()
+{
+#ifdef Q_OS_WIN32
+ qputenv("QT_D3DCREATE_MULTITHREADED", "1");
+#endif
- void cancelDownload(quint32 downloadId);
- void downloadDestroyed(quint32 downloadId);
+ // No need to override the shared context if QApplication already set one (e.g with Qt::AA_ShareOpenGLContexts).
+ if (qt_gl_global_share_context())
+ return;
- void downloadRequested(DownloadItemInfo &info) Q_DECL_OVERRIDE;
- void downloadUpdated(const DownloadItemInfo &info) Q_DECL_OVERRIDE;
+ QCoreApplication *app = QCoreApplication::instance();
+ if (!app) {
+ qFatal("QtWebEngine::initialize() must be called after the construction of the application object.");
+ return;
+ }
+ if (app->thread() != QThread::currentThread()) {
+ qFatal("QtWebEngine::initialize() must be called from the Qt gui thread.");
+ return;
+ }
-private:
- friend class QQuickWebEngineViewPrivate;
- QQuickWebEngineProfile *q_ptr;
- QScopedPointer<QQuickWebEngineSettings> m_settings;
- QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef;
- QMap<quint32, QPointer<QQuickWebEngineDownloadItem> > m_ongoingDownloads;
-};
+ if (shareContext)
+ return;
-QT_END_NAMESPACE
+ shareContext = new QOpenGLContext;
+ shareContext->create();
+ qAddPostRoutine(deleteShareContext);
+ qt_gl_set_global_share_context(shareContext);
-#endif // QQUICKWEBENGINEPROFILE_P_P_H
+ // Classes like QOpenGLWidget check for the attribute
+ app->setAttribute(Qt::AA_ShareOpenGLContexts);
+}
+} // namespace QtWebEngineCore
diff --git a/src/core/api/qtwebenginecoreglobal.h b/src/core/api/qtwebenginecoreglobal.h
index 16daaab7d..a17b355eb 100644
--- a/src/core/api/qtwebenginecoreglobal.h
+++ b/src/core/api/qtwebenginecoreglobal.h
@@ -39,6 +39,8 @@
#include <QtCore/qglobal.h>
+QT_BEGIN_NAMESPACE
+
#if defined(BUILDING_CHROMIUM)
# define QWEBENGINE_EXPORT Q_DECL_EXPORT
#else
@@ -47,4 +49,6 @@
#define ASSERT_ENUMS_MATCH(A, B) Q_STATIC_ASSERT_X(static_cast<int>(A) == static_cast<int>(B), "The enum values must match");
+QT_END_NAMESPACE
+
#endif // QTWEBENGINECOREGLOBAL_H
diff --git a/src/core/api/qwebenginecallback.h b/src/core/api/qwebenginecallback.h
index b675438f5..a8758df7d 100644
--- a/src/core/api/qwebenginecallback.h
+++ b/src/core/api/qwebenginecallback.h
@@ -37,7 +37,7 @@
#ifndef QWEBENGINECALLBACK_H
#define QWEBENGINECALLBACK_H
-#include "qtwebenginecoreglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE
#include <QtCore/qshareddata.h>
diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h
index 9bc9b9727..348fed464 100644
--- a/src/core/api/qwebenginecallback_p.h
+++ b/src/core/api/qwebenginecallback_p.h
@@ -37,6 +37,17 @@
#ifndef QWEBENGINECALLBACK_P_H
#define QWEBENGINECALLBACK_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qtwebenginecoreglobal_p.h"
#include "qwebenginecallback.h"
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 51753e87b..2938eddbd 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -46,13 +46,12 @@ QT_BEGIN_NAMESPACE
using namespace QtWebEngineCore;
-QWebEngineCookieStorePrivate::QWebEngineCookieStorePrivate(QWebEngineCookieStore* q)
+QWebEngineCookieStorePrivate::QWebEngineCookieStorePrivate()
: m_nextCallbackId(CallbackDirectory::ReservedCallbackIdsEnd)
, m_deleteSessionCookiesPending(false)
, m_deleteAllCookiesPending(false)
, m_getAllCookiesPending(false)
, delegate(0)
- , q_ptr(q)
{
}
@@ -89,6 +88,14 @@ void QWebEngineCookieStorePrivate::processPendingUserCookies()
m_pendingUserCookies.clear();
}
+void QWebEngineCookieStorePrivate::rejectPendingUserCookies()
+{
+ m_getAllCookiesPending = false;
+ m_deleteAllCookiesPending = false;
+ m_deleteSessionCookiesPending = false;
+ m_pendingUserCookies.clear();
+}
+
void QWebEngineCookieStorePrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin)
{
const quint64 currentCallbackId = callback ? m_nextCallbackId++ : static_cast<quint64>(CallbackDirectory::NoCallbackId);
@@ -246,8 +253,7 @@ bool QWebEngineCookieStorePrivate::canSetCookie(const QUrl &firstPartyUrl, const
*/
QWebEngineCookieStore::QWebEngineCookieStore(QObject *parent)
- : QObject(parent)
- , d_ptr(new QWebEngineCookieStorePrivate(this))
+ : QObject(*new QWebEngineCookieStorePrivate, parent)
{
}
diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h
index 6cbe399f2..b78f885ef 100644
--- a/src/core/api/qwebenginecookiestore.h
+++ b/src/core/api/qwebenginecookiestore.h
@@ -37,8 +37,8 @@
#ifndef QWEBENGINECOOKIESTORE_H
#define QWEBENGINECOOKIESTORE_H
-#include "qtwebenginecoreglobal.h"
-#include "qwebenginecallback.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtWebEngineCore/qwebenginecallback.h>
#include <QtCore/qobject.h>
#include <QtCore/qscopedpointer.h>
@@ -94,7 +94,6 @@ private:
friend class QtWebEngineCore::CookieMonsterDelegateQt;
Q_DISABLE_COPY(QWebEngineCookieStore)
Q_DECLARE_PRIVATE(QWebEngineCookieStore)
- QScopedPointer<QWebEngineCookieStorePrivate> d_ptr;
};
QT_END_NAMESPACE
diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h
index d773c0d3e..348dcd69f 100644
--- a/src/core/api/qwebenginecookiestore_p.h
+++ b/src/core/api/qwebenginecookiestore_p.h
@@ -56,6 +56,7 @@
#include <QVector>
#include <QNetworkCookie>
#include <QUrl>
+#include <QtCore/private/qobject_p.h>
namespace QtWebEngineCore {
class CookieMonsterDelegateQt;
@@ -63,7 +64,9 @@ class CookieMonsterDelegateQt;
QT_BEGIN_NAMESPACE
-class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
+class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QWebEngineCookieStore)
struct CookieData {
quint64 callbackId;
QNetworkCookie cookie;
@@ -71,7 +74,6 @@ class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
};
friend class QTypeInfo<CookieData>;
public:
- Q_DECLARE_PUBLIC(QWebEngineCookieStore)
QtWebEngineCore::CallbackDirectory callbackDirectory;
QWebEngineCallback<QWebEngineCookieStore::FilterRequest&> filterCallback;
QVector<CookieData> m_pendingUserCookies;
@@ -81,11 +83,11 @@ public:
bool m_getAllCookiesPending;
QtWebEngineCore::CookieMonsterDelegateQt *delegate;
- QWebEngineCookieStore *q_ptr;
- QWebEngineCookieStorePrivate(QWebEngineCookieStore *q);
+ QWebEngineCookieStorePrivate();
void processPendingUserCookies();
+ void rejectPendingUserCookies();
void setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin);
void deleteCookie(const QNetworkCookie &cookie, const QUrl &url);
void deleteSessionCookies();
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index 79801d190..db5627acb 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -236,6 +236,9 @@ QByteArray QWebEngineUrlRequestInfo::requestMethod() const
return d->method;
}
+/*!
+ \internal
+*/
bool QWebEngineUrlRequestInfo::changed() const
{
Q_D(const QWebEngineUrlRequestInfo);
diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h
index 008df7751..9a13b3faf 100644
--- a/src/core/api/qwebengineurlrequestinfo.h
+++ b/src/core/api/qwebengineurlrequestinfo.h
@@ -37,7 +37,7 @@
#ifndef QWEBENGINEURLREQUESTINFO_H
#define QWEBENGINEURLREQUESTINFO_H
-#include "qtwebenginecoreglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qurl.h>
diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h
index df5f18d6e..c78a93613 100644
--- a/src/core/api/qwebengineurlrequestinfo_p.h
+++ b/src/core/api/qwebengineurlrequestinfo_p.h
@@ -37,6 +37,17 @@
#ifndef QWEBENGINEURLREQUESTINFO_P_H
#define QWEBENGINEURLREQUESTINFO_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qtwebenginecoreglobal_p.h"
#include "qwebengineurlrequestinfo.h"
diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h
index 372ee9066..a3b7cf979 100644
--- a/src/core/api/qwebengineurlrequestinterceptor.h
+++ b/src/core/api/qwebengineurlrequestinterceptor.h
@@ -37,8 +37,8 @@
#ifndef QWEBENINGEURLREQUESTINTERCEPTOR_H
#define QWEBENINGEURLREQUESTINTERCEPTOR_H
-#include "qtwebenginecoreglobal.h"
-#include "qwebengineurlrequestinfo.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtWebEngineCore/qwebengineurlrequestinfo.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qhash.h>
diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h
index fc9f4d911..922299fd9 100644
--- a/src/core/api/qwebengineurlrequestjob.h
+++ b/src/core/api/qwebengineurlrequestjob.h
@@ -37,7 +37,7 @@
#ifndef QWEBENGINEURLREQUESTJOB_H
#define QWEBENGINEURLREQUESTJOB_H
-#include "qtwebenginecoreglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qobject.h>
diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h
index fa24987c5..d9fc15250 100644
--- a/src/core/api/qwebengineurlschemehandler.h
+++ b/src/core/api/qwebengineurlschemehandler.h
@@ -37,7 +37,7 @@
#ifndef QWEBENGINEURLSCHEMEHANDLER_H
#define QWEBENGINEURLSCHEMEHANDLER_H
-#include "qtwebenginecoreglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qobject.h>
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 7d2d0478f..a8f704995 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -52,7 +52,6 @@
#include <QCoreApplication>
#include <QDir>
#include <QString>
-#include <QStringBuilder>
#include <QStandardPaths>
#include <numeric>
diff --git a/src/core/browser_context_adapter_client.h b/src/core/browser_context_adapter_client.h
index d237b25a1..5c0674a0a 100644
--- a/src/core/browser_context_adapter_client.h
+++ b/src/core/browser_context_adapter_client.h
@@ -72,6 +72,7 @@ public:
const int state;
const qint64 totalBytes;
const qint64 receivedBytes;
+ const QString mimeType;
QString path;
int savePageFormat;
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index 28486cced..d21f963a9 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -147,9 +147,9 @@ content::PermissionManager *BrowserContextQt::GetPermissionManager()
return permissionManager.get();
}
-net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers)
+net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors)
{
- url_request_getter_ = new URLRequestContextGetterQt(m_adapter, protocol_handlers);
+ url_request_getter_ = new URLRequestContextGetterQt(m_adapter, protocol_handlers, request_interceptors.Pass());
return url_request_getter_.get();
}
diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h
index eccd684a3..9deb42b56 100644
--- a/src/core/browser_context_qt.h
+++ b/src/core/browser_context_qt.h
@@ -72,7 +72,7 @@ public:
virtual storage::SpecialStoragePolicy *GetSpecialStoragePolicy() Q_DECL_OVERRIDE;
virtual content::PushMessagingService* GetPushMessagingService() Q_DECL_OVERRIDE;
virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() Q_DECL_OVERRIDE;
- net::URLRequestContextGetter *CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers);
+ net::URLRequestContextGetter *CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors);
virtual scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(const base::FilePath& partition_path) Q_DECL_OVERRIDE;
virtual content::PermissionManager *GetPermissionManager() Q_DECL_OVERRIDE;
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index c51996c78..61e0f3399 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -383,7 +383,7 @@ content::AccessTokenStore *ContentBrowserClientQt::CreateAccessTokenStore()
net::URLRequestContextGetter* ContentBrowserClientQt::CreateRequestContext(content::BrowserContext* browser_context, content::ProtocolHandlerMap* protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors)
{
- return static_cast<BrowserContextQt*>(browser_context)->CreateRequestContext(protocol_handlers);
+ return static_cast<BrowserContextQt*>(browser_context)->CreateRequestContext(protocol_handlers, request_interceptors.Pass());
}
content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionContext()
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 59991d558..8d7ea397b 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -49,7 +49,6 @@
#include <QCoreApplication>
#include <QFile>
-#include <QStringBuilder>
#if defined(ENABLE_PLUGINS)
#include "content/public/common/pepper_plugin_info.h"
@@ -105,20 +104,14 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, cons
void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins)
{
QStringList pluginPaths;
-#if defined(Q_OS_WIN) && defined(Q_PROCESSOR_X86_32)
+#if defined(Q_OS_WIN)
QString winDir = QDir::fromNativeSeparators(qgetenv("WINDIR"));
if (winDir.isEmpty())
winDir = QString::fromLatin1("C:/Windows");
-
- const QStringList pluginDirs = { winDir + "/SysWOW64/Macromed/Flash",
- winDir + "/System32/Macromed/Flash" };
- const QStringList nameFilters("pepflashplayer*.dll");
- Q_FOREACH (const QString &dirPath, pluginDirs) {
- QDir pluginDir(dirPath);
- pluginDir.setFilter(QDir::Files);
- Q_FOREACH (const QFileInfo &info, pluginDir.entryInfoList(nameFilters))
- pluginPaths << info.absoluteFilePath();
- }
+ QDir pluginDir(winDir + "/System32/Macromed/Flash");
+ pluginDir.setFilter(QDir::Files);
+ Q_FOREACH (const QFileInfo &info, pluginDir.entryInfoList(QStringList("pepflashplayer*.dll")))
+ pluginPaths << info.absoluteFilePath();
#endif
#if defined(Q_OS_OSX)
pluginPaths << "/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin"; // Mac OS X
@@ -132,7 +125,6 @@ void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins)
if (!QFile(*it).exists())
continue;
plugins->push_back(CreatePepperFlashInfo(QtWebEngineCore::toFilePath(*it), std::string()));
- return;
}
}
@@ -159,7 +151,6 @@ void ContentClientQt::AddPepperPlugins(std::vector<content::PepperPluginInfo>* p
#endif
#include <QCoreApplication>
-#include <QStringBuilder>
namespace QtWebEngineCore {
diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp
index a81670a6c..3689d54d7 100644
--- a/src/core/cookie_monster_delegate_qt.cpp
+++ b/src/core/cookie_monster_delegate_qt.cpp
@@ -44,8 +44,6 @@
#include "api/qwebenginecookiestore_p.h"
#include "type_conversion.h"
-#include <QStringBuilder>
-
namespace QtWebEngineCore {
static GURL sourceUrlForCookie(const QNetworkCookie &cookie) {
@@ -139,10 +137,18 @@ void CookieMonsterDelegateQt::deleteAllCookies(quint64 callbackId)
void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster* monster)
{
+ if (!monster && !m_cookieMonster)
+ return;
+
m_cookieMonster = monster;
- if (m_client)
+ if (!m_client)
+ return;
+
+ if (monster)
m_client->d_func()->processPendingUserCookies();
+ else
+ m_client->d_func()->rejectPendingUserCookies();
}
void CookieMonsterDelegateQt::setClient(QWebEngineCookieStore *client)
@@ -152,7 +158,7 @@ void CookieMonsterDelegateQt::setClient(QWebEngineCookieStore *client)
if (!m_client)
return;
- m_client->d_ptr->delegate = this;
+ m_client->d_func()->delegate = this;
if (hasCookieMonster())
m_client->d_func()->processPendingUserCookies();
@@ -163,14 +169,14 @@ bool CookieMonsterDelegateQt::canSetCookie(const QUrl &firstPartyUrl, const QByt
if (!m_client)
return true;
- return m_client->d_ptr->canSetCookie(firstPartyUrl, cookieLine, url);
+ return m_client->d_func()->canSetCookie(firstPartyUrl, cookieLine, url);
}
void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, ChangeCause cause)
{
if (!m_client)
return;
- m_client->d_ptr->onCookieChanged(toQt(cookie), removed);
+ m_client->d_func()->onCookieChanged(toQt(cookie), removed);
}
}
diff --git a/src/core/core.pro b/src/core/core.pro
index 7ddad4ed6..09eee496f 100644
--- a/src/core/core.pro
+++ b/src/core/core.pro
@@ -1,8 +1,13 @@
TEMPLATE = subdirs
+# core_headers is a dummy module to syncqt the headers so we can
+# use them by later targets
+core_headers.file = core_headers.pro
+
# core_gyp_generator.pro is a dummy .pro file that is used by qmake
# to generate our main .gyp file
core_gyp_generator.file = core_gyp_generator.pro
+core_gyp_generator.depends = core_headers
# gyp_run.pro calls gyp through gyp_qtwebengine on the qmake step, and ninja on the make step.
gyp_run.file = gyp_run.pro
@@ -31,5 +36,6 @@ SUBDIRS += core_gyp_generator
}
SUBDIRS += gyp_run \
+ core_headers \
core_api \
core_module
diff --git a/src/core/core_common.pri b/src/core/core_common.pri
index 1ea4e1862..9c29aea71 100644
--- a/src/core/core_common.pri
+++ b/src/core/core_common.pri
@@ -3,7 +3,7 @@
TARGET = QtWebEngineCore
QT += qml quick webchannel
-QT_PRIVATE += quick-private gui-private core-private
+QT_PRIVATE += quick-private gui-private core-private webenginecoreheaders-private
# Make QtCreator happy.
CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir()
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index f950c773b..7145d8e04 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -11,6 +11,7 @@ include(core_common.pri)
# Defining keywords such as 'signal' clashes with the chromium code base.
DEFINES += QT_NO_KEYWORDS \
+ QT_USE_QSTRINGBUILDER \
Q_FORWARD_DECLARE_OBJC_CLASS=QT_FORWARD_DECLARE_CLASS \
QTWEBENGINEPROCESS_NAME=\\\"$$QTWEBENGINEPROCESS_NAME\\\" \
QTWEBENGINECORE_VERSION_STR=\\\"$$MODULE_VERSION\\\" \
diff --git a/src/core/core_headers.pro b/src/core/core_headers.pro
new file mode 100644
index 000000000..ebafe58ec
--- /dev/null
+++ b/src/core/core_headers.pro
@@ -0,0 +1,5 @@
+TARGET = QtWebEngineCore
+CONFIG += no_private_module header_module internal_module
+MODULE = webenginecoreheaders
+
+load(qt_module)
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index 68d46cd5a..b001fef06 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -70,14 +70,14 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat
locales.CONFIG += no_check_exist
locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales
resources.CONFIG += no_check_exist
- resources.path = $$[QT_INSTALL_DATA]
+ resources.path = $$[QT_INSTALL_DATA]/resources
icu.CONFIG += no_check_exist
- icu.path = $$[QT_INSTALL_DATA]
+ icu.path = $$[QT_INSTALL_DATA]/resources
INSTALLS += icu locales resources
}
!contains(QT_CONFIG, qt_framework): contains(QT_CONFIG, private_tests) {
- ICU_TARGET = $$shell_path($$[QT_INSTALL_DATA/get]/icudtl.dat)
+ ICU_TARGET = $$shell_path($$[QT_INSTALL_DATA/get]/resources/icudtl.dat)
ICU_FILE = $$shell_path($$OUT_PWD/$$getConfigDir()/icudtl.dat)
icu_rule.target = $$ICU_TARGET
unix: icu_rule.commands = if [ -e $$ICU_FILE ] ; then $$QMAKE_COPY $$ICU_FILE $$ICU_TARGET ; fi
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index b6de27ca8..454e1ff49 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -46,6 +46,7 @@
#include <QFile>
#include <QFileInfo>
#include <QMap>
+#include <QMimeDatabase>
#include <QStandardPaths>
#include "browser_context_adapter.h"
@@ -108,23 +109,28 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i
return true;
}
- std::string suggestedFilename = item->GetSuggestedFilename();
+ QString suggestedFilename = toQt(item->GetSuggestedFilename());
+ QString mimeTypeString = toQt(item->GetMimeType());
- if (suggestedFilename.empty())
- suggestedFilename = net::HttpContentDisposition(item->GetContentDisposition(), std::string()).filename();
+ if (suggestedFilename.isEmpty())
+ suggestedFilename = toQt(net::HttpContentDisposition(item->GetContentDisposition(), std::string()).filename());
- if (suggestedFilename.empty())
- suggestedFilename = item->GetTargetFilePath().AsUTF8Unsafe();
+ if (suggestedFilename.isEmpty())
+ suggestedFilename = toQt(item->GetTargetFilePath().AsUTF8Unsafe());
- if (suggestedFilename.empty())
- suggestedFilename = item->GetURL().ExtractFileName();
+ if (suggestedFilename.isEmpty())
+ suggestedFilename = toQt(item->GetURL().ExtractFileName());
- if (suggestedFilename.empty())
- suggestedFilename = "qwe_download";
+ if (suggestedFilename.isEmpty()) {
+ suggestedFilename = QStringLiteral("qwe_download");
+ QMimeType mimeType = QMimeDatabase().mimeTypeForName(mimeTypeString);
+ if (mimeType.isValid() && !mimeType.preferredSuffix().isEmpty())
+ suggestedFilename += QStringLiteral(".") + mimeType.preferredSuffix();
+ }
QDir defaultDownloadDirectory = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
- QFileInfo suggestedFile(defaultDownloadDirectory.absoluteFilePath(QString::fromStdString(suggestedFilename)));
+ QFileInfo suggestedFile(defaultDownloadDirectory.absoluteFilePath(suggestedFilename));
QString suggestedFilePath = suggestedFile.absoluteFilePath();
QString tmpFileBase = QString("%1%2%3").arg(suggestedFile.absolutePath()).arg(QDir::separator()).arg(suggestedFile.baseName());
@@ -145,6 +151,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i
item->GetState(),
item->GetTotalBytes(),
item->GetReceivedBytes(),
+ mimeTypeString,
suggestedFilePath,
BrowserContextAdapterClient::UnknownSavePageFormat,
false /* accepted */
@@ -214,6 +221,7 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content
content::DownloadItem::IN_PROGRESS,
0, /* totalBytes */
0, /* receivedBytes */
+ QStringLiteral("application/x-mimearchive"),
suggestedFilePath,
BrowserContextAdapterClient::MimeHtmlSaveFormat,
false /* accepted */
@@ -249,6 +257,7 @@ void DownloadManagerDelegateQt::OnDownloadUpdated(content::DownloadItem *downloa
download->GetState(),
download->GetTotalBytes(),
download->GetReceivedBytes(),
+ toQt(download->GetMimeType()),
QString(),
BrowserContextAdapterClient::UnknownSavePageFormat,
true /* accepted */
diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro
index 79e1dca64..dea1a2225 100644
--- a/src/core/gyp_run.pro
+++ b/src/core/gyp_run.pro
@@ -28,6 +28,8 @@ force_debug_info {
else: GYP_CONFIG += release_extra_cflags=-g
}
+!warnings_are_errors: GYP_CONFIG += disable_fatal_linker_warnings=1
+
# Copy this logic from qt_module.prf so that ninja can run according
# to the same rules as the final module linking in core_module.pro.
!host_build:if(win32|mac):!macx-xcode {
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 5d4ac72cd..cade9aa8a 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -739,6 +739,10 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event)
Focus(); // Fall through.
case QEvent::MouseButtonRelease:
case QEvent::MouseMove:
+ // Skip second MouseMove event when a window is being adopted, so that Chromium
+ // can properly handle further move events.
+ if (m_adapterClient->isBeingAdopted())
+ return false;
handleMouseEvent(static_cast<QMouseEvent*>(event));
break;
case QEvent::KeyPress:
diff --git a/src/core/resources/resources.gyp b/src/core/resources/resources.gyp
index 6c61f1daf..157b78780 100644
--- a/src/core/resources/resources.gyp
+++ b/src/core/resources/resources.gyp
@@ -78,15 +78,15 @@
['qt_install_data != ""', {
'copies': [
{
- 'destination': '<(qt_install_data)',
+ 'destination': '<(qt_install_data)/resources',
'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources.pak' ],
},
{
- 'destination': '<(qt_install_data)',
+ 'destination': '<(qt_install_data)/resources',
'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources_100p.pak' ],
},
{
- 'destination': '<(qt_install_data)',
+ 'destination': '<(qt_install_data)/resources',
'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources_200p.pak' ],
},
],
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index 4a2a63348..ed3378b21 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -65,6 +65,7 @@
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/ftp_protocol_handler.h"
+#include "net/url_request/url_request_intercepting_job_factory.h"
#include "net/ftp/ftp_network_layer.h"
#include "api/qwebengineurlschemehandler.h"
@@ -85,10 +86,11 @@ static const char kQrcSchemeQt[] = "qrc";
using content::BrowserThread;
-URLRequestContextGetterQt::URLRequestContextGetterQt(BrowserContextAdapter *browserContext, content::ProtocolHandlerMap *protocolHandlers)
+URLRequestContextGetterQt::URLRequestContextGetterQt(BrowserContextAdapter *browserContext, content::ProtocolHandlerMap *protocolHandlers, content::URLRequestInterceptorScopedVector request_interceptors)
: m_ignoreCertificateErrors(false)
, m_browserContext(browserContext)
, m_cookieDelegate(new CookieMonsterDelegateQt())
+ , m_requestInterceptors(request_interceptors.Pass())
{
std::swap(m_protocolHandlers, *protocolHandlers);
@@ -131,22 +133,29 @@ void URLRequestContextGetterQt::updateStorageSettings()
}
}
-void URLRequestContextGetterQt::generateStorage()
+void URLRequestContextGetterQt::cancelAllUrlRequests()
{
Q_ASSERT(m_urlRequestContext);
- if (m_storage) {
- // We must stop all requests before deleting their backends.
- std::set<const net::URLRequest*>* url_requests = m_urlRequestContext->url_requests();
- std::set<const net::URLRequest*>::const_iterator it = url_requests->begin();
- std::set<const net::URLRequest*>::const_iterator end = url_requests->end();
- for ( ; it != end; ++it) {
- net::URLRequest* request = const_cast<net::URLRequest*>(*it);
- if (request)
- request->Cancel();
- }
+ std::set<const net::URLRequest*>* url_requests = m_urlRequestContext->url_requests();
+ std::set<const net::URLRequest*>::const_iterator it = url_requests->begin();
+ std::set<const net::URLRequest*>::const_iterator end = url_requests->end();
+ for ( ; it != end; ++it) {
+ net::URLRequest* request = const_cast<net::URLRequest*>(*it);
+ if (request)
+ request->Cancel();
}
+}
+
+void URLRequestContextGetterQt::generateStorage()
+{
+ Q_ASSERT(m_urlRequestContext);
+
+ // We must stop all requests before deleting their backends.
+ if (m_storage)
+ cancelAllUrlRequests();
+
m_storage.reset(new net::URLRequestContextStorage(m_urlRequestContext.get()));
net::ProxyConfigService *proxyConfigService = m_proxyConfigService.fetchAndStoreAcquire(0);
@@ -202,7 +211,7 @@ void URLRequestContextGetterQt::generateCookieStore()
Q_ASSERT(m_storage);
m_updateCookieStore = 0;
- // Unset it first to get a chance to destroy and flush the old cookie store before before opening a new on possibly the same file.
+ // Unset it first to get a chance to destroy and flush the old cookie store before opening a new on possibly the same file.
m_storage->set_cookie_store(0);
m_cookieDelegate->setCookieMonster(0);
m_cookieDelegate->setClient(m_browserContext->cookieStore());
@@ -286,11 +295,56 @@ void URLRequestContextGetterQt::updateHttpCache()
}
}
+static bool doNetworkSessionParamsMatch(const net::HttpNetworkSession::Params &first, const net::HttpNetworkSession::Params &second)
+{
+ if (first.transport_security_state != second.transport_security_state)
+ return false;
+ if (first.cert_verifier != second.cert_verifier)
+ return false;
+ if (first.channel_id_service != second.channel_id_service)
+ return false;
+ if (first.proxy_service != second.proxy_service)
+ return false;
+ if (first.ssl_config_service != second.ssl_config_service)
+ return false;
+ if (first.http_auth_handler_factory != second.http_auth_handler_factory)
+ return false;
+ if (first.network_delegate != second.network_delegate)
+ return false;
+ if (first.http_server_properties.get() != second.http_server_properties.get())
+ return false;
+ if (first.ignore_certificate_errors != second.ignore_certificate_errors)
+ return false;
+ if (first.host_resolver != second.host_resolver)
+ return false;
+
+ return true;
+}
+
+net::HttpNetworkSession::Params URLRequestContextGetterQt::generateNetworkSessionParams()
+{
+ Q_ASSERT(m_urlRequestContext);
+
+ net::HttpNetworkSession::Params network_session_params;
+
+ network_session_params.transport_security_state = m_urlRequestContext->transport_security_state();
+ network_session_params.cert_verifier = m_urlRequestContext->cert_verifier();
+ network_session_params.channel_id_service = m_urlRequestContext->channel_id_service();
+ network_session_params.proxy_service = m_urlRequestContext->proxy_service();
+ network_session_params.ssl_config_service = m_urlRequestContext->ssl_config_service();
+ network_session_params.http_auth_handler_factory = m_urlRequestContext->http_auth_handler_factory();
+ network_session_params.network_delegate = m_networkDelegate.get();
+ network_session_params.http_server_properties = m_urlRequestContext->http_server_properties();
+ network_session_params.ignore_certificate_errors = m_ignoreCertificateErrors;
+ network_session_params.host_resolver = m_urlRequestContext->host_resolver();
+
+ return network_session_params;
+}
+
void URLRequestContextGetterQt::generateHttpCache()
{
Q_ASSERT(m_urlRequestContext);
Q_ASSERT(m_storage);
- m_updateHttpCache = 0;
net::HttpCache::DefaultBackend* main_backend = 0;
switch (m_browserContext->httpCacheType()) {
@@ -316,19 +370,21 @@ void URLRequestContextGetterQt::generateHttpCache()
break;
}
- net::HttpNetworkSession::Params network_session_params;
- network_session_params.transport_security_state = m_urlRequestContext->transport_security_state();
- network_session_params.cert_verifier = m_urlRequestContext->cert_verifier();
- network_session_params.channel_id_service = m_urlRequestContext->channel_id_service();
- network_session_params.proxy_service = m_urlRequestContext->proxy_service();
- network_session_params.ssl_config_service = m_urlRequestContext->ssl_config_service();
- network_session_params.http_auth_handler_factory = m_urlRequestContext->http_auth_handler_factory();
- network_session_params.network_delegate = m_networkDelegate.get();
- network_session_params.http_server_properties = m_urlRequestContext->http_server_properties();
- network_session_params.ignore_certificate_errors = m_ignoreCertificateErrors;
- network_session_params.host_resolver = m_urlRequestContext->host_resolver();
+ net::HttpCache *cache = 0;
+ net::HttpNetworkSession *network_session = 0;
+ net::HttpNetworkSession::Params network_session_params = generateNetworkSessionParams();
+
+ if (m_urlRequestContext->http_transaction_factory())
+ network_session = m_urlRequestContext->http_transaction_factory()->GetSession();
+
+ if (!network_session || !doNetworkSessionParamsMatch(network_session_params, network_session->params())) {
+ cancelAllUrlRequests();
+ cache = new net::HttpCache(network_session_params, main_backend);
+ } else
+ cache = new net::HttpCache(network_session, main_backend);
- m_storage->set_http_transaction_factory(scoped_ptr<net::HttpCache>(new net::HttpCache(network_session_params, main_backend)));
+ m_storage->set_http_transaction_factory(scoped_ptr<net::HttpCache>(cache));
+ m_updateHttpCache = 0;
}
void URLRequestContextGetterQt::clearHttpCache()
@@ -352,28 +408,39 @@ void URLRequestContextGetterQt::generateJobFactory()
{
Q_ASSERT(m_urlRequestContext);
Q_ASSERT(!m_jobFactory);
- m_jobFactory.reset(new net::URLRequestJobFactoryImpl());
+
+ scoped_ptr<net::URLRequestJobFactoryImpl> jobFactory(new net::URLRequestJobFactoryImpl());
{
// Chromium has a few protocol handlers ready for us, only pick blob: and throw away the rest.
content::ProtocolHandlerMap::iterator it = m_protocolHandlers.find(url::kBlobScheme);
Q_ASSERT(it != m_protocolHandlers.end());
- m_jobFactory->SetProtocolHandler(it->first, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(it->second.release()));
+ jobFactory->SetProtocolHandler(it->first, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(it->second.release()));
m_protocolHandlers.clear();
}
- m_jobFactory->SetProtocolHandler(url::kDataScheme, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new net::DataProtocolHandler()));
- m_jobFactory->SetProtocolHandler(url::kFileScheme, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new net::FileProtocolHandler(
+ jobFactory->SetProtocolHandler(url::kDataScheme, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new net::DataProtocolHandler()));
+ jobFactory->SetProtocolHandler(url::kFileScheme, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new net::FileProtocolHandler(
content::BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))));
- m_jobFactory->SetProtocolHandler(kQrcSchemeQt, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new QrcProtocolHandlerQt()));
- m_jobFactory->SetProtocolHandler(url::kFtpScheme,
+ jobFactory->SetProtocolHandler(kQrcSchemeQt, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new QrcProtocolHandlerQt()));
+ jobFactory->SetProtocolHandler(url::kFtpScheme,
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new net::FtpProtocolHandler(new net::FtpNetworkLayer(m_urlRequestContext->host_resolver()))));
QHash<QByteArray, QWebEngineUrlSchemeHandler*>::const_iterator it = m_browserContext->customUrlSchemeHandlers().constBegin();
const QHash<QByteArray, QWebEngineUrlSchemeHandler*>::const_iterator end = m_browserContext->customUrlSchemeHandlers().constEnd();
for (; it != end; ++it)
- m_jobFactory->SetProtocolHandler(it.key().toStdString(), scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new CustomProtocolHandler(it.value())));
+ jobFactory->SetProtocolHandler(it.key().toStdString(), scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new CustomProtocolHandler(it.value())));
+
+ // Set up interceptors in the reverse order.
+ scoped_ptr<net::URLRequestJobFactory> topJobFactory = jobFactory.Pass();
+
+ for (content::URLRequestInterceptorScopedVector::reverse_iterator i = m_requestInterceptors.rbegin(); i != m_requestInterceptors.rend(); ++i)
+ topJobFactory.reset(new net::URLRequestInterceptingJobFactory(topJobFactory.Pass(), make_scoped_ptr(*i)));
+
+ m_requestInterceptors.weak_clear();
+
+ m_jobFactory = topJobFactory.Pass();
m_urlRequestContext->set_job_factory(m_jobFactory.get());
}
diff --git a/src/core/url_request_context_getter_qt.h b/src/core/url_request_context_getter_qt.h
index 9c355082d..3c0a2ee19 100644
--- a/src/core/url_request_context_getter_qt.h
+++ b/src/core/url_request_context_getter_qt.h
@@ -45,6 +45,7 @@
#include "base/single_thread_task_runner.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/url_constants.h"
+#include "net/http/http_network_session.h"
#include "net/url_request/url_request_context_storage.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
@@ -66,7 +67,7 @@ class BrowserContextAdapter;
class URLRequestContextGetterQt : public net::URLRequestContextGetter {
public:
- explicit URLRequestContextGetterQt(BrowserContextAdapter *browserContext, content::ProtocolHandlerMap *protocolHandlers);
+ explicit URLRequestContextGetterQt(BrowserContextAdapter *browserContext, content::ProtocolHandlerMap *protocolHandlers, content::URLRequestInterceptorScopedVector request_interceptors);
virtual net::URLRequestContext *GetURLRequestContext() Q_DECL_OVERRIDE;
virtual scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const Q_DECL_OVERRIDE;
@@ -88,6 +89,8 @@ private:
void generateUserAgent();
void generateJobFactory();
void clearCurrentCacheBackend();
+ void cancelAllUrlRequests();
+ net::HttpNetworkSession::Params generateNetworkSessionParams();
bool m_ignoreCertificateErrors;
QAtomicInt m_updateCookieStore;
@@ -99,9 +102,11 @@ private:
scoped_ptr<net::URLRequestContext> m_urlRequestContext;
scoped_ptr<NetworkDelegateQt> m_networkDelegate;
scoped_ptr<net::URLRequestContextStorage> m_storage;
- scoped_ptr<net::URLRequestJobFactoryImpl> m_jobFactory;
+ scoped_ptr<net::URLRequestJobFactory> m_jobFactory;
scoped_ptr<net::DhcpProxyScriptFetcherFactory> m_dhcpProxyScriptFetcherFactory;
scoped_refptr<CookieMonsterDelegateQt> m_cookieDelegate;
+ content::URLRequestInterceptorScopedVector m_requestInterceptors;
+
friend class NetworkDelegateQt;
};
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index b19cc5241..d3eae2b00 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -213,6 +213,7 @@ public:
virtual void focusContainer() = 0;
virtual void unhandledKeyEvent(QKeyEvent *event) = 0;
virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry) = 0;
+ virtual bool isBeingAdopted() = 0;
virtual void close() = 0;
virtual void windowCloseRejected() = 0;
virtual bool contextMenuRequested(const WebEngineContextMenuData&) = 0;
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 4d1cbf3d4..dabee9179 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -84,6 +84,12 @@
#include <QVector>
#include <qpa/qplatformnativeinterface.h>
+using namespace QtWebEngineCore;
+
+QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
+QT_END_NAMESPACE
+
namespace {
scoped_refptr<QtWebEngineCore::WebEngineContext> sContext;
@@ -100,7 +106,7 @@ void destroyContext()
bool usingANGLE()
{
#if defined(Q_OS_WIN)
- return QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES;
+ return qt_gl_global_share_context()->isOpenGLES();
#else
return false;
#endif
@@ -246,14 +252,12 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(switches::kDisableGpu);
} else {
const char *glType = 0;
- switch (QOpenGLContext::openGLModuleType()) {
- case QOpenGLContext::LibGL:
- glType = gfx::kGLImplementationDesktopName;
- break;
- case QOpenGLContext::LibGLES:
+ if (qt_gl_global_share_context()->isOpenGLES()) {
glType = gfx::kGLImplementationEGLName;
- break;
+ } else {
+ glType = gfx::kGLImplementationDesktopName;
}
+
parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType);
}
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index bc030d8f7..8ec18c87d 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -52,7 +52,6 @@
#include <QLibraryInfo>
#include <QStandardPaths>
#include <QString>
-#include <QStringBuilder>
#ifndef QTWEBENGINEPROCESS_NAME
#error "No name defined for QtWebEngine's process"
@@ -203,26 +202,57 @@ QString localesPath()
#endif
}
-QString libraryDataPath()
+QString icuDataPath()
{
#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
return getResourcesPath(frameworkBundle());
#else
static bool initialized = false;
- static QString potentialDataPath = QLibraryInfo::location(QLibraryInfo::DataPath);
+ static QString potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/resources");
if (!initialized) {
initialized = true;
- if (!QFileInfo::exists(potentialDataPath)) {
- qWarning("Qt WebEngine data directory not found at location %s. Trying application directory...", qPrintable(potentialDataPath));
- potentialDataPath = QCoreApplication::applicationDirPath();
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/icudtl.dat"))) {
+ qWarning("Qt WebEngine ICU data not found at %s. Trying parent directory...", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath);
}
- if (!QFileInfo::exists(potentialDataPath)) {
- qWarning("Qt WebEngine data directory not found at location %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialDataPath));
- potentialDataPath = fallbackDir();
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/icudtl.dat"))) {
+ qWarning("Qt WebEngine ICU data not found at %s. Trying application directory...", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = QCoreApplication::applicationDirPath();
+ }
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/icudtl.dat"))) {
+ qWarning("Qt WebEngine ICU data not found at %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = fallbackDir();
+ }
+ }
+
+ return potentialResourcesPath;
+#endif
+}
+
+QString resourcesDataPath()
+{
+#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
+ return getResourcesPath(frameworkBundle());
+#else
+ static bool initialized = false;
+ static QString potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/resources");
+ if (!initialized) {
+ initialized = true;
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
+ qWarning("Qt WebEngine resources not found at %s. Trying parent directory...", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath);
+ }
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
+ qWarning("Qt WebEngine resources not found at %s. Trying application directory...", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = QCoreApplication::applicationDirPath();
+ }
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
+ qWarning("Qt WebEngine resources not found at %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = fallbackDir();
}
}
- return potentialDataPath;
+ return potentialResourcesPath;
#endif
}
} // namespace
@@ -232,11 +262,11 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
QString directory;
switch (key) {
case QT_RESOURCES_PAK:
- return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources.pak"));
+ return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources.pak"));
case QT_RESOURCES_100P_PAK:
- return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources_100p.pak"));
+ return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources_100p.pak"));
case QT_RESOURCES_200P_PAK:
- return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources_200p.pak"));
+ return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources_200p.pak"));
case base::FILE_EXE:
case content::CHILD_PROCESS_EXE:
return toFilePath(subProcessPath());
@@ -252,7 +282,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
break;
case base::DIR_QT_LIBRARY_DATA:
- return toFilePath(libraryDataPath());
+ return toFilePath(icuDataPath());
case content::DIR_MEDIA_LIBS:
return toFilePath(pluginsPath());
case ui::DIR_LOCALES:
diff --git a/src/webengine/api/qquickwebenginecertificateerror.cpp b/src/webengine/api/qquickwebenginecertificateerror.cpp
index 202d201b3..ea9b2bc11 100644
--- a/src/webengine/api/qquickwebenginecertificateerror.cpp
+++ b/src/webengine/api/qquickwebenginecertificateerror.cpp
@@ -61,13 +61,13 @@ public:
/*!
\qmltype WebEngineCertificateError
\instantiates QQuickWebEngineCertificateError
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.1
- \brief A utility class for accepting or denying certificate exceptions when a certificate error occurs.
+ \brief A utility type for ignoring certificate errors or rejecting erroneous certificates.
- This class contains information about a certificate error that happened and provides a way to accept or
- deny a certificate exception.
+ This QML type contains information about a certificate error that occurred and provides a way
+ to ignore the error or reject the certificate.
\sa WebEngineView::certificateError
*/
@@ -86,8 +86,9 @@ QQuickWebEngineCertificateError::~QQuickWebEngineCertificateError()
/*!
\qmlmethod void WebEngineCertificateError::defer()
- This function should be called when there is a need to postpone the decision to ignore or not the certificate error. This is useful to
- wait for user input. When called it will pause the url request until WebEngineCertificateError::ignoreCertificateError() or
+ This function should be called when there is a need to postpone the decision whether to ignore a
+ certificate error, for example, while waiting for user input. When called, the function pauses the
+ URL request until WebEngineCertificateError::ignoreCertificateError() or
WebEngineCertificateError::rejectCertificate() is called.
*/
void QQuickWebEngineCertificateError::defer()
@@ -98,7 +99,7 @@ void QQuickWebEngineCertificateError::defer()
/*!
\qmlmethod void WebEngineCertificateError::ignoreCertificateError()
- The certificate error is ignored and the WebEngineView continues to load the requested url.
+ The certificate error is ignored, and the web engine view continues to load the requested URL.
*/
void QQuickWebEngineCertificateError::ignoreCertificateError()
{
@@ -114,7 +115,7 @@ void QQuickWebEngineCertificateError::ignoreCertificateError()
/*!
\qmlmethod void WebEngineCertificateError::rejectCertificate()
- The WebEngineView stops loading the requested url.
+ The certificate is rejected, and the web engine view stops loading the requested URL.
*/
void QQuickWebEngineCertificateError::rejectCertificate()
{
@@ -148,7 +149,8 @@ QUrl QQuickWebEngineCertificateError::url() const
The type of the error.
- \value SslPinnedKeyNotInCertificateChain The certificate did not match the built-in public key pins for the host name.
+ \value SslPinnedKeyNotInCertificateChain The certificate did not match the built-in public keys
+ pinned for the host name.
\value CertificateCommonNameInvalid The certificate's common name did not match the host name.
\value CertificateDateInvalid The certificate is not valid at the current date and time.
\value CertificateAuthorityInvalid The certificate is not signed by a trusted authority.
@@ -184,7 +186,7 @@ QString QQuickWebEngineCertificateError::description() const
\qmlproperty bool WebEngineCertificateError::overridable
\readonly
- A boolean that indicates if the certificate error can be overridden and accepted.
+ A boolean that indicates whether the certificate error can be overridden and ignored.
*/
bool QQuickWebEngineCertificateError::overridable() const
{
diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp
index 6efa45e43..0dbbb05fd 100644
--- a/src/webengine/api/qquickwebenginedownloaditem.cpp
+++ b/src/webengine/api/qquickwebenginedownloaditem.cpp
@@ -36,7 +36,7 @@
#include "qquickwebenginedownloaditem_p.h"
#include "qquickwebenginedownloaditem_p_p.h"
-#include "qquickwebengineprofile_p_p.h"
+#include "qquickwebengineprofile_p.h"
using QtWebEngineCore::BrowserContextAdapterClient;
@@ -77,7 +77,7 @@ QQuickWebEngineDownloadItemPrivate::~QQuickWebEngineDownloadItemPrivate()
/*!
\qmltype WebEngineDownloadItem
\instantiates QQuickWebEngineDownloadItem
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.1
\brief Provides information about a download.
@@ -218,6 +218,18 @@ qint64 QQuickWebEngineDownloadItem::receivedBytes() const
}
/*!
+ \qmlproperty QString WebEngineDownloadItem::mimeType
+
+ Holds the MIME type of the download.
+*/
+
+QString QQuickWebEngineDownloadItem::mimeType() const
+{
+ Q_D(const QQuickWebEngineDownloadItem);
+ return d->mimeType;
+}
+
+/*!
\qmlproperty QString WebEngineDownloadItem::path
Holds the full target path where data is being downloaded to.
diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/webengine/api/qquickwebenginedownloaditem_p.h
index 9d1a5a211..46b39fe0a 100644
--- a/src/webengine/api/qquickwebenginedownloaditem_p.h
+++ b/src/webengine/api/qquickwebenginedownloaditem_p.h
@@ -84,6 +84,7 @@ public:
Q_PROPERTY(SavePageFormat savePageFormat READ savePageFormat WRITE setSavePageFormat NOTIFY savePageFormatChanged)
Q_PROPERTY(qint64 totalBytes READ totalBytes NOTIFY totalBytesChanged)
Q_PROPERTY(qint64 receivedBytes READ receivedBytes NOTIFY receivedBytesChanged)
+ Q_PROPERTY(QString mimeType READ mimeType NOTIFY mimeTypeChanged REVISION 1)
Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
Q_INVOKABLE void accept();
@@ -93,6 +94,7 @@ public:
DownloadState state() const;
qint64 totalBytes() const;
qint64 receivedBytes() const;
+ QString mimeType() const;
QString path() const;
void setPath(QString path);
SavePageFormat savePageFormat() const;
@@ -103,6 +105,7 @@ Q_SIGNALS:
void savePageFormatChanged();
void receivedBytesChanged();
void totalBytesChanged();
+ void mimeTypeChanged();
void pathChanged();
private:
diff --git a/src/webengine/api/qquickwebenginedownloaditem_p_p.h b/src/webengine/api/qquickwebenginedownloaditem_p_p.h
index 36b9eb349..a85e4e6c4 100644
--- a/src/webengine/api/qquickwebenginedownloaditem_p_p.h
+++ b/src/webengine/api/qquickwebenginedownloaditem_p_p.h
@@ -50,7 +50,7 @@
#include "browser_context_adapter_client.h"
#include "qquickwebenginedownloaditem_p.h"
-#include "qquickwebengineprofile_p.h"
+#include "qquickwebengineprofile.h"
#include <private/qtwebengineglobal_p.h>
#include <QString>
#include <QPointer>
@@ -72,6 +72,7 @@ public:
QQuickWebEngineDownloadItem::SavePageFormat savePageFormat;
qint64 totalBytes;
qint64 receivedBytes;
+ QString mimeType;
QString downloadPath;
void update(const QtWebEngineCore::BrowserContextAdapterClient::DownloadItemInfo &info);
diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp
index 175b52248..d790093a4 100644
--- a/src/webengine/api/qquickwebenginehistory.cpp
+++ b/src/webengine/api/qquickwebenginehistory.cpp
@@ -121,7 +121,7 @@ int QQuickWebEngineForwardHistoryListModelPrivate::offsetForIndex(int index) con
/*!
\qmltype WebEngineHistoryListModel
\instantiates QQuickWebEngineHistoryListModel
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.1
\brief A data model that represents the history of a web engine page.
@@ -208,7 +208,7 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate()
/*!
\qmltype WebEngineHistory
\instantiates QQuickWebEngineHistory
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.1
\brief Provides data models that represent the history of a web engine page.
diff --git a/src/webengine/api/qquickwebengineloadrequest.cpp b/src/webengine/api/qquickwebengineloadrequest.cpp
index e94fa7eb9..e39d7b4d1 100644
--- a/src/webengine/api/qquickwebengineloadrequest.cpp
+++ b/src/webengine/api/qquickwebengineloadrequest.cpp
@@ -59,7 +59,7 @@ public:
/*!
\qmltype WebEngineLoadRequest
\instantiates QQuickWebEngineLoadRequest
- \inqmlmodule QtWebEngine 1.0
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.0
\brief A utility type for the WebEngineView::loadingChanged signal.
diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp
index 6e20c0a46..74729ddf1 100644
--- a/src/webengine/api/qquickwebenginenewviewrequest.cpp
+++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp
@@ -42,7 +42,7 @@
/*!
\qmltype WebEngineNewViewRequest
\instantiates QQuickWebEngineNewViewRequest
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.1
\brief A utility type for the WebEngineView::newViewRequested signal.
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index 6df16bf54..523121b6f 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -34,11 +34,11 @@
**
****************************************************************************/
-#include "qquickwebengineprofile_p.h"
+#include "qquickwebengineprofile.h"
#include "qquickwebenginedownloaditem_p.h"
#include "qquickwebenginedownloaditem_p_p.h"
-#include "qquickwebengineprofile_p_p.h"
+#include "qquickwebengineprofile_p.h"
#include "qquickwebenginesettings_p.h"
#include "qwebenginecookiestore.h"
@@ -57,6 +57,67 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::SingleHtmlSaveFormat, QtWebEngin
ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::CompleteHtmlSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::CompleteHtmlSaveFormat)
ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::MimeHtmlSaveFormat)
+/*!
+ \class QQuickWebEngineProfile
+ \brief The QQuickWebEngineProfile class provides a web-engine profile shared by multiple pages.
+ \since 5.6
+
+ \inmodule QtWebEngine
+
+ QQuickWebEngineProfile contains settings, scripts, and the list of visited links shared by all
+ web engine pages that belong to the profile. As such, profiles can be used to isolate pages
+ from each other. A typical use case is a dedicated profile for a 'private browsing' mode.
+
+ The default profile is a built-in profile that all web pages not specifically created with
+ another profile belong to.
+*/
+
+/*!
+ \enum QQuickWebEngineProfile::HttpCacheType
+
+ This enum describes the HTTP cache type:
+
+ \value MemoryHttpCache Use an in-memory cache. This is the only setting possible if
+ \c off-the-record is set or no cache path is available.
+ \value DiskHttpCache Use a disk cache. This is the default.
+*/
+
+/*!
+ \enum QQuickWebEngineProfile::PersistentCookiesPolicy
+
+ This enum describes policy for cookie persistency:
+
+ \value NoPersistentCookies
+ Both session and persistent cookies are stored in memory. This is the only setting
+ possible if \c off-the-record is set or no persistent data path is available.
+ \value AllowPersistentCookies
+ Cookies marked persistent are saved to and restored from disk, whereas session cookies
+ are only stored to disk for crash recovery. This is the default setting.
+ \value ForcePersistentCookies
+ Both session and persistent cookies are saved to and restored from disk.
+*/
+
+/*!
+ \fn QQuickWebEngineProfile::downloadRequested(QQuickWebEngineDownloadItem *download)
+
+ This signal is emitted whenever a download has been triggered.
+ The \a download argument holds the state of the download.
+ The download has to be explicitly accepted with
+ \c{QQuickWebEngineDownloadItem::accept()} or it will be
+ cancelled by default.
+ The download item is parented by the profile. If it is not accepted, it
+ will be deleted immediately after the signal emission.
+ This signal cannot be used with a queued connection.
+*/
+
+/*!
+ \fn QQuickWebEngineProfile::downloadFinished(QQuickWebEngineDownloadItem *download)
+
+ This signal is emitted whenever downloading stops, because it finished successfully, was
+ cancelled, or was interrupted (for example, because connectivity was lost).
+ The \a download argument holds the state of the finished download instance.
+*/
+
QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(BrowserContextAdapter* browserContext)
: m_settings(new QQuickWebEngineSettings())
, m_browserContextRef(browserContext)
@@ -99,6 +160,7 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
itemPrivate->downloadId = info.id;
itemPrivate->downloadState = QQuickWebEngineDownloadItem::DownloadRequested;
itemPrivate->totalBytes = info.totalBytes;
+ itemPrivate->mimeType = info.mimeType;
itemPrivate->downloadPath = info.path;
itemPrivate->savePageFormat = static_cast<QQuickWebEngineDownloadItem::SavePageFormat>(
info.savePageFormat);
@@ -142,7 +204,7 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info
/*!
\qmltype WebEngineProfile
\instantiates QQuickWebEngineProfile
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.1
\brief Contains settings, scripts, and visited links common to multiple web engine views.
@@ -171,8 +233,12 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info
The \a download argument holds the state of the finished download instance.
*/
-QQuickWebEngineProfile::QQuickWebEngineProfile()
- : d_ptr(new QQuickWebEngineProfilePrivate(new BrowserContextAdapter(false)))
+/*!
+ Constructs a new profile with the parent \a parent.
+*/
+QQuickWebEngineProfile::QQuickWebEngineProfile(QObject *parent)
+ : QObject(parent),
+ d_ptr(new QQuickWebEngineProfilePrivate(new BrowserContextAdapter(false)))
{
// Sets up the global WebEngineContext
QQuickWebEngineProfile::defaultProfile();
@@ -186,6 +252,9 @@ QQuickWebEngineProfile::QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *pr
d_ptr->q_ptr = this;
}
+/*!
+ \internal
+*/
QQuickWebEngineProfile::~QQuickWebEngineProfile()
{
}
@@ -199,6 +268,15 @@ QQuickWebEngineProfile::~QQuickWebEngineProfile()
\sa WebEngineProfile::persistentStoragePath, WebEngineProfile::cachePath
*/
+/*!
+ \property QQuickWebEngineProfile::storageName
+
+ The storage name that is used to create separate subdirectories for each profile that uses
+ the disk for storing persistent data and cache.
+
+ \sa QQuickWebEngineProfile::persistentStoragePath, QQuickWebEngineProfile::cachePath
+*/
+
QString QQuickWebEngineProfile::storageName() const
{
const Q_D(QQuickWebEngineProfile);
@@ -229,6 +307,16 @@ void QQuickWebEngineProfile::setStorageName(const QString &name)
An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data
to be stored only in memory.
*/
+
+
+/*!
+ \property QQuickWebEngineProfile::offTheRecord
+
+ Whether the web engine profile is \e off-the-record.
+ An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data
+ to be stored only in memory.
+*/
+
bool QQuickWebEngineProfile::isOffTheRecord() const
{
const Q_D(QQuickWebEngineProfile);
@@ -260,6 +348,18 @@ void QQuickWebEngineProfile::setOffTheRecord(bool offTheRecord)
QStandardPaths::writableLocation(QStandardPaths::DataLocation) in a directory named using
storageName.
*/
+
+/*!
+ \property QQuickWebEngineProfile::persistentStoragePath
+
+ The path to the location where the persistent data for the browser and web content are
+ stored. Persistent data includes persistent cookies, HTML5 local storage, and visited links.
+
+ By default, the storage is located below
+ QStandardPaths::writableLocation(QStandardPaths::DataLocation) in a directory named using
+ storageName.
+*/
+
QString QQuickWebEngineProfile::persistentStoragePath() const
{
const Q_D(QQuickWebEngineProfile);
@@ -284,6 +384,17 @@ void QQuickWebEngineProfile::setPersistentStoragePath(const QString &path)
below QStandardPaths::writableLocation(QStandardPaths::CacheLocation) in a directory named using
storageName.
*/
+
+/*!
+ \property QQuickWebEngineProfile::cachePath
+
+ The path to the location where the profile's caches are stored, in particular the HTTP cache.
+
+ By default, the caches are stored
+ below QStandardPaths::writableLocation(QStandardPaths::CacheLocation) in a directory named using
+ storageName.
+*/
+
QString QQuickWebEngineProfile::cachePath() const
{
const Q_D(QQuickWebEngineProfile);
@@ -304,6 +415,13 @@ void QQuickWebEngineProfile::setCachePath(const QString &path)
The user-agent string sent with HTTP to identify the browser.
*/
+
+/*!
+ \property QQuickWebEngineProfile::httpUserAgent
+
+ The user-agent string sent with HTTP to identify the browser.
+*/
+
QString QQuickWebEngineProfile::httpUserAgent() const
{
const Q_D(QQuickWebEngineProfile);
@@ -332,6 +450,14 @@ void QQuickWebEngineProfile::setHttpUserAgent(const QString &userAgent)
Uses a disk cache. This is the default value.
*/
+/*!
+ \property QQuickWebEngineProfile::httpCacheType
+
+ This enumeration describes the type of the HTTP cache.
+
+ If the profile is off-the-record, MemoryHttpCache is returned.
+*/
+
QQuickWebEngineProfile::HttpCacheType QQuickWebEngineProfile::httpCacheType() const
{
const Q_D(QQuickWebEngineProfile);
@@ -362,6 +488,13 @@ void QQuickWebEngineProfile::setHttpCacheType(QQuickWebEngineProfile::HttpCacheT
Both session and persistent cookies are saved to and restored from disk.
*/
+/*!
+ \property QQuickWebEngineProfile::persistentCookiesPolicy
+
+ This enumeration describes the policy of cookie persistency.
+ If the profile is off-the-record, NoPersistentCookies is returned.
+*/
+
QQuickWebEngineProfile::PersistentCookiesPolicy QQuickWebEngineProfile::persistentCookiesPolicy() const
{
const Q_D(QQuickWebEngineProfile);
@@ -385,6 +518,16 @@ void QQuickWebEngineProfile::setPersistentCookiesPolicy(QQuickWebEngineProfile::
\sa httpCacheType
*/
+
+/*!
+ \property QQuickWebEngineProfile::httpCacheMaximumSize
+
+ The maximum size of the HTTP cache. If \c 0, the size will be controlled automatically by
+ QtWebEngine. The default value is \c 0.
+
+ \sa httpCacheType
+*/
+
int QQuickWebEngineProfile::httpCacheMaximumSize() const
{
const Q_D(QQuickWebEngineProfile);
@@ -407,6 +550,13 @@ void QQuickWebEngineProfile::setHttpCacheMaximumSize(int maximumSize)
\since QtWebEngine 1.2
*/
+
+/*!
+ \property QQuickWebEngineProfile::httpAcceptLanguage
+
+ The value of the Accept-Language HTTP request-header field.
+*/
+
QString QQuickWebEngineProfile::httpAcceptLanguage() const
{
Q_D(const QQuickWebEngineProfile);
@@ -422,6 +572,13 @@ void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLang
emit httpAcceptLanguageChanged();
}
+/*!
+ Returns the default profile.
+
+ The default profile uses the storage name "Default".
+
+ \sa storageName()
+*/
QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile()
{
static QQuickWebEngineProfile *profile = new QQuickWebEngineProfile(
@@ -430,6 +587,9 @@ QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile()
return profile;
}
+/*!
+ Returns the cookie store singleton, if one has been set.
+*/
QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const
{
const Q_D(QQuickWebEngineProfile);
@@ -444,12 +604,119 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const
\sa WebEngineProfile::cachePath
*/
+
+/*!
+ \since 5.7
+
+ Removes the profile's cache entries.
+
+ \sa WebEngineProfile::clearHttpCache
+*/
void QQuickWebEngineProfile::clearHttpCache()
{
Q_D(QQuickWebEngineProfile);
d->browserContext()->clearHttpCache();
}
+
+/*!
+ Registers a request interceptor singleton \a interceptor to intercept URL requests.
+
+ The profile does not take ownership of the pointer.
+
+ \sa QWebEngineUrlRequestInterceptor
+*/
+void QQuickWebEngineProfile::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor)
+{
+ Q_D(QQuickWebEngineProfile);
+ d->browserContext()->setRequestInterceptor(interceptor);
+}
+
+/*!
+ Returns the custom URL scheme handler register for the URL scheme \a scheme.
+*/
+const QWebEngineUrlSchemeHandler *QQuickWebEngineProfile::urlSchemeHandler(const QByteArray &scheme) const
+{
+ const Q_D(QQuickWebEngineProfile);
+ if (d->browserContext()->customUrlSchemeHandlers().contains(scheme))
+ return d->browserContext()->customUrlSchemeHandlers().value(scheme);
+ return 0;
+}
+
+static bool checkInternalScheme(const QByteArray &scheme)
+{
+ static QSet<QByteArray> internalSchemes;
+ if (internalSchemes.isEmpty()) {
+ internalSchemes << QByteArrayLiteral("qrc") << QByteArrayLiteral("data") << QByteArrayLiteral("blob")
+ << QByteArrayLiteral("http") << QByteArrayLiteral("ftp") << QByteArrayLiteral("javascript");
+ }
+ return internalSchemes.contains(scheme);
+}
+
+/*!
+ Registers a handler \a handler for custom URL scheme \a scheme in the profile.
+*/
+void QQuickWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler)
+{
+ Q_D(QQuickWebEngineProfile);
+ Q_ASSERT(handler);
+ if (checkInternalScheme(scheme)) {
+ qWarning("Cannot install a URL scheme handler overriding internal scheme: %s", scheme.constData());
+ return;
+ }
+
+ if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) {
+ if (d->browserContext()->customUrlSchemeHandlers().value(scheme) != handler)
+ qWarning("URL scheme handler already installed for the scheme: %s", scheme.constData());
+ return;
+ }
+ d->browserContext()->addCustomUrlSchemeHandler(scheme, handler);
+ connect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)));
+}
+
+/*!
+ Removes the custom URL scheme handler \a handler from the profile.
+
+ \sa removeUrlScheme()
+*/
+void QQuickWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
+{
+ Q_D(QQuickWebEngineProfile);
+ Q_ASSERT(handler);
+ if (!d->browserContext()->removeCustomUrlSchemeHandler(handler))
+ return;
+ disconnect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)));
+}
+
+/*!
+ Removes the custom URL scheme \a scheme from the profile.
+
+ \sa removeUrlSchemeHandler()
+*/
+void QQuickWebEngineProfile::removeUrlScheme(const QByteArray &scheme)
+{
+ Q_D(QQuickWebEngineProfile);
+ QWebEngineUrlSchemeHandler *handler = d->browserContext()->takeCustomUrlSchemeHandler(scheme);
+ if (!handler)
+ return;
+ disconnect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)));
+}
+
+/*!
+ Removes all custom URL scheme handlers installed in the profile.
+*/
+void QQuickWebEngineProfile::removeAllUrlSchemeHandlers()
+{
+ Q_D(QQuickWebEngineProfile);
+ d->browserContext()->customUrlSchemeHandlers().clear();
+ d->browserContext()->updateCustomUrlSchemeHandlers();
+}
+
+void QQuickWebEngineProfile::destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj)
+{
+ removeUrlSchemeHandler(obj);
+}
+
QQuickWebEngineSettings *QQuickWebEngineProfile::settings() const
{
const Q_D(QQuickWebEngineProfile);
diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h
new file mode 100644
index 000000000..7905e5d29
--- /dev/null
+++ b/src/webengine/api/qquickwebengineprofile.h
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBENGINEPROFILE_H
+#define QQUICKWEBENGINEPROFILE_H
+
+
+#include <QtWebEngine/qtwebengineglobal.h>
+
+#include <QtCore/QObject>
+#include <QtCore/QScopedPointer>
+#include <QtCore/QString>
+
+namespace QtWebEngineCore {
+class BrowserContextAdapter;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWebEngineDownloadItem;
+class QQuickWebEngineProfilePrivate;
+class QQuickWebEngineSettings;
+class QWebEngineCookieStore;
+class QWebEngineUrlRequestInterceptor;
+class QWebEngineUrlSchemeHandler;
+
+class Q_WEBENGINE_EXPORT QQuickWebEngineProfile : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString storageName READ storageName WRITE setStorageName NOTIFY storageNameChanged FINAL)
+ Q_PROPERTY(bool offTheRecord READ isOffTheRecord WRITE setOffTheRecord NOTIFY offTheRecordChanged FINAL)
+ Q_PROPERTY(QString persistentStoragePath READ persistentStoragePath WRITE setPersistentStoragePath NOTIFY persistentStoragePathChanged FINAL)
+ Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath NOTIFY cachePathChanged FINAL)
+ Q_PROPERTY(QString httpUserAgent READ httpUserAgent WRITE setHttpUserAgent NOTIFY httpUserAgentChanged FINAL)
+ Q_PROPERTY(HttpCacheType httpCacheType READ httpCacheType WRITE setHttpCacheType NOTIFY httpCacheTypeChanged FINAL)
+ Q_PROPERTY(QString httpAcceptLanguage READ httpAcceptLanguage WRITE setHttpAcceptLanguage NOTIFY httpAcceptLanguageChanged FINAL REVISION 1)
+ Q_PROPERTY(PersistentCookiesPolicy persistentCookiesPolicy READ persistentCookiesPolicy WRITE setPersistentCookiesPolicy NOTIFY persistentCookiesPolicyChanged FINAL)
+ Q_PROPERTY(int httpCacheMaximumSize READ httpCacheMaximumSize WRITE setHttpCacheMaximumSize NOTIFY httpCacheMaximumSizeChanged FINAL)
+public:
+ QQuickWebEngineProfile(QObject *parent = Q_NULLPTR);
+ ~QQuickWebEngineProfile();
+
+ enum HttpCacheType {
+ MemoryHttpCache,
+ DiskHttpCache
+ };
+ Q_ENUM(HttpCacheType)
+
+ enum PersistentCookiesPolicy {
+ NoPersistentCookies,
+ AllowPersistentCookies,
+ ForcePersistentCookies
+ };
+ Q_ENUM(PersistentCookiesPolicy)
+
+ QString storageName() const;
+ void setStorageName(const QString &name);
+
+ bool isOffTheRecord() const;
+ void setOffTheRecord(bool offTheRecord);
+
+ QString persistentStoragePath() const;
+ void setPersistentStoragePath(const QString &path);
+
+ QString cachePath() const;
+ void setCachePath(const QString &path);
+
+ QString httpUserAgent() const;
+ void setHttpUserAgent(const QString &userAgent);
+
+ HttpCacheType httpCacheType() const;
+ void setHttpCacheType(QQuickWebEngineProfile::HttpCacheType);
+
+ PersistentCookiesPolicy persistentCookiesPolicy() const;
+ void setPersistentCookiesPolicy(QQuickWebEngineProfile::PersistentCookiesPolicy);
+
+ int httpCacheMaximumSize() const;
+ void setHttpCacheMaximumSize(int maxSize);
+
+ QString httpAcceptLanguage() const;
+ void setHttpAcceptLanguage(const QString &httpAcceptLanguage);
+
+ QWebEngineCookieStore *cookieStore() const;
+
+ void setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor);
+
+ const QWebEngineUrlSchemeHandler *urlSchemeHandler(const QByteArray &) const;
+ void installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *);
+ void removeUrlScheme(const QByteArray &scheme);
+ void removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *);
+ void removeAllUrlSchemeHandlers();
+
+ void clearHttpCache();
+
+ static QQuickWebEngineProfile *defaultProfile();
+
+Q_SIGNALS:
+ void storageNameChanged();
+ void offTheRecordChanged();
+ void persistentStoragePathChanged();
+ void cachePathChanged();
+ void httpUserAgentChanged();
+ void httpCacheTypeChanged();
+ void persistentCookiesPolicyChanged();
+ void httpCacheMaximumSizeChanged();
+ Q_REVISION(1) void httpAcceptLanguageChanged();
+
+ void downloadRequested(QQuickWebEngineDownloadItem *download);
+ void downloadFinished(QQuickWebEngineDownloadItem *download);
+
+private Q_SLOTS:
+ void destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj);
+
+private:
+ Q_DECLARE_PRIVATE(QQuickWebEngineProfile)
+ QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *, QObject *parent = 0);
+ QQuickWebEngineSettings *settings() const;
+
+ friend class QQuickWebEngineSettings;
+ friend class QQuickWebEngineSingleton;
+ friend class QQuickWebEngineViewPrivate;
+ friend class QQuickWebEngineDownloadItem;
+ friend class QQuickWebEngineDownloadItemPrivate;
+ QScopedPointer<QQuickWebEngineProfilePrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINEPROFILE_H
diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h
index 2744ed0ec..8fb56a616 100644
--- a/src/webengine/api/qquickwebengineprofile_p.h
+++ b/src/webengine/api/qquickwebengineprofile_p.h
@@ -48,108 +48,40 @@
// We mean it.
//
-#include <private/qtwebengineglobal_p.h>
+#include "browser_context_adapter_client.h"
+#include "qquickwebengineprofile_p.h"
+#include "browser_context_adapter.h"
-#include <QObject>
-#include <QScopedPointer>
-#include <QString>
-
-namespace QtWebEngineCore {
-class BrowserContextAdapter;
-}
+#include <QExplicitlySharedDataPointer>
+#include <QMap>
+#include <QPointer>
QT_BEGIN_NAMESPACE
class QQuickWebEngineDownloadItem;
-class QQuickWebEngineProfilePrivate;
class QQuickWebEngineSettings;
-class QWebEngineCookieStore;
-class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineProfile : public QObject {
- Q_OBJECT
- Q_PROPERTY(QString storageName READ storageName WRITE setStorageName NOTIFY storageNameChanged FINAL)
- Q_PROPERTY(bool offTheRecord READ isOffTheRecord WRITE setOffTheRecord NOTIFY offTheRecordChanged FINAL)
- Q_PROPERTY(QString persistentStoragePath READ persistentStoragePath WRITE setPersistentStoragePath NOTIFY persistentStoragePathChanged FINAL)
- Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath NOTIFY cachePathChanged FINAL)
- Q_PROPERTY(QString httpUserAgent READ httpUserAgent WRITE setHttpUserAgent NOTIFY httpUserAgentChanged FINAL)
- Q_PROPERTY(HttpCacheType httpCacheType READ httpCacheType WRITE setHttpCacheType NOTIFY httpCacheTypeChanged FINAL)
- Q_PROPERTY(QString httpAcceptLanguage READ httpAcceptLanguage WRITE setHttpAcceptLanguage NOTIFY httpAcceptLanguageChanged FINAL REVISION 1)
- Q_PROPERTY(PersistentCookiesPolicy persistentCookiesPolicy READ persistentCookiesPolicy WRITE setPersistentCookiesPolicy NOTIFY persistentCookiesPolicyChanged FINAL)
- Q_PROPERTY(int httpCacheMaximumSize READ httpCacheMaximumSize WRITE setHttpCacheMaximumSize NOTIFY httpCacheMaximumSizeChanged FINAL)
+class QQuickWebEngineProfilePrivate : public QtWebEngineCore::BrowserContextAdapterClient {
public:
- QQuickWebEngineProfile();
- ~QQuickWebEngineProfile();
-
- enum HttpCacheType {
- MemoryHttpCache,
- DiskHttpCache
- };
- Q_ENUM(HttpCacheType)
-
- enum PersistentCookiesPolicy {
- NoPersistentCookies,
- AllowPersistentCookies,
- ForcePersistentCookies
- };
- Q_ENUM(PersistentCookiesPolicy)
-
- QString storageName() const;
- void setStorageName(const QString &name);
-
- bool isOffTheRecord() const;
- void setOffTheRecord(bool offTheRecord);
-
- QString persistentStoragePath() const;
- void setPersistentStoragePath(const QString &path);
-
- QString cachePath() const;
- void setCachePath(const QString &path);
+ Q_DECLARE_PUBLIC(QQuickWebEngineProfile)
+ QQuickWebEngineProfilePrivate(QtWebEngineCore::BrowserContextAdapter* browserContext);
+ ~QQuickWebEngineProfilePrivate();
- QString httpUserAgent() const;
- void setHttpUserAgent(const QString &userAgent);
+ QtWebEngineCore::BrowserContextAdapter *browserContext() const { return m_browserContextRef.data(); }
+ QQuickWebEngineSettings *settings() const { return m_settings.data(); }
- HttpCacheType httpCacheType() const;
- void setHttpCacheType(QQuickWebEngineProfile::HttpCacheType);
+ void cancelDownload(quint32 downloadId);
+ void downloadDestroyed(quint32 downloadId);
- PersistentCookiesPolicy persistentCookiesPolicy() const;
- void setPersistentCookiesPolicy(QQuickWebEngineProfile::PersistentCookiesPolicy);
-
- int httpCacheMaximumSize() const;
- void setHttpCacheMaximumSize(int maxSize);
-
- QString httpAcceptLanguage() const;
- void setHttpAcceptLanguage(const QString &httpAcceptLanguage);
-
- static QQuickWebEngineProfile *defaultProfile();
-
- Q_REVISION(1) Q_INVOKABLE QWebEngineCookieStore *cookieStore() const;
- Q_REVISION(2) Q_INVOKABLE void clearHttpCache();
-
-signals:
- void storageNameChanged();
- void offTheRecordChanged();
- void persistentStoragePathChanged();
- void cachePathChanged();
- void httpUserAgentChanged();
- void httpCacheTypeChanged();
- void persistentCookiesPolicyChanged();
- void httpCacheMaximumSizeChanged();
- Q_REVISION(1) void httpAcceptLanguageChanged();
-
- void downloadRequested(QQuickWebEngineDownloadItem *download);
- void downloadFinished(QQuickWebEngineDownloadItem *download);
+ void downloadRequested(DownloadItemInfo &info) Q_DECL_OVERRIDE;
+ void downloadUpdated(const DownloadItemInfo &info) Q_DECL_OVERRIDE;
private:
- Q_DECLARE_PRIVATE(QQuickWebEngineProfile)
- QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *, QObject *parent = 0);
- QQuickWebEngineSettings *settings() const;
-
- friend class QQuickWebEngineSettings;
- friend class QQuickWebEngineSingleton;
friend class QQuickWebEngineViewPrivate;
- friend class QQuickWebEngineDownloadItem;
- friend class QQuickWebEngineDownloadItemPrivate;
- QScopedPointer<QQuickWebEngineProfilePrivate> d_ptr;
+ QQuickWebEngineProfile *q_ptr;
+ QScopedPointer<QQuickWebEngineSettings> m_settings;
+ QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef;
+ QMap<quint32, QPointer<QQuickWebEngineDownloadItem> > m_ongoingDownloads;
};
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebenginescript.cpp b/src/webengine/api/qquickwebenginescript.cpp
index 71dad701f..a19ec1534 100644
--- a/src/webengine/api/qquickwebenginescript.cpp
+++ b/src/webengine/api/qquickwebenginescript.cpp
@@ -40,7 +40,6 @@
#include <QQmlFile>
#include <QtCore/QDebug>
#include <QtCore/QFile>
-#include <QtCore/QStringBuilder>
#include <QtCore/QTimerEvent>
#include "user_script_controller_host.h"
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index 79819efc3..5bbca191d 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -36,9 +36,9 @@
#include "qquickwebenginesettings_p.h"
-#include "qquickwebengineprofile_p.h"
#include "web_engine_settings.h"
+#include <QtWebEngine/QQuickWebEngineProfile>
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
diff --git a/src/webengine/api/qquickwebenginesingleton.cpp b/src/webengine/api/qquickwebenginesingleton.cpp
index 7ff974eb4..b7a8c3b69 100644
--- a/src/webengine/api/qquickwebenginesingleton.cpp
+++ b/src/webengine/api/qquickwebenginesingleton.cpp
@@ -37,14 +37,14 @@
#include "qquickwebenginesingleton_p.h"
#include "qquickwebenginesettings_p.h"
-#include "qquickwebengineprofile_p.h"
+#include <QtWebEngine/QQuickWebEngineProfile>
QT_BEGIN_NAMESPACE
/*!
\qmltype WebEngine
\instantiates QQuickWebEngineSingleton
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.1
\brief Provides access to the default settings and profiles shared by all web engine views.
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 4cff0fc8c..61a19faa5 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -48,7 +48,6 @@
#include "qquickwebenginenavigationrequest_p.h"
#include "qquickwebenginenewviewrequest_p.h"
#include "qquickwebengineprofile_p.h"
-#include "qquickwebengineprofile_p_p.h"
#include "qquickwebenginesettings_p.h"
#include "qquickwebenginescript_p_p.h"
@@ -74,9 +73,10 @@
#include <QQmlEngine>
#include <QQmlProperty>
#include <QQmlWebChannel>
+#include <QQuickWebEngineProfile>
#include <QScreen>
-#include <QStringBuilder>
#include <QUrl>
+#include <QTimer>
#ifndef QT_NO_ACCESSIBILITY
#include <private/qquickaccessibleattached_p.h>
#endif // QT_NO_ACCESSIBILITY
@@ -105,12 +105,13 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
#endif
, contextMenuExtraItems(0)
, loadProgress(0)
- , m_isFullScreen(false)
+ , m_fullscreenMode(false)
, isLoading(false)
, m_activeFocusOnPress(true)
, devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_dpiScale(1.0)
, m_backgroundColor(Qt::white)
+ , m_webChannel(0)
{
// The gold standard for mobile web content is 160 dpi, and the devicePixelRatio expected
// is the (possibly quantized) ratio of device dpi to 160 dpi.
@@ -178,7 +179,9 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu
{
Q_Q(QQuickWebEngineView);
- QObject *menu = ui()->addMenu(0, QString(), data.pos);
+ // Assign the WebEngineView as the parent of the menu, so mouse events are properly propagated
+ // on OSX.
+ QObject *menu = ui()->addMenu(q, QString(), data.pos);
if (!menu)
return false;
@@ -525,6 +528,11 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(WebContentsAdapter *newWebConten
Q_EMIT q->newViewRequested(&request);
}
+bool QQuickWebEngineViewPrivate::isBeingAdopted()
+{
+ return false;
+}
+
void QQuickWebEngineViewPrivate::close()
{
Q_Q(QQuickWebEngineView);
@@ -548,7 +556,7 @@ void QQuickWebEngineViewPrivate::requestFullScreenMode(const QUrl &origin, bool
bool QQuickWebEngineViewPrivate::isFullScreenMode() const
{
- return m_isFullScreen;
+ return m_fullscreenMode;
}
void QQuickWebEngineViewPrivate::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID)
@@ -716,11 +724,6 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
Q_Q(QQuickWebEngineView);
- // memorize what webChannel we had for the previous adapter
- QQmlWebChannel *qmlWebChannel = NULL;
- if (adapter)
- qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel());
-
// This throws away the WebContentsAdapter that has been used until now.
// All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter.
WebContentsAdapterOwner *adapterOwner = new WebContentsAdapterOwner(adapter);
@@ -729,8 +732,12 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
adapter->initialize(this);
// associate the webChannel with the new adapter
- if (qmlWebChannel)
- adapter->setWebChannel(qmlWebChannel);
+ if (m_webChannel)
+ adapter->setWebChannel(m_webChannel);
+
+ // set initial background color if non-default
+ if (m_backgroundColor != Qt::white)
+ adapter->backgroundColorChanged();
// re-bind the userscrips to the new adapter
Q_FOREACH (QQuickWebEngineScript *script, m_userScripts)
@@ -772,6 +779,10 @@ void QQuickWebEngineViewPrivate::ensureContentsAdapter()
if (!adapter) {
adapter = new WebContentsAdapter();
adapter->initialize(this);
+ if (m_backgroundColor != Qt::white)
+ adapter->backgroundColorChanged();
+ if (m_webChannel)
+ adapter->setWebChannel(m_webChannel);
if (explicitUrl.isValid())
adapter->load(explicitUrl);
// push down the page's user scripts
@@ -780,6 +791,16 @@ void QQuickWebEngineViewPrivate::ensureContentsAdapter()
}
}
+void QQuickWebEngineViewPrivate::setFullScreenMode(bool fullscreen)
+{
+ Q_Q(QQuickWebEngineView);
+ if (m_fullscreenMode != fullscreen) {
+ m_fullscreenMode = fullscreen;
+ adapter->changedFullScreen();
+ Q_EMIT q->isFullScreenChanged();
+ }
+}
+
QUrl QQuickWebEngineView::url() const
{
Q_D(const QQuickWebEngineView);
@@ -795,7 +816,7 @@ void QQuickWebEngineView::setUrl(const QUrl& url)
d->explicitUrl = url;
if (d->adapter)
d->adapter->load(url);
- if (!qmlEngine(this))
+ if (!qmlEngine(this) || isComponentComplete())
d->ensureContentsAdapter();
}
@@ -809,7 +830,7 @@ void QQuickWebEngineView::loadHtml(const QString &html, const QUrl &baseUrl)
{
Q_D(QQuickWebEngineView);
d->explicitUrl = QUrl();
- if (!qmlEngine(this))
+ if (!qmlEngine(this) || isComponentComplete())
d->ensureContentsAdapter();
if (d->adapter)
d->adapter->setContent(html.toUtf8(), QStringLiteral("text/html;charset=UTF-8"), baseUrl);
@@ -909,11 +930,8 @@ void QQuickWebEngineViewPrivate::setProfile(QQuickWebEngineProfile *profile)
if (adapter && adapter->browserContext() != browserContextAdapter()->browserContext()) {
// When the profile changes we need to create a new WebContentAdapter and reload the active URL.
QUrl activeUrl = adapter->activeUrl();
- QQmlWebChannel *qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel());
adapter = 0;
ensureContentsAdapter();
- if (qmlWebChannel)
- adapter->setWebChannel(qmlWebChannel);
if (!explicitUrl.isValid() && activeUrl.isValid())
adapter->load(activeUrl);
@@ -1051,8 +1069,7 @@ bool QQuickWebEngineView::canGoForward() const
void QQuickWebEngineView::runJavaScript(const QString &script, const QJSValue &callback)
{
Q_D(QQuickWebEngineView);
- if (!d->adapter)
- return;
+ d->ensureContentsAdapter();
if (!callback.isUndefined()) {
quint64 requestId = d_ptr->adapter->runJavaScriptCallbackResult(script, QQuickWebEngineScript::MainWorld);
d->m_callbacks.insert(requestId, callback);
@@ -1110,8 +1127,8 @@ void QQuickWebEngineView::setBackgroundColor(const QColor &color)
if (color == d->m_backgroundColor)
return;
d->m_backgroundColor = color;
- d->ensureContentsAdapter();
- d->adapter->backgroundColorChanged();
+ if (d->adapter)
+ d->adapter->backgroundColorChanged();
emit backgroundColorChanged();
}
@@ -1145,7 +1162,7 @@ bool QQuickWebEngineView::wasRecentlyAudible()
bool QQuickWebEngineView::isFullScreen() const
{
Q_D(const QQuickWebEngineView);
- return d->m_isFullScreen;
+ return d->m_fullscreenMode;
}
void QQuickWebEngineViewExperimental::setExtraContextMenuEntriesComponent(QQmlComponent *contextMenuExtras)
@@ -1189,23 +1206,24 @@ QQuickWebEngineHistory *QQuickWebEngineView::navigationHistory() const
QQmlWebChannel *QQuickWebEngineView::webChannel()
{
Q_D(QQuickWebEngineView);
- d->ensureContentsAdapter();
- QQmlWebChannel *qmlWebChannel = qobject_cast<QQmlWebChannel *>(d->adapter->webChannel());
- Q_ASSERT(!d->adapter->webChannel() || qmlWebChannel);
- if (!qmlWebChannel) {
- qmlWebChannel = new QQmlWebChannel(this);
- d->adapter->setWebChannel(qmlWebChannel);
+ if (!d->m_webChannel) {
+ d->m_webChannel = new QQmlWebChannel(this);
+ if (d->adapter)
+ d->adapter->setWebChannel(d->m_webChannel);
}
- return qmlWebChannel;
+
+ return d->m_webChannel;
}
void QQuickWebEngineView::setWebChannel(QQmlWebChannel *webChannel)
{
Q_D(QQuickWebEngineView);
- bool notify = (d->adapter->webChannel() == webChannel);
- d->adapter->setWebChannel(webChannel);
- if (notify)
- Q_EMIT webChannelChanged();
+ if (d->m_webChannel == webChannel)
+ return;
+ d->m_webChannel = webChannel;
+ if (d->adapter)
+ d->adapter->setWebChannel(webChannel);
+ Q_EMIT webChannelChanged();
}
void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineView::Feature feature, bool granted)
@@ -1263,10 +1281,7 @@ void QQuickWebEngineView::goBackOrForward(int offset)
void QQuickWebEngineView::fullScreenCancelled()
{
Q_D(QQuickWebEngineView);
- if (d->m_isFullScreen) {
- d->m_isFullScreen = false;
- Q_EMIT isFullScreenChanged();
- }
+ d->adapter->exitFullScreen();
}
void QQuickWebEngineView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
@@ -1543,19 +1558,24 @@ void QQuickWebEngineViewPrivate::userScripts_clear(QQmlListProperty<QQuickWebEng
void QQuickWebEngineView::componentComplete()
{
- Q_D(QQuickWebEngineView);
QQuickItem::componentComplete();
+ QTimer::singleShot(0, this, &QQuickWebEngineView::lazyInitialize);
+}
+
+void QQuickWebEngineView::lazyInitialize()
+{
+ Q_D(QQuickWebEngineView);
d->ensureContentsAdapter();
}
QQuickWebEngineFullScreenRequest::QQuickWebEngineFullScreenRequest()
- : viewPrivate(0)
+ : m_viewPrivate(0)
, m_toggleOn(false)
{
}
QQuickWebEngineFullScreenRequest::QQuickWebEngineFullScreenRequest(QQuickWebEngineViewPrivate *viewPrivate, const QUrl &origin, bool toggleOn)
- : viewPrivate(viewPrivate)
+ : m_viewPrivate(viewPrivate)
, m_origin(origin)
, m_toggleOn(toggleOn)
{
@@ -1563,18 +1583,14 @@ QQuickWebEngineFullScreenRequest::QQuickWebEngineFullScreenRequest(QQuickWebEngi
void QQuickWebEngineFullScreenRequest::accept()
{
- if (viewPrivate && viewPrivate->m_isFullScreen != m_toggleOn) {
- viewPrivate->m_isFullScreen = m_toggleOn;
- viewPrivate->adapter->changedFullScreen();
- Q_EMIT viewPrivate->q_ptr->isFullScreenChanged();
- }
+ if (m_viewPrivate)
+ m_viewPrivate->setFullScreenMode(m_toggleOn);
}
void QQuickWebEngineFullScreenRequest::reject()
{
- if (viewPrivate) {
- viewPrivate->adapter->changedFullScreen();
- }
+ if (m_viewPrivate)
+ m_viewPrivate->setFullScreenMode(!m_toggleOn);
}
QQuickWebEngineViewExperimental::QQuickWebEngineViewExperimental(QQuickWebEngineViewPrivate *viewPrivate)
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 093b82c60..43cdcb73e 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -83,7 +83,7 @@ public:
bool toggleOn() const { return m_toggleOn; }
private:
- QQuickWebEngineViewPrivate *viewPrivate;
+ QQuickWebEngineViewPrivate *m_viewPrivate;
const QUrl m_origin;
const bool m_toggleOn;
};
@@ -301,6 +301,9 @@ public Q_SLOTS:
Q_REVISION(3) void setAudioMuted(bool muted);
Q_REVISION(3) bool wasRecentlyAudible();
+private Q_SLOTS:
+ void lazyInitialize();
+
Q_SIGNALS:
void titleChanged();
void urlChanged();
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index beb5b49bc..dd20c8972 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -143,6 +143,7 @@ public:
virtual void focusContainer() Q_DECL_OVERRIDE;
virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) Q_DECL_OVERRIDE;
+ virtual bool isBeingAdopted() Q_DECL_OVERRIDE;
virtual void close() Q_DECL_OVERRIDE;
virtual void windowCloseRejected() Q_DECL_OVERRIDE;
virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) Q_DECL_OVERRIDE;
@@ -184,6 +185,7 @@ public:
void adoptWebContents(QtWebEngineCore::WebContentsAdapter *webContents);
void setProfile(QQuickWebEngineProfile *profile);
void ensureContentsAdapter();
+ void setFullScreenMode(bool);
// QQmlListPropertyHelpers
static void userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script);
@@ -205,12 +207,13 @@ public:
QUrl explicitUrl;
QUrl icon;
int loadProgress;
- bool m_isFullScreen;
+ bool m_fullscreenMode;
bool isLoading;
bool m_activeFocusOnPress;
qreal devicePixelRatio;
QMap<quint64, QJSValue> m_callbacks;
QList<QSharedPointer<CertificateErrorController> > m_certificateErrorControllers;
+ QQmlWebChannel *m_webChannel;
private:
QScopedPointer<QtWebEngineCore::UIDelegatesManager> m_uIDelegatesManager;
diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp
index 07561be6e..8efbc3799 100644
--- a/src/webengine/api/qtwebengineglobal.cpp
+++ b/src/webengine/api/qtwebengineglobal.cpp
@@ -36,15 +36,13 @@
#include "qtwebengineglobal.h"
-#include <QGuiApplication>
-#include <QOpenGLContext>
-#include <QThread>
+namespace QtWebEngineCore
+{
+ extern void initialize();
+}
QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
-Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
-
namespace QtWebEngine {
/*!
@@ -58,19 +56,6 @@ namespace QtWebEngine {
The \l[CPP]{QtWebEngine} namespace is part of the Qt WebEngine module.
*/
-static QOpenGLContext *shareContext;
-
-static void deleteShareContext()
-{
- delete shareContext;
- shareContext = 0;
-}
-
-// ### Qt 6: unify this logic and Qt::AA_ShareOpenGLContexts.
-// QtWebEngine::initialize was introduced first and meant to be called
-// after the QGuiApplication creation, when AA_ShareOpenGLContexts fills
-// the same need but the flag has to be set earlier.
-
/*!
\fn QtWebEngine::initialize()
@@ -82,34 +67,7 @@ static void deleteShareContext()
*/
void initialize()
{
-#ifdef Q_OS_WIN32
- qputenv("QT_D3DCREATE_MULTITHREADED", "1");
-#endif
-
- // No need to override the shared context if QApplication already set one (e.g with Qt::AA_ShareOpenGLContexts).
- if (qt_gl_global_share_context())
- return;
-
- QCoreApplication *app = QCoreApplication::instance();
- if (!app) {
- qFatal("QtWebEngine::initialize() must be called after the construction of the application object.");
- return;
- }
- if (app->thread() != QThread::currentThread()) {
- qFatal("QtWebEngine::initialize() must be called from the Qt gui thread.");
- return;
- }
-
- if (shareContext)
- return;
-
- shareContext = new QOpenGLContext;
- shareContext->create();
- qAddPostRoutine(deleteShareContext);
- qt_gl_set_global_share_context(shareContext);
-
- // Classes like QOpenGLWidget check for the attribute
- app->setAttribute(Qt::AA_ShareOpenGLContexts);
+ QtWebEngineCore::initialize();
}
} // namespace QtWebEngine
diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf
index 01485dc56..02f9a9ffd 100644
--- a/src/webengine/doc/qtwebengine.qdocconf
+++ b/src/webengine/doc/qtwebengine.qdocconf
@@ -39,6 +39,7 @@ tagfile = ../../../doc/qtwebengine/qtwebengine.tags
depends += qtcore \
qtgui \
+ qtnetwork \
qtqml \
qtquick \
qtquickcontrols \
diff --git a/src/webengine/doc/src/external-resources.qdoc b/src/webengine/doc/src/external-resources.qdoc
index 2987f1fca..38d8b637b 100644
--- a/src/webengine/doc/src/external-resources.qdoc
+++ b/src/webengine/doc/src/external-resources.qdoc
@@ -40,6 +40,16 @@
\title Chrome console API
*/
+/*!
+ \externalpage http://ffmpeg.org/
+ \title FFmpeg
+*/
+
+/*!
+ \externalpage http://www.openh264.org/
+ \title OpenH264
+*/
+
/*
This prevents autolinking of each occurrence of 'WebEngine'
To link to the WebEngine QML type, use explicit linking:
diff --git a/src/webengine/doc/src/qtwebengine-modules.qdoc b/src/webengine/doc/src/qtwebengine-modules.qdoc
index 8530f5d01..451165b26 100644
--- a/src/webengine/doc/src/qtwebengine-modules.qdoc
+++ b/src/webengine/doc/src/qtwebengine-modules.qdoc
@@ -42,4 +42,7 @@
\section2 Qt WebEngineWidgets Module
\generatelist {classesbymodule QtWebEngineWidgets}
+
+ \section2 Qt WebEngine Module
+ \generatelist {classesbymodule QtWebEngine}
*/
diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc
index 8be4adda0..ca60fedc2 100644
--- a/src/webengine/doc/src/qtwebengine-overview.qdoc
+++ b/src/webengine/doc/src/qtwebengine-overview.qdoc
@@ -127,6 +127,17 @@
}
\endqml
+ \section1 Managing Certificates
+
+ Qt WebEngine uses its own network stack, and therefore QSslConfiguration is not used to
+ open SSL connections. Instead, Qt WebEngine uses the root CA certificates from the operating
+ system to validate the peer's certificate.
+
+ The \l{WebEngineCertificateError::error} and \l{QWebEngineCertificateError::Error} enumerations
+ provide information about the types of certificate errors that might occur. The errors can be
+ handled by using the WebEngineView::certificateError QML method or by reimplementing the
+ QWebEnginePage::certificateError function.
+
\section1 Using WebEngine Core
Qt WebEngine Core provides an API shared by Qt WebEngine and Qt WebEngine Widgets for handling
diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
index 0898a72fc..555db2a2d 100644
--- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
+++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
@@ -50,11 +50,31 @@
\li OS X: Xcode version 5.1 or later
\endlist
- \section1 Adobe Flash Player Plugin Support
+ \section1 Pepper Plugin API Support
- Qt WebEngine supports the Adobe Flash player plugin that is a Pepper Plugin API (PPAPI)
- plugin. The plugin must be installed in one of the following locations, depending on the
- platform:
+ Qt WebEngine supports loading Pepper Plugin API (PPAPI) plugins. The plugins must be loaded
+ manually using the Chromium command line syntax with the \c --register-pepper-plugins argument.
+ The argument value is a list of entries, separated by commas, that contain the file path and
+ one or several MIME types, separated by semicolons:
+
+ \code
+ <file-path-plugin1>;<mime-type-plugin1>,<file-path-plugin2>;<mime-type1-plugin2>;<mime-type2-plugin2>
+ \endcode
+
+ For example:
+
+ \code
+ --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example"
+ \endcode
+
+ The MIME type is important because it determines which embeds the plugin is used for.
+
+ This process has been automated for the Adobe Flash Player Plugin.
+
+ \section2 Adobe Flash Player Plugin Support
+
+ The Adobe Flash player plugin can be loaded automatically if it is installed in one of the
+ following locations, depending on the platform:
\list
\li Windows
@@ -79,4 +99,21 @@
\code
--ppapi-flash-path=./libpepflashplayer.so
\endcode
+
+ \section1 Audio and Video Codec Support
+
+ Qt WebEngine supports the MPEG-4 Part 14 (MP4) file format only if the required proprietary
+ audio and video codecs, such as H.264 and MPEG layer-3 (MP3), have been enabled. Proprietary
+ codecs can be enabled by passing the following option to qmake:
+
+ \code
+ qmake WEBENGINE_CONFIG += use_proprietary_codecs
+ \endcode
+
+ \warning When distributing proprietary codec libraries, you must acquire licenses for them.
+
+ \l FFmpeg is a cross-platform solution to record, convert, and stream audio and video. It can
+ be configured for use with several codecs, which rises licensing issues during distribution
+ with the codec libraries. For some codecs, open source implementations, such as \l {OpenH264},
+ are available.
*/
diff --git a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
index 89ff6f0b3..7fcddb373 100644
--- a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
+++ b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
@@ -24,7 +24,7 @@
*/
/*!
- \qmlmodule QtWebEngine 1.1
+ \qmlmodule QtWebEngine 1.2
\title Qt WebEngine QML Types
\brief Provides QML types for rendering web content within a QML application
\ingroup qtwebengine-qmlmodules
diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc
index 49717ae50..39441228d 100644
--- a/src/webengine/doc/src/webengineview.qdoc
+++ b/src/webengine/doc/src/webengineview.qdoc
@@ -26,7 +26,7 @@
/*!
\qmltype WebEngineView
\instantiates QQuickWebEngineView
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.0
\brief A WebEngineView renders web content within a QML application.
*/
@@ -698,7 +698,7 @@
/*!
\qmltype WebEngineFullScreenRequest
\instantiates QQuickWebEngineFullScreenRequest
- \inqmlmodule QtWebEngine 1.1
+ \inqmlmodule QtWebEngine
\since QtWebEngine 1.1
\brief A utility type for the WebEngineView::fullScreenRequested() signal.
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index c59dfb450..5eee75e7f 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include <QtQml/qqmlextensionplugin.h>
+#include <QtWebEngine/QQuickWebEngineProfile>
#include "qquickwebenginecertificateerror_p.h"
#include "qquickwebenginedownloaditem_p.h"
@@ -42,7 +43,6 @@
#include "qquickwebengineloadrequest_p.h"
#include "qquickwebenginenavigationrequest_p.h"
#include "qquickwebenginenewviewrequest_p.h"
-#include "qquickwebengineprofile_p.h"
#include "qquickwebenginesettings_p.h"
#include "qquickwebenginesingleton_p.h"
#include "qquickwebengineview_p.h"
@@ -77,6 +77,8 @@ public:
qmlRegisterUncreatableType<QQuickWebEngineCertificateError>(uri, 1, 1, "WebEngineCertificateError", tr("Cannot create separate instance of WebEngineCertificateError"));
qmlRegisterUncreatableType<QQuickWebEngineDownloadItem>(uri, 1, 1, "WebEngineDownloadItem",
tr("Cannot create a separate instance of WebEngineDownloadItem"));
+ qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 1>(uri, 1, 2, "WebEngineDownloadItem",
+ tr("Cannot create a separate instance of WebEngineDownloadItem"));
qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 1, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest"));
qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 1, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
// FIXME(QTBUG-40043): qmlRegisterUncreatableType<QQuickWebEngineSettings, 1>(uri, 1, 2, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index 9fc1ed3eb..508420cf8 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -268,10 +268,15 @@ void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const It
if (value.window) {
m_windowConnections.append(connect(value.window, SIGNAL(xChanged(int)), SLOT(onWindowPosChanged())));
m_windowConnections.append(connect(value.window, SIGNAL(yChanged(int)), SLOT(onWindowPosChanged())));
+ if (!m_isPopup)
+ m_windowConnections.append(connect(value.window, SIGNAL(closing(QQuickCloseEvent *)), SLOT(onHide())));
}
if (m_initialized)
m_client->windowChanged();
+ } else if (change == QQuickItem::ItemVisibleHasChanged) {
+ if (!m_isPopup && !value.boolValue)
+ onHide();
}
}
@@ -285,4 +290,10 @@ void RenderWidgetHostViewQtDelegateQuick::onWindowPosChanged()
m_client->windowBoundsChanged();
}
+void RenderWidgetHostViewQtDelegateQuick::onHide()
+{
+ QFocusEvent event(QEvent::FocusOut, Qt::OtherFocusReason);
+ m_client->forwardEvent(&event);
+}
+
} // namespace QtWebEngineCore
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h
index eb2860b27..7c44da9b9 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h
@@ -92,6 +92,7 @@ protected:
private slots:
void onWindowPosChanged();
+ void onHide();
private:
RenderWidgetHostViewQtDelegateClient *m_client;
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 2714af9ab..b9162f9b9 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -208,7 +208,7 @@ QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title,
return 0;
QQmlContext *context = qmlContext(m_view);
QObject *menu = menuComponent->beginCreate(context);
- // Useful when not using Qt Quick Controls' Menu
+ // set visual parent for non-Window-based menus
if (QQuickItem* item = qobject_cast<QQuickItem*>(menu))
item->setParentItem(m_view);
@@ -284,6 +284,9 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
QQmlContext *context = qmlContext(m_view);
QObject *dialog = dialogComponent->beginCreate(context);
+ // set visual parent for non-Window-based dialogs
+ if (QQuickItem* item = qobject_cast<QQuickItem*>(dialog))
+ item->setParentItem(m_view);
dialog->setParent(m_view);
QQmlProperty textProp(dialog, QStringLiteral("text"));
textProp.write(dialogController->message());
@@ -369,6 +372,9 @@ void UIDelegatesManager::showDialog(QSharedPointer<AuthenticationDialogControlle
QQmlContext *context = qmlContext(m_view);
QObject *authenticationDialog = authenticationDialogComponent->beginCreate(context);
+ // set visual parent for non-Window-based dialogs
+ if (QQuickItem* item = qobject_cast<QQuickItem*>(authenticationDialog))
+ item->setParentItem(m_view);
authenticationDialog->setParent(m_view);
QString introMessage;
diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro
index 8bb5a8e77..8f802d5c4 100644
--- a/src/webengine/webengine.pro
+++ b/src/webengine/webengine.pro
@@ -37,8 +37,8 @@ HEADERS = \
api/qquickwebengineloadrequest_p.h \
api/qquickwebenginenavigationrequest_p.h \
api/qquickwebenginenewviewrequest_p.h \
+ api/qquickwebengineprofile.h \
api/qquickwebengineprofile_p.h \
- api/qquickwebengineprofile_p_p.h \
api/qquickwebenginescript_p.h \
api/qquickwebenginesettings_p.h \
api/qquickwebenginesingleton_p.h \
diff --git a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp
index b17516ad6..b1a8f7b78 100644
--- a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp
+++ b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp
@@ -36,10 +36,14 @@
#include "qtwebenginewidgetsglobal.h"
-#include "qtwebengineglobal.h"
#include <QCoreApplication>
#include <QOpenGLContext>
+namespace QtWebEngineCore
+{
+ extern void initialize();
+}
+
QT_BEGIN_NAMESPACE
static void initialize()
{
@@ -52,7 +56,7 @@ static void initialize()
return;
}
#endif
- qAddPreRoutine(QtWebEngine::initialize);
+ qAddPreRoutine(QtWebEngineCore::initialize);
}
Q_CONSTRUCTOR_FUNCTION(initialize)
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index 9650f5e0e..bc7e3932c 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -261,6 +261,18 @@ QUrl QWebEngineDownloadItem::url() const
}
/*!
+ \since 5.6
+
+ Returns the MIME type of the download.
+*/
+
+QString QWebEngineDownloadItem::mimeType() const
+{
+ Q_D(const QWebEngineDownloadItem);
+ return d->mimeType;
+}
+
+/*!
Returns the full target path where data is being downloaded to.
The path includes the file name. The default suggested path is the standard download location
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h
index b0c4c2988..b1c00f28a 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.h
@@ -74,6 +74,7 @@ public:
qint64 totalBytes() const;
qint64 receivedBytes() const;
QUrl url() const;
+ QString mimeType() const;
QString path() const;
void setPath(QString path);
bool isFinished() const;
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem_p.h b/src/webenginewidgets/api/qwebenginedownloaditem_p.h
index ab38d7d03..cb8bbf000 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem_p.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem_p.h
@@ -71,6 +71,7 @@ public:
QWebEngineDownloadItem::SavePageFormat savePageFormat;
QString downloadPath;
const QUrl downloadUrl;
+ QString mimeType;
qint64 totalBytes;
qint64 receivedBytes;
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 60372dd40..d97cb5a09 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -92,6 +92,7 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
, view(0)
, isLoading(false)
, scriptCollection(new QWebEngineScriptCollectionPrivate(browserContextAdapter()->userScriptController(), adapter.data()))
+ , m_isBeingAdopted(false)
, m_backgroundColor(Qt::white)
, fullscreenMode(false)
{
@@ -218,7 +219,20 @@ void QWebEnginePagePrivate::adoptNewWindow(WebContentsAdapter *newWebContents, W
{
Q_Q(QWebEnginePage);
Q_UNUSED(userGesture);
+
QWebEnginePage *newPage = q->createWindow(toWindowType(disposition));
+
+ // Mark the new page as being in the process of being adopted, so that a second mouse move event
+ // sent by newWebContents->initialize() gets filtered in RenderWidgetHostViewQt::forwardEvent.
+ // The first mouse move event is being sent by q->createWindow(). This is necessary because
+ // Chromium does not get a mouse move acknowledgment message between the two events, and
+ // InputRouterImpl::ProcessMouseAck is not executed, thus all subsequent mouse move events
+ // get coalesced together, and don't get processed at all.
+ // The mouse move events are actually sent as a result of show() being called on
+ // RenderWidgetHostViewQtDelegateWidget, both when creating the window and when initialize is
+ // called.
+ newPage->d_func()->m_isBeingAdopted = true;
+
// Overwrite the new page's WebContents with ours.
if (newPage && newPage->d_func() != this) {
newPage->d_func()->adapter = newWebContents;
@@ -226,6 +240,14 @@ void QWebEnginePagePrivate::adoptNewWindow(WebContentsAdapter *newWebContents, W
if (!initialGeometry.isEmpty())
emit newPage->geometryChangeRequested(initialGeometry);
}
+
+ // Page has finished the adoption process.
+ newPage->d_func()->m_isBeingAdopted = false;
+}
+
+bool QWebEnginePagePrivate::isBeingAdopted()
+{
+ return m_isBeingAdopted;
}
void QWebEnginePagePrivate::close()
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index e7f4cac4e..3da336369 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -95,6 +95,7 @@ public:
virtual void focusContainer() Q_DECL_OVERRIDE;
virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry) Q_DECL_OVERRIDE;
+ virtual bool isBeingAdopted() Q_DECL_OVERRIDE;
virtual void close() Q_DECL_OVERRIDE;
virtual void windowCloseRejected() Q_DECL_OVERRIDE;
virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &data) Q_DECL_OVERRIDE;
@@ -153,6 +154,7 @@ public:
QtWebEngineCore::WebEngineContextMenuData m_menuData;
bool isLoading;
QWebEngineScriptCollection scriptCollection;
+ bool m_isBeingAdopted;
QColor m_backgroundColor;
bool fullscreenMode;
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 286889c1f..c64a883d3 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -156,6 +156,7 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
itemPrivate->downloadId = info.id;
itemPrivate->downloadState = QWebEngineDownloadItem::DownloadRequested;
itemPrivate->downloadPath = info.path;
+ itemPrivate->mimeType = info.mimeType;
itemPrivate->savePageFormat = static_cast<QWebEngineDownloadItem::SavePageFormat>(info.savePageFormat);
QWebEngineDownloadItem *download = new QWebEngineDownloadItem(itemPrivate, q);
diff --git a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
index 1f3e618c2..ca1309718 100644
--- a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
@@ -35,7 +35,6 @@
\l{http://doc.qt.io/archives/qt-5.3/qml-qtwebkit-webview.html}{QWebView API} to use the
\l{Qt WebEngine} QWebEngineView.
-
\section1 Class Names
The Qt WebEngine equivalent of Qt WebKit C++ classes are prefixed by
@@ -199,6 +198,8 @@
connect(&page, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authenticate(QNetworkReply*,QAuthenticator*)));
\endcode
+ This also affects the way in which certificates are managed. For more information, see
+ \l {Managing Certificates}.
\section1 Notes About Individual Methods
@@ -264,7 +265,8 @@
\li The Web SQL Database feature that this API was wrapping in Qt WebKit
was dropped from the HTML5 standard.
\row
- \li QWebPluginFactory, QWebPage::setPalette, QWebView::setRenderHints
+ \li QWebPluginDatabase, QWebPluginFactory, QWebPluginInfo, QWebPage::setPalette,
+ QWebView::setRenderHints
\li Qt WebEngine renders web pages using Skia and is not using QPainter
or Qt for this purpose. The HTML5 standard also now offers much
better alternatives that were not available when native controls
@@ -272,5 +274,10 @@
\row
\li QWebHistoryInterface
\li Visited links are persisted automatically by Qt WebEngine.
+ \row
+ \li QWebPage::setContentEditable
+ \li In the latest HTML standard, any document element can be made editable through the
+ \c contentEditable attribute. So \c runJavaScript is all that is needed:
+ \c{page->runJavascript("document.documentElement.contentEditable = true")}
\endtable
*/
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index 57631c4cc..9871ecfb1 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -290,6 +290,12 @@ void RenderWidgetHostViewQtDelegateWidget::initializeGL()
m_sgRenderer.reset(m_sgEngine->createRenderer());
m_sgRenderer->setRootNode(m_rootNode.data());
m_sgRenderer->setClearColor(m_clearColor);
+
+ // When RenderWidgetHostViewQt::GetScreenInfo is called for the first time, the associated
+ // QWindow is NULL, and the screen device pixel ratio can not be queried.
+ // Re-initialize the screen information after the QWindow handle is available,
+ // so Chromium receives the correct device pixel ratio.
+ m_client->windowChanged();
}
void RenderWidgetHostViewQtDelegateWidget::paintGL()
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index 4622d0028..5687bffaf 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -3,7 +3,7 @@ TARGET = QtWebEngineWidgets
# For our export macros
DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB
-QT += webengine webenginecore widgets network quick
+QT += webenginecore widgets network quick
QT_PRIVATE += quick-private gui-private core-private
INCLUDEPATH += $$PWD api ../core ../core/api ../webengine/api
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 135d9167f..face62352 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -46,6 +46,7 @@
#include <QMetaType>
#include <QQmlListProperty>
#include <QtTest/QtTest>
+#include <QtWebEngine/QQuickWebEngineProfile>
#include <private/qquickwebengineview_p.h>
#include <private/qquickwebenginecertificateerror_p.h>
#include <private/qquickwebenginedownloaditem_p.h>
@@ -53,7 +54,6 @@
#include <private/qquickwebengineloadrequest_p.h>
#include <private/qquickwebenginenavigationrequest_p.h>
#include <private/qquickwebenginenewviewrequest_p.h>
-#include <private/qquickwebengineprofile_p.h>
#include <private/qquickwebenginescript_p.h>
#include <private/qquickwebenginesettings_p.h>
#include <private/qquickwebenginesingleton_p.h>
@@ -149,6 +149,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.DownloadMediaToDisk --> WebAction"
<< "QQuickWebEngineView.InspectElement --> WebAction"
<< "QQuickWebEngineView.ExitFullScreen --> WebAction"
+ << "QQuickWebEngineView.RequestClose --> WebAction"
<< "QQuickWebEngineView.WebActionCount --> WebAction"
<< "QQuickWebEngineView.InfoMessageLevel --> JavaScriptConsoleMessageLevel"
<< "QQuickWebEngineView.WarningMessageLevel --> JavaScriptConsoleMessageLevel"
@@ -195,6 +196,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.activeFocusOnPressChanged(bool) --> void"
<< "QQuickWebEngineView.backgroundColorChanged() --> void"
<< "QQuickWebEngineView.renderProcessTerminated(RenderProcessTerminationStatus,int) --> void"
+ << "QQuickWebEngineView.windowCloseRequested() --> void"
<< "QQuickWebEngineView.runJavaScript(QString,QJSValue) --> void"
<< "QQuickWebEngineView.runJavaScript(QString) --> void"
<< "QQuickWebEngineView.loadHtml(QString,QUrl) --> void"
@@ -289,7 +291,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void"
<< "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void"
<< "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void"
- << "QQuickWebEngineProfile.setCookieStore(QWebEngineCookieStore*) --> void"
+ << "QQuickWebEngineProfile.cookieStore() --> QWebEngineCookieStore*"
<< "QQuickWebEngineScript.Deferred --> InjectionPoint"
<< "QQuickWebEngineScript.DocumentReady --> InjectionPoint"
<< "QQuickWebEngineScript.DocumentCreation --> InjectionPoint"
@@ -343,8 +345,10 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineSettings.pluginsEnabledChanged() --> void"
<< "QQuickWebEngineSettings.fullScreenSupportEnabledChanged() --> void"
<< "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void"
+ << "QQuickWebEngineFullScreenRequest.origin --> QUrl"
<< "QQuickWebEngineFullScreenRequest.toggleOn --> bool"
<< "QQuickWebEngineFullScreenRequest.accept() --> void"
+ << "QQuickWebEngineFullScreenRequest.reject() --> void"
<< "QQuickWebEngineSingleton.settings --> QQuickWebEngineSettings*"
<< "QQuickWebEngineSingleton.defaultProfile --> QQuickWebEngineProfile*"
;
diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml
index ffd7041e3..415318ed7 100644
--- a/tests/auto/quick/qmltests/data/tst_download.qml
+++ b/tests/auto/quick/qmltests/data/tst_download.qml
@@ -66,23 +66,26 @@ TestWebEngineView {
signalName: "downloadFinished"
}
+ Connections {
+ id: downloadItemConnections
+ onStateChanged: downloadState.push(target.state)
+ }
+
WebEngineProfile {
id: testDownloadProfile
onDownloadRequested: {
downloadState.push(download.state)
+ downloadItemConnections.target = download
if (cancelDownload) {
download.cancel()
- downloadState.push(download.state)
} else {
totalBytes = download.totalBytes
download.path = "testfile.zip"
download.accept()
- downloadState.push(download.state)
}
}
onDownloadFinished: {
- downloadState.push(download.state)
receivedBytes = download.receivedBytes;
}
}
@@ -96,6 +99,7 @@ TestWebEngineView {
totalBytes = 0
receivedBytes = 0
cancelDownload = false
+ downloadItemConnections.target = null
downloadState = []
}
@@ -133,7 +137,7 @@ TestWebEngineView {
downLoadRequestedSpy.wait()
compare(downLoadRequestedSpy.count, 1)
compare(downloadFinishedSpy.count, 1)
- compare(downloadState[2], WebEngineDownloadItem.DownloadCancelled)
+ compare(downloadState[1], WebEngineDownloadItem.DownloadCancelled)
}
}
}
diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
index c8abf2bb0..31296f45c 100644
--- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml
+++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
@@ -144,6 +144,8 @@ TestWebEngineView {
var dataUrl = "data:text/html,foo"
webEngineView.url = dataUrl
compare(webEngineView.url, dataUrl)
+ verify(webEngineView.waitForLoadSucceeded()) // data:text/html,foo is loaded
+ compare(webEngineView.url, dataUrl)
var redirectUrl = Qt.resolvedUrl("redirect.html")
webEngineView.url = redirectUrl
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 40dc3cb61..cb566c254 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -61,7 +61,9 @@ private Q_SLOTS:
private:
inline QQuickWebEngineView *newWebEngineView();
inline QQuickWebEngineView *webEngineView() const;
+ QUrl urlFromTestPath(const char *localFilePath);
void runJavaScript(const QString &script);
+ QString m_testSourceDirPath;
QScopedPointer<TestWindow> m_window;
QScopedPointer<QQmlComponent> m_component;
};
@@ -70,6 +72,10 @@ tst_QQuickWebEngineView::tst_QQuickWebEngineView()
{
QtWebEngine::initialize();
+ m_testSourceDirPath = QString::fromLocal8Bit(TESTS_SOURCE_DIR);
+ if (!m_testSourceDirPath.endsWith(QLatin1Char('/')))
+ m_testSourceDirPath.append(QLatin1Char('/'));
+
static QQmlEngine *engine = new QQmlEngine(this);
m_component.reset(new QQmlComponent(engine, this));
m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n"
@@ -100,6 +106,11 @@ inline QQuickWebEngineView *tst_QQuickWebEngineView::webEngineView() const
return static_cast<QQuickWebEngineView*>(m_window->webEngineView.data());
}
+QUrl tst_QQuickWebEngineView::urlFromTestPath(const char *localFilePath)
+{
+ return QUrl::fromLocalFile(m_testSourceDirPath + QString::fromUtf8(localFilePath));
+}
+
void tst_QQuickWebEngineView::runJavaScript(const QString &script)
{
webEngineView()->runJavaScript(script);
@@ -119,7 +130,7 @@ void tst_QQuickWebEngineView::stopEnabledAfterLoadStarted()
QCOMPARE(webEngineView()->isLoading(), false);
LoadStartedCatcher catcher(webEngineView());
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
waitForSignal(&catcher, SIGNAL(finished()));
QCOMPARE(webEngineView()->isLoading(), true);
@@ -149,7 +160,7 @@ void tst_QQuickWebEngineView::loadEmptyPageViewHidden()
{
QSignalSpy loadSpy(webEngineView(), SIGNAL(loadingChanged(QQuickWebEngineLoadRequest*)));
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
QCOMPARE(loadSpy.size(), 2);
@@ -159,7 +170,7 @@ void tst_QQuickWebEngineView::loadNonexistentFileUrl()
{
QSignalSpy loadSpy(webEngineView(), SIGNAL(loadingChanged(QQuickWebEngineLoadRequest*)));
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/file_that_does_not_exist.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/file_that_does_not_exist.html"));
QVERIFY(waitForLoadFailed(webEngineView()));
QCOMPARE(loadSpy.size(), 2);
@@ -167,46 +178,46 @@ void tst_QQuickWebEngineView::loadNonexistentFileUrl()
void tst_QQuickWebEngineView::backAndForward()
{
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page2.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page2.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page2.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page2.html"));
webEngineView()->goBack();
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
webEngineView()->goForward();
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page2.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page2.html"));
}
void tst_QQuickWebEngineView::reload()
{
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
webEngineView()->reload();
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
}
void tst_QQuickWebEngineView::stop()
{
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
- QCOMPARE(webEngineView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html"));
+ QCOMPARE(webEngineView()->url(), urlFromTestPath("html/basic_page.html"));
webEngineView()->stop();
}
@@ -215,7 +226,7 @@ void tst_QQuickWebEngineView::loadProgress()
{
QCOMPARE(webEngineView()->loadProgress(), 0);
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
QSignalSpy loadProgressChangedSpy(webEngineView(), SIGNAL(loadProgressChanged()));
QVERIFY(waitForLoadSucceeded(webEngineView()));
@@ -234,7 +245,7 @@ void tst_QQuickWebEngineView::show()
void tst_QQuickWebEngineView::showWebEngineView()
{
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/direct-image-compositing.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/direct-image-compositing.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
m_window->show();
// This should not crash.
@@ -268,12 +279,12 @@ void tst_QQuickWebEngineView::multipleWebEngineViewWindows()
QQuickWebEngineView *webEngineView2 = newWebEngineView();
QScopedPointer<TestWindow> window2(new TestWindow(webEngineView2));
- webEngineView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/scroll.html")));
+ webEngineView1->setUrl(urlFromTestPath("html/scroll.html"));
QVERIFY(waitForLoadSucceeded(webEngineView1));
window1->show();
webEngineView1->setVisible(true);
- webEngineView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView2->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView2));
window2->show();
webEngineView2->setVisible(true);
@@ -291,12 +302,12 @@ void tst_QQuickWebEngineView::multipleWebEngineViews()
webEngineView2->setParentItem(m_window->contentItem());
webEngineView1->setSize(QSizeF(300, 400));
- webEngineView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/scroll.html")));
+ webEngineView1->setUrl(urlFromTestPath("html/scroll.html"));
QVERIFY(waitForLoadSucceeded(webEngineView1.data()));
webEngineView1->setVisible(true);
webEngineView2->setSize(QSizeF(300, 400));
- webEngineView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page.html")));
+ webEngineView2->setUrl(urlFromTestPath("html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView2.data()));
webEngineView2->setVisible(true);
QTest::qWait(200);
@@ -325,14 +336,14 @@ void tst_QQuickWebEngineView::titleUpdate()
QSignalSpy titleSpy(webEngineView(), SIGNAL(titleChanged()));
// Load page with no title
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/basic_page2.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page2.html"));
QVERIFY(waitForLoadSucceeded(webEngineView()));
QCOMPARE(titleSpy.size(), 1);
titleSpy.clear();
// No titleChanged signal for failed load
- webEngineView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/file_that_does_not_exist.html")));
+ webEngineView()->setUrl(urlFromTestPath("html/file_that_does_not_exist.html"));
QVERIFY(waitForLoadFailed(webEngineView()));
QCOMPARE(titleSpy.size(), 0);
}
@@ -357,7 +368,7 @@ void tst_QQuickWebEngineView::transparentWebEngineViews()
webEngineView1->setVisible(true);
webEngineView2->setSize(QSizeF(300, 400));
- webEngineView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
+ webEngineView2->setUrl(urlFromTestPath("/html/basic_page.html"));
QVERIFY(waitForLoadSucceeded(webEngineView2.data()));
webEngineView2->setVisible(true);
@@ -388,7 +399,7 @@ void tst_QQuickWebEngineView::inputMethod()
QSKIP("QQUICKWEBENGINEVIEW_ITEMACCEPTSINPUTMETHOD");
#else
QQuickWebEngineView *view = webEngineView();
- view->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/inputmethod.html")));
+ view->setUrl(urlFromTestPath("html/inputmethod.html"));
QVERIFY(waitForLoadSucceeded(view));
QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
@@ -406,7 +417,7 @@ void tst_QQuickWebEngineView::inputMethodHints()
#else
QQuickWebEngineView *view = webEngineView();
- view->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "html/inputmethod.html")));
+ view->setUrl(urlFromTestPath("html/inputmethod.html"));
QVERIFY(waitForLoadSucceeded(view));
// Setting focus on an input element results in an element in its shadow tree becoming the focus node.
diff --git a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
index e0e876fc8..a969993ff 100644
--- a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
+++ b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
@@ -154,13 +154,13 @@ void tst_QQuickWebEngineViewGraphics::showHideShow()
setHtml(greenSquare);
QSignalSpy exposeSpy(m_view.data(), SIGNAL(exposeChanged()));
m_view->show();
- QVERIFY(exposeSpy.wait(500));
+ QVERIFY(exposeSpy.wait());
QCOMPARE(m_view->grabWindow(), get150x150GreenReferenceImage());
m_view->hide();
- QVERIFY(exposeSpy.wait(500));
+ QVERIFY(exposeSpy.wait());
m_view->show();
- QVERIFY(exposeSpy.wait(500));
+ QVERIFY(exposeSpy.wait());
QCOMPARE(m_view->grabWindow(), get150x150GreenReferenceImage());
}
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index 71bc61b9e..33821e20b 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -3,6 +3,7 @@ TEMPLATE = subdirs
SUBDIRS += \
inspectorserver \
publicapi \
- qmltests \
qquickwebengineview \
qquickwebengineviewgraphics
+
+isQMLTestSupportApiEnabled(): SUBDIRS += qmltests
diff --git a/tests/auto/widgets/qwebengineaccessibility/BLACKLIST b/tests/auto/widgets/qwebengineaccessibility/BLACKLIST
new file mode 100644
index 000000000..0450f8c1c
--- /dev/null
+++ b/tests/auto/widgets/qwebengineaccessibility/BLACKLIST
@@ -0,0 +1,6 @@
+[hierarchy]
+windows
+[text]
+windows
+[value]
+windows
diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST
new file mode 100644
index 000000000..91858f299
--- /dev/null
+++ b/tests/auto/widgets/qwebenginepage/BLACKLIST
@@ -0,0 +1,5 @@
+[geolocationRequestJS]
+*
+
+[macCopyUnicodeToClipboard]
+osx
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 50914a920..8fd71c701 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -3479,16 +3479,16 @@ void tst_QWebEnginePage::getUserMediaRequest()
QVERIFY(evaluateJavaScriptSync(page, QStringLiteral("!!navigator.webkitGetUserMedia")).toBool());
evaluateJavaScriptSync(page, QStringLiteral("navigator.webkitGetUserMedia({audio: true}, function() {}, function(){})"));
- QTRY_VERIFY_WITH_TIMEOUT(page->gotFeatureRequest(QWebEnginePage::MediaAudioCapture), 100);
+ QTRY_VERIFY(page->gotFeatureRequest(QWebEnginePage::MediaAudioCapture));
// Might end up failing due to the lack of physical media devices deeper in the content layer, so the JS callback is not guaranteed to be called,
// but at least we go through that code path, potentially uncovering failing assertions.
page->acceptPendingRequest();
page->runJavaScript(QStringLiteral("errorCallbackCalled = false;"));
evaluateJavaScriptSync(page, QStringLiteral("navigator.webkitGetUserMedia({audio: true, video: true}, function() {}, function(){errorCallbackCalled = true;})"));
- QTRY_VERIFY_WITH_TIMEOUT(page->gotFeatureRequest(QWebEnginePage::MediaAudioVideoCapture), 100);
+ QTRY_VERIFY(page->gotFeatureRequest(QWebEnginePage::MediaAudioVideoCapture));
page->rejectPendingRequest(); // Should always end up calling the error callback in JS.
- QTRY_VERIFY_WITH_TIMEOUT(evaluateJavaScriptSync(page, QStringLiteral("errorCallbackCalled;")).toBool(), 100);
+ QTRY_VERIFY(evaluateJavaScriptSync(page, QStringLiteral("errorCallbackCalled;")).toBool());
delete page;
}
@@ -3749,8 +3749,7 @@ void tst_QWebEnginePage::fullScreenRequested()
});
QTest::keyPress(qApp->focusWindow(), Qt::Key_Space);
- QTest::qWait(100);
- page->runJavaScript("document.webkitIsFullScreen", JavaScriptCallback(true));
+ QTRY_VERIFY(evaluateJavaScriptSync(page, "document.webkitIsFullScreen").toBool());
page->runJavaScript("document.webkitExitFullscreen()", JavaScriptCallbackUndefined());
QVERIFY(watcher.wait());
@@ -3797,10 +3796,14 @@ void tst_QWebEnginePage::symmetricUrl()
QCOMPARE(view.url(), dataUrl3);
+ // setUrl(dataUrl3) might override the pending load for dataUrl2. Or not.
QTRY_VERIFY(loadFinishedSpy.count() >= 2);
- QTRY_COMPARE(loadFinishedSpy.count(), 3);
+ QTRY_VERIFY(loadFinishedSpy.count() <= 3);
- QCOMPARE(view.history()->count(), 2);
+ // setUrl(dataUrl3) might stop Chromium from adding a navigation entry for dataUrl2,
+ // depending on whether the load of dataUrl2 could be completed in time.
+ QVERIFY(view.history()->count() >= 2);
+ QVERIFY(view.history()->count() <= 3);
QCOMPARE(toPlainTextSync(view.page()), QString("Test3"));
}
@@ -4042,7 +4045,7 @@ void tst_QWebEnginePage::setHtmlWithImageResource()
QWebEnginePage page;
page.setHtml(html, QUrl(QLatin1String("file:///path/to/file")));
- waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
+ waitForSignal(&page, SIGNAL(loadFinished(bool)));
QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128);
@@ -4051,7 +4054,7 @@ void tst_QWebEnginePage::setHtmlWithImageResource()
// Now we test the opposite: without a baseUrl as a local file, we cannot request local resources.
page.setHtml(html);
- waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
+ waitForSignal(&page, SIGNAL(loadFinished(bool)));
QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue);
QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 0);
@@ -4113,7 +4116,7 @@ void tst_QWebEnginePage::setHtmlWithBaseURL()
QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
page.setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR));
- waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
+ waitForSignal(&page, SIGNAL(loadFinished(bool)));
QCOMPARE(spy.count(), 1);
QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
@@ -5072,7 +5075,7 @@ void tst_QWebEnginePage::loadInSignalHandlers()
URLSetter setter(m_page, signal, type, urlForSetter);
m_page->load(url);
- waitForSignal(&setter, SIGNAL(finished()), 200);
+ waitForSignal(&setter, SIGNAL(finished()));
QCOMPARE(m_page->url(), urlForSetter);
}
diff --git a/tests/auto/widgets/tests.pri b/tests/auto/widgets/tests.pri
index afdf46f42..8a62ce2a6 100644
--- a/tests/auto/widgets/tests.pri
+++ b/tests/auto/widgets/tests.pri
@@ -1,8 +1,6 @@
TEMPLATE = app
-# FIXME: Re-enable once we want to run tests on the CI
-# CONFIG += testcase
-
+CONFIG += testcase
CONFIG += c++11
VPATH += $$_PRO_FILE_PWD_
diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp
index 12ebfa2d5..61977a018 100644
--- a/tests/quicktestbrowser/main.cpp
+++ b/tests/quicktestbrowser/main.cpp
@@ -52,6 +52,7 @@ typedef QGuiApplication Application;
#include <QtQml/QQmlContext>
#include <QtQml/QQmlComponent>
#include <QtWebEngine/qtwebengineglobal.h>
+#include <QtWebEngine/QQuickWebEngineProfile>
#include <QtWebEngineCore/qwebenginecookiestore.h>
static QUrl startupUrl()
@@ -84,17 +85,10 @@ int main(int argc, char **argv)
appEngine.load(QUrl("qrc:/ApplicationRoot.qml"));
QObject *rootObject = appEngine.rootObjects().first();
- QQmlComponent component(&appEngine);
- component.setData(QByteArrayLiteral("import QtQuick 2.0\n"
- "import QtWebEngine 1.1\n"
- "WebEngineProfile {\n"
- "storageName: \"Test\"\n"
- "}")
- , QUrl());
- QObject *profile = component.create();
+ QQuickWebEngineProfile *profile = new QQuickWebEngineProfile(rootObject);
+ QWebEngineCookieStore *client = profile->cookieStore();
+
const QMetaObject *rootMeta = rootObject->metaObject();
- QWebEngineCookieStore *client = 0;
- QMetaObject::invokeMethod(profile, "cookieStore", Q_RETURN_ARG(QWebEngineCookieStore*, client));
int index = rootMeta->indexOfProperty("thirdPartyCookiesEnabled");
Q_ASSERT(index != -1);
QMetaProperty thirdPartyCookiesProperty = rootMeta->property(index);
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf
index 2c75f4984..2447d8372 100644
--- a/tools/qmake/mkspecs/features/functions.prf
+++ b/tools/qmake/mkspecs/features/functions.prf
@@ -180,8 +180,12 @@ defineReplace(findOrBuildNinja) {
log("Build directory is different from source directory - copying ninja sources to the build tree...")
shadow_3rd_party_path = $$system_path($$shadowed($$src_3rd_party_dir))
- !exists($$dirname(out)): mkpath($$shadow_3rd_party_path)
- system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$shadow_3rd_party_path)")
+ !exists($$dirname(out)): mkpath($$dirname(out))
+ copy_dir_files {
+ system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$dirname(out))")
+ } else {
+ system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$shadow_3rd_party_path)")
+ }
}
system("cd $$system_quote($$dirname(out)) && python configure.py --bootstrap")
}