summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-14 12:29:28 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-14 12:29:54 +0200
commit9be23eb946580519b2b0600cc854ec8050b90659 (patch)
tree63ccf0e565f346a0788d937b004e01d2ec029b5e
parent4f2e66f9d898e9c11a7ad6e552d0d47bb15d4051 (diff)
parent981e38d2dc82c047c6ad8ec19427d3ac7434dc3c (diff)
Merge remote-tracking branch 'origin/5.6' into devwip/47-based
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml12
-rw-r--r--examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc2
-rw-r--r--examples/webenginewidgets/demobrowser/demobrowser.pro2
-rw-r--r--examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc6
-rw-r--r--examples/webenginewidgets/demobrowser/tabwidget.cpp39
-rw-r--r--examples/webenginewidgets/demobrowser/tabwidget.h3
-rw-r--r--examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc22
m---------src/3rdparty0
-rw-r--r--src/core/api/qwebengineurlrequestinfo.cpp14
-rw-r--r--src/core/api/qwebengineurlrequestinfo.h1
-rw-r--r--src/core/api/qwebengineurlrequestinfo_p.h2
-rw-r--r--src/core/api/qwebengineurlrequestjob.cpp38
-rw-r--r--src/core/api/qwebengineurlrequestjob.h14
-rw-r--r--src/core/api/qwebengineurlschemehandler.cpp28
-rw-r--r--src/core/api/qwebengineurlschemehandler.h9
-rw-r--r--src/core/api/qwebengineurlschemehandler_p.h19
-rw-r--r--src/core/browser_context_adapter.cpp11
-rw-r--r--src/core/browser_context_adapter.h8
-rw-r--r--src/core/config/embedded_linux.pri3
-rw-r--r--src/core/config/linux.pri35
-rw-r--r--src/core/cookie_monster_delegate_qt.cpp2
-rw-r--r--src/core/core_gyp_generator.pro2
-rw-r--r--src/core/core_module.pro2
-rw-r--r--src/core/custom_protocol_handler.cpp2
-rw-r--r--src/core/custom_protocol_handler.h6
-rw-r--r--src/core/custom_url_scheme_handler.cpp63
-rw-r--r--src/core/custom_url_scheme_handler.h71
-rw-r--r--src/core/download_manager_delegate_qt.cpp4
-rw-r--r--src/core/javascript_dialog_manager_qt.cpp6
-rw-r--r--src/core/javascript_dialog_manager_qt.h2
-rw-r--r--src/core/location_provider_qt.cpp17
-rw-r--r--src/core/network_delegate_qt.cpp3
-rw-r--r--src/core/resource_dispatcher_host_delegate_qt.cpp29
-rw-r--r--src/core/resource_dispatcher_host_delegate_qt.h3
-rw-r--r--src/core/url_request_context_getter_qt.cpp6
-rw-r--r--src/core/url_request_custom_job.cpp8
-rw-r--r--src/core/url_request_custom_job.h6
-rw-r--r--src/core/user_script.cpp11
-rw-r--r--src/core/user_script.h4
-rw-r--r--src/core/user_script_controller_host.cpp31
-rw-r--r--src/core/user_script_controller_host.h6
-rw-r--r--src/core/web_contents_adapter.cpp6
-rw-r--r--src/core/web_contents_adapter.h1
-rw-r--r--src/core/web_contents_adapter_client.h2
-rw-r--r--src/core/web_contents_delegate_qt.cpp24
-rw-r--r--src/core/web_contents_delegate_qt.h2
-rw-r--r--src/webengine/api/qquickwebenginehistory.cpp102
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp12
-rw-r--r--src/webengine/api/qquickwebenginesingleton.cpp36
-rw-r--r--src/webengine/api/qquickwebenginetestsupport_p.h1
-rw-r--r--src/webengine/api/qquickwebengineview.cpp14
-rw-r--r--src/webengine/api/qquickwebengineview_p.h2
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h1
-rw-r--r--src/webengine/doc/qtwebengine.qdocconf25
-rw-r--r--src/webengine/doc/src/external-resources.qdoc48
-rw-r--r--src/webengine/doc/src/qtwebengine-devtools.qdoc6
-rw-r--r--src/webengine/doc/src/qtwebengine-index.qdoc4
-rw-r--r--src/webengine/doc/src/qtwebengine-modules.qdoc42
-rw-r--r--src/webengine/doc/src/qtwebengine-overview.qdoc17
-rw-r--r--src/webengine/doc/src/qtwebengine-platform-notes.qdoc52
-rw-r--r--src/webengine/doc/src/qtwebengine-qmlmodule.qdoc2
-rw-r--r--src/webengine/doc/src/webengineview.qdoc321
-rw-r--r--src/webengine/plugin/plugins.qmltypes99
-rw-r--r--src/webengine/ui_delegates_manager.cpp4
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp14
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h1
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h1
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp26
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.h2
-rw-r--r--src/webenginewidgets/api/qwebengineprofile_p.h2
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp8
-rw-r--r--src/webenginewidgets/doc/qtwebenginewidgets.qdocconf43
-rw-r--r--src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc5
-rw-r--r--src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc6
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc24
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc105
-rw-r--r--src/webenginewidgets/webenginewidgets.pro2
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/resources/firstparty.html5
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp20
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc1
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp211
-rw-r--r--tests/auto/quick/qmltests/data/TestWebEngineView.qml7
-rw-r--r--tests/auto/quick/qmltests/data/confirmclose.html5
-rw-r--r--tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml33
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro1
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp29
-rw-r--r--tools/qmake/mkspecs/features/configure.prf44
-rw-r--r--tools/qmake/mkspecs/features/functions.prf22
-rwxr-xr-xtools/scripts/take_snapshot.py1
-rw-r--r--tools/scripts/version_resolver.py2
90 files changed, 1299 insertions, 696 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index 4d7513fa..123a7cc8 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -118,10 +118,7 @@ ApplicationWindow {
Action {
shortcut: StandardKey.Close
onTriggered: {
- if (tabs.count == 1)
- browserWindow.close()
- else
- tabs.removeTab(tabs.currentIndex)
+ currentWebView.triggerWebAction(WebEngineView.RequestClose);
}
}
Action {
@@ -415,6 +412,13 @@ ApplicationWindow {
reloadTimer.running = true
}
+ onWindowCloseRequested: {
+ if (tabs.count == 1)
+ browserWindow.close()
+ else
+ tabs.removeTab(tabs.currentIndex)
+ }
+
Timer {
id: reloadTimer
interval: 0
diff --git a/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc b/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc
index 4fac9fe0..21195192 100644
--- a/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc
+++ b/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \example quicknanobrowser
+ \example webengine/quicknanobrowser
\title WebEngine Quick Nano Browser
\ingroup webengine-examples
\brief A web browser implemented using the WebEngineView QML type.
diff --git a/examples/webenginewidgets/demobrowser/demobrowser.pro b/examples/webenginewidgets/demobrowser/demobrowser.pro
index 0893fe64..14347de7 100644
--- a/examples/webenginewidgets/demobrowser/demobrowser.pro
+++ b/examples/webenginewidgets/demobrowser/demobrowser.pro
@@ -75,7 +75,7 @@ win32 {
mac {
ICON = demobrowser.icns
QMAKE_INFO_PLIST = Info_mac.plist
- TARGET = Browser
+ TARGET = Demobrowser
}
EXAMPLE_FILES = Info_mac.plist demobrowser.icns demobrowser.ico demobrowser.rc
diff --git a/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc b/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc
index 1264606d..ba61dd79 100644
--- a/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc
+++ b/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc
@@ -26,13 +26,13 @@
****************************************************************************/
/*!
- \example demobrowser
+ \example webenginewidgets/demobrowser
\title WebEngine Demo Browser Example
\ingroup webengine-widgetexamples
\brief A demo browser based on Qt WebEngine Widgets
- The Demo Browser example shows the \l{Qt WebEngine Widgets} module in action,
- providing a little Web browser application with support for tabs.
+ \e {Demo Browser} demonstrates how to use the \l{Qt WebEngine Widgets C++ Classes}
+ {Qt WebEngine C++ classes} to develop a small Web browser application with support for tabs.
\image browser-demo.png
diff --git a/examples/webenginewidgets/demobrowser/tabwidget.cpp b/examples/webenginewidgets/demobrowser/tabwidget.cpp
index 4532683b..9e08426f 100644
--- a/examples/webenginewidgets/demobrowser/tabwidget.cpp
+++ b/examples/webenginewidgets/demobrowser/tabwidget.cpp
@@ -223,7 +223,7 @@ TabWidget::TabWidget(QWidget *parent)
setElideMode(Qt::ElideRight);
connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab()));
- connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
+ connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(requestCloseTab(int)));
connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
@@ -241,7 +241,7 @@ TabWidget::TabWidget(QWidget *parent)
m_closeTabAction = new QAction(QIcon(QLatin1String(":closetab.png")), tr("&Close Tab"), this);
m_closeTabAction->setShortcuts(QKeySequence::Close);
m_closeTabAction->setIconVisibleInMenu(false);
- connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab()));
+ connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(requestCloseTab()));
m_nextTabAction = new QAction(tr("Show Next Tab"), this);
QList<QKeySequence> shortcuts;
@@ -552,12 +552,8 @@ void TabWidget::windowCloseRequested()
WebPage *webPage = qobject_cast<WebPage*>(sender());
WebView *webView = qobject_cast<WebView*>(webPage->view());
int index = webViewIndex(webView);
- if (index >= 0) {
- if (count() == 1)
- webView->webPage()->mainWindow()->close();
- else
- closeTab(index);
- }
+ if (index >= 0)
+ closeTab(index);
}
void TabWidget::closeOtherTabs(int index)
@@ -582,30 +578,25 @@ void TabWidget::cloneTab(int index)
}
// When index is -1 index chooses the current tab
-void TabWidget::closeTab(int index)
+void TabWidget::requestCloseTab(int index)
{
if (index < 0)
index = currentIndex();
if (index < 0 || index >= count())
return;
+ WebView *tab = webView(index);
+ if (!tab)
+ return;
+ tab->page()->triggerAction(QWebEnginePage::RequestClose);
+}
+
+void TabWidget::closeTab(int index)
+{
+ if (index < 0 || index >= count())
+ return;
bool hasFocus = false;
if (WebView *tab = webView(index)) {
-#if defined(QWEBENGINEPAGE_ISMODIFIED)
- if (tab->isModified()) {
- QMessageBox closeConfirmation(tab);
- closeConfirmation.setWindowFlags(Qt::Sheet);
- closeConfirmation.setWindowTitle(tr("Do you really want to close this page?"));
- closeConfirmation.setInformativeText(tr("You have modified this page and when closing it you would lose the modification.\n"
- "Do you really want to close this page?\n"));
- closeConfirmation.setIcon(QMessageBox::Question);
- closeConfirmation.addButton(QMessageBox::Yes);
- closeConfirmation.addButton(QMessageBox::No);
- closeConfirmation.setEscapeButton(QMessageBox::No);
- if (closeConfirmation.exec() == QMessageBox::No)
- return;
- }
-#endif
hasFocus = tab->hasFocus();
if (m_profile == QWebEngineProfile::defaultProfile()) {
diff --git a/examples/webenginewidgets/demobrowser/tabwidget.h b/examples/webenginewidgets/demobrowser/tabwidget.h
index f6c4edba..0f2a20c3 100644
--- a/examples/webenginewidgets/demobrowser/tabwidget.h
+++ b/examples/webenginewidgets/demobrowser/tabwidget.h
@@ -196,7 +196,8 @@ public slots:
void loadUrlInCurrentTab(const QUrl &url);
WebView *newTab(bool makeCurrent = true);
void cloneTab(int index = -1);
- void closeTab(int index = -1);
+ void requestCloseTab(int index = -1);
+ void closeTab(int index);
void closeOtherTabs(int index);
void reloadTab(int index = -1);
void reloadAllTabs();
diff --git a/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc b/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc
index e6c6ada3..b798e483 100644
--- a/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc
+++ b/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \example fancybrowser
+ \example webenginewidgets/fancybrowser
\title WebEngine Fancy Browser Example
\ingroup webengine-widgetexamples
\brief Demonstrates how to use browse web and manipulate content
@@ -48,7 +48,7 @@
The \c MainWindow class inherits QMainWindow. It implements a number of
slots to perform actions on both the application and on the web content.
- \snippet fancybrowser/mainwindow.h 1
+ \snippet webenginewidgets/fancybrowser/mainwindow.h 1
We also declare a QString that contains the jQuery, a QWebView
that displays the web content, and a QLineEdit that acts as the
@@ -58,7 +58,7 @@
We start by implementing the constructor.
- \snippet fancybrowser/mainwindow.cpp 1
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 1
The first part of the constructor sets the value of \c progress to
0. This value will be used later in the code to visualize the
@@ -68,7 +68,7 @@
content. The jQuery library is a JavaScript library that provides different
functions for manipulating HTML.
- \snippet fancybrowser/mainwindow.cpp 2
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 2
The second part of the constructor creates a QWebView and connects
slots to the views signals. Furthermore, we create a QLineEdit as
@@ -77,13 +77,13 @@
QLineEdit to a QToolbar together with a set of navigation actions
from QWebView::pageAction.
- \snippet fancybrowser/mainwindow.cpp 3
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 3
The third and last part of the constructor implements two QMenus and assigns
a set of actions to them. The last line sets the QWebView as the central
widget in the QMainWindow.
- \snippet fancybrowser/mainwindow.cpp 4
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 4
When the page is loaded, \c adjustLocation() updates the address
bar; \c adjustLocation() is triggered by the \c loadFinished()
@@ -92,13 +92,13 @@
the new web page has finished loading, \c adjustLocation() will be
run once more to update the address bar.
- \snippet fancybrowser/mainwindow.cpp 5
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 5
\c adjustTitle() sets the window title and displays the loading
progress. This slot is triggered by the \c titleChanged() signal
in QWebView.
- \snippet fancybrowser/mainwindow.cpp 6
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 6
When a web page has loaded, \c finishLoading() is triggered by the
\c loadFinished() signal in QWebView. \c finishLoading() then updates the
@@ -113,7 +113,7 @@
that the images of the newly loaded page respect the state of the toggle
action.
- \snippet fancybrowser/mainwindow.cpp 7
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 7
The first jQuery-based function, \c highlightAllLinks(), is designed to
highlight all links in the current webpage. The JavaScript code looks
@@ -121,14 +121,14 @@
For each such element, the background color is set to be yellow by
using CSS.
- \snippet fancybrowser/mainwindow.cpp 8
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 8
The \c rotateImages() function rotates the images on the current
web page. This JavaScript code relies on CSS transforms and
looks up all \e {img} elements and rotates the images 180 degrees
and then back again.
- \snippet fancybrowser/mainwindow.cpp 9
+ \snippet webenginewidgets/fancybrowser/mainwindow.cpp 9
The remaining four methods remove different elements from the current web
page. \c removeGifImages() removes all GIF images on the page by looking up
diff --git a/src/3rdparty b/src/3rdparty
-Subproject 2ac2926e6c73bbb9b9897ed6d7a472031a0a8c6
+Subproject 6c28e9497f45870d1d6db37f54a67fb597f9592
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index b769081f..e8ce65be 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -119,11 +119,12 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q
*/
-QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource, QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QByteArray &m)
+QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource, QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QUrl &fpu, const QByteArray &m)
: resourceType(resource)
, navigationType(navigation)
, shouldBlockRequest(false)
, url(u)
+ , firstPartyUrl(fpu)
, method(m)
{
}
@@ -218,6 +219,17 @@ QUrl QWebEngineUrlRequestInfo::requestUrl() const
return d->url;
}
+/*!
+ Returns the first party URL of the request.
+ The first party URL is the URL of the page that issued the request.
+*/
+
+QUrl QWebEngineUrlRequestInfo::firstPartyUrl() const
+{
+ Q_D(const QWebEngineUrlRequestInfo);
+ return d->firstPartyUrl;
+}
+
/*!
Returns the HTTP method of the request (for example, GET or POST).
diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h
index 7c016d20..e6e22505 100644
--- a/src/core/api/qwebengineurlrequestinfo.h
+++ b/src/core/api/qwebengineurlrequestinfo.h
@@ -86,6 +86,7 @@ public:
NavigationType navigationType() const;
QUrl requestUrl() const;
+ QUrl firstPartyUrl() const;
QByteArray requestMethod() const;
void block(bool shouldBlock);
diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h
index b6a304a0..1b1279d2 100644
--- a/src/core/api/qwebengineurlrequestinfo_p.h
+++ b/src/core/api/qwebengineurlrequestinfo_p.h
@@ -58,6 +58,7 @@ public:
QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource
, QWebEngineUrlRequestInfo::NavigationType navigation
, const QUrl &u
+ , const QUrl &fpu
, const QByteArray &m);
QWebEngineUrlRequestInfo::ResourceType resourceType;
@@ -65,6 +66,7 @@ public:
bool shouldBlockRequest;
QUrl url;
+ QUrl firstPartyUrl;
const QByteArray method;
QHash<QByteArray, QByteArray> extraHeaders;
diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp
index d9f3833b..0e56ba5b 100644
--- a/src/core/api/qwebengineurlrequestjob.cpp
+++ b/src/core/api/qwebengineurlrequestjob.cpp
@@ -48,18 +48,36 @@ QT_BEGIN_NAMESPACE
\since 5.6
A QWebEngineUrlRequestJob is given to QWebEngineUrlSchemeHandler::requestStarted() and must
- be handled by the derived implementations of the class.
+ be handled by the derived implementations of the class. The job can be handled by calling
+ either reply(), redirect(), or fail().
- A job can be handled by calling either reply(), redirect() or fail().
-
- The class is owned by QtWebEngine and does not need to be deleted. Note QtWebEngine may delete
- the job when it is no longer needed, so the signal QObject::destroyed() must be monitored if
- a pointer to the object is stored.
+ The class is owned by the web engine and does not need to be deleted. However, the web engine
+ may delete the job when it is no longer needed, and therefore the signal QObject::destroyed()
+ must be monitored if a pointer to the object is stored.
\inmodule QtWebEngineCore
*/
/*!
+ \enum QWebEngineUrlRequestJob::Error
+
+ This enum type holds the type of the error that occurred:
+
+ \value NoError
+ The request was successful.
+ \value UrlNotFound
+ The requested URL was not found.
+ \value UrlInvalid
+ The requested URL is invalid.
+ \value RequestAborted
+ The request was canceled.
+ \value RequestDenied
+ The request was denied.
+ \value RequestFailed
+ The request failed.
+*/
+
+/*!
\internal
*/
QWebEngineUrlRequestJob::QWebEngineUrlRequestJob(URLRequestCustomJobDelegate * p)
@@ -92,7 +110,7 @@ QByteArray QWebEngineUrlRequestJob::requestMethod() const
}
/*!
- Replies the request with \a device with the mime-type \a contentType.
+ Replies to the request with \a device and the MIME type \a contentType.
*/
void QWebEngineUrlRequestJob::reply(const QByteArray &contentType, QIODevice *device)
{
@@ -100,7 +118,9 @@ void QWebEngineUrlRequestJob::reply(const QByteArray &contentType, QIODevice *de
}
/*!
- Fails the request with error \a error.
+ Fails the request with the error \a r.
+
+ \sa Error
*/
void QWebEngineUrlRequestJob::fail(Error r)
{
@@ -108,7 +128,7 @@ void QWebEngineUrlRequestJob::fail(Error r)
}
/*!
- Tell the request is redirected to \a url.
+ Redirects the request to \a url.
*/
void QWebEngineUrlRequestJob::redirect(const QUrl &url)
{
diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h
index 098d46c9..fc9f4d91 100644
--- a/src/core/api/qwebengineurlrequestjob.h
+++ b/src/core/api/qwebengineurlrequestjob.h
@@ -37,17 +37,6 @@
#ifndef QWEBENGINEURLREQUESTJOB_H
#define QWEBENGINEURLREQUESTJOB_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.h"
#include <QtCore/qbytearray.h>
@@ -55,6 +44,7 @@
#include <QtCore/qurl.h>
namespace QtWebEngineCore {
+class URLRequestCustomJob;
class URLRequestCustomJobDelegate;
} // namespace
@@ -86,7 +76,7 @@ public:
private:
QWebEngineUrlRequestJob(QtWebEngineCore::URLRequestCustomJobDelegate *);
- friend class QWebEngineUrlSchemeHandlerPrivate;
+ friend class QtWebEngineCore::URLRequestCustomJob;
QtWebEngineCore::URLRequestCustomJobDelegate* d_ptr;
};
diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp
index 33064889..e6c20dbc 100644
--- a/src/core/api/qwebengineurlschemehandler.cpp
+++ b/src/core/api/qwebengineurlschemehandler.cpp
@@ -43,31 +43,25 @@ QT_BEGIN_NAMESPACE
/*!
\class QWebEngineUrlSchemeHandler
- \brief The QWebEngineUrlSchemeHandler base class for handling custom URL schemes.
+ \brief The QWebEngineUrlSchemeHandler is a base class for handling custom URL schemes.
\since 5.6
- To implement a custom URL scheme for QtWebEngine you must write a class derived from this class,
+ To implement a custom URL scheme for QtWebEngine, you must write a class derived from this class,
and reimplement requestStarted().
\inmodule QtWebEngineCore
*/
-QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme, QWebEngineUrlSchemeHandler *q)
- : CustomUrlSchemeHandler(scheme)
- , q_ptr(q)
-{
-}
+/*!
+ \fn QWebEngineUrlSchemeHandler::destroyed(QWebEngineUrlSchemeHandler *handler)
-QWebEngineUrlSchemeHandlerPrivate::~QWebEngineUrlSchemeHandlerPrivate()
-{
-}
+ This signal is emitted when the custom URL scheme handler \a handler is deleted.
+*/
-bool QWebEngineUrlSchemeHandlerPrivate::handleJob(QtWebEngineCore::URLRequestCustomJobDelegate *job)
+QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme)
+ : m_scheme(scheme)
{
- QWebEngineUrlRequestJob *requestJob = new QWebEngineUrlRequestJob(job);
- q_ptr->requestStarted(requestJob);
- return true;
}
/*!
@@ -78,12 +72,16 @@ bool QWebEngineUrlSchemeHandlerPrivate::handleJob(QtWebEngineCore::URLRequestCus
*/
QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(const QByteArray &scheme, QObject *parent)
: QObject(parent)
- , d_ptr(new QWebEngineUrlSchemeHandlerPrivate(scheme, this))
+ , d_ptr(new QWebEngineUrlSchemeHandlerPrivate(scheme))
{
}
+/*!
+ Deletes a custom URL scheme handler.
+*/
QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler()
{
+ Q_EMIT destroyed(this);
delete d_ptr;
}
diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h
index b6f6a69f..1b6a6670 100644
--- a/src/core/api/qwebengineurlschemehandler.h
+++ b/src/core/api/qwebengineurlschemehandler.h
@@ -42,6 +42,10 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qobject.h>
+namespace QtWebEngineCore {
+class URLRequestContextGetterQt;
+}
+
QT_BEGIN_NAMESPACE
class QWebEngineUrlRequestJob;
@@ -57,11 +61,12 @@ public:
virtual void requestStarted(QWebEngineUrlRequestJob*) = 0;
+Q_SIGNALS:
+ void destroyed(QWebEngineUrlSchemeHandler*);
+
private:
Q_DISABLE_COPY(QWebEngineUrlSchemeHandler)
Q_DECLARE_PRIVATE(QWebEngineUrlSchemeHandler)
- friend class QWebEngineProfile;
- friend class QQuickWebEngineProfile;
QWebEngineUrlSchemeHandlerPrivate *d_ptr;
};
diff --git a/src/core/api/qwebengineurlschemehandler_p.h b/src/core/api/qwebengineurlschemehandler_p.h
index dc4b272b..d6366632 100644
--- a/src/core/api/qwebengineurlschemehandler_p.h
+++ b/src/core/api/qwebengineurlschemehandler_p.h
@@ -48,27 +48,18 @@
// We mean it.
//
-#include "qwebengineurlschemehandler.h"
-
-#include "custom_url_scheme_handler.h"
+#include <QtCore/qbytearray.h>
QT_BEGIN_NAMESPACE
-class QWebEngineProfile;
-class QWebEngineUrlRequestJob;
-class QWebEngineUrlSchemeHandler;
-
-class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandlerPrivate : public QtWebEngineCore::CustomUrlSchemeHandler {
+class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandlerPrivate {
public:
- Q_DECLARE_PUBLIC(QWebEngineUrlSchemeHandler)
-
- QWebEngineUrlSchemeHandlerPrivate(const QByteArray &, QWebEngineUrlSchemeHandler *);
- virtual ~QWebEngineUrlSchemeHandlerPrivate();
+ QWebEngineUrlSchemeHandlerPrivate(const QByteArray &);
- virtual bool handleJob(QtWebEngineCore::URLRequestCustomJobDelegate*) Q_DECL_OVERRIDE;
+ const QByteArray &scheme() const { return m_scheme; }
private:
- QWebEngineUrlSchemeHandler *q_ptr;
+ QByteArray m_scheme;
};
QT_END_NAMESPACE
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 660c6ffb..34574184 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -255,12 +255,12 @@ void BrowserContextAdapter::setHttpUserAgent(const QString &userAgent)
{
if (m_httpUserAgent == userAgent)
return;
- m_httpUserAgent = userAgent;
+ m_httpUserAgent = userAgent.simplified();
std::vector<content::WebContentsImpl *> list = content::WebContentsImpl::GetAllWebContents();
Q_FOREACH (content::WebContentsImpl *web_contents, list)
if (web_contents->GetBrowserContext() == m_browserContext.data())
- web_contents->SetUserAgentOverride(userAgent.toStdString());
+ web_contents->SetUserAgentOverride(m_httpUserAgent.toStdString());
if (m_browserContext->url_request_getter_.get())
m_browserContext->url_request_getter_->updateUserAgent();
@@ -354,7 +354,7 @@ void BrowserContextAdapter::setHttpCacheMaxSize(int maxSize)
m_browserContext->url_request_getter_->updateHttpCache();
}
-QVector<CustomUrlSchemeHandler*> &BrowserContextAdapter::customUrlSchemeHandlers()
+QHash<QByteArray, QWebEngineUrlSchemeHandler *> &BrowserContextAdapter::customUrlSchemeHandlers()
{
return m_customUrlSchemeHandlers;
}
@@ -365,10 +365,9 @@ void BrowserContextAdapter::updateCustomUrlSchemeHandlers()
m_browserContext->url_request_getter_->updateStorageSettings();
}
-void BrowserContextAdapter::removeCustomUrlSchemeHandler(CustomUrlSchemeHandler *handler)
+void BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
{
- m_customUrlSchemeHandlers.removeOne(handler);
- Q_ASSERT(!m_customUrlSchemeHandlers.contains(handler));
+ m_customUrlSchemeHandlers.remove(handler->scheme());
}
UserScriptControllerHost *BrowserContextAdapter::userScriptController()
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index 0bca1bf8..5272268f 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -48,6 +48,7 @@
#include "api/qwebenginecookiestoreclient.h"
#include "api/qwebengineurlrequestinterceptor.h"
+#include "api/qwebengineurlschemehandler.h"
QT_FORWARD_DECLARE_CLASS(QObject)
@@ -55,7 +56,6 @@ namespace QtWebEngineCore {
class BrowserContextAdapterClient;
class BrowserContextQt;
-class CustomUrlSchemeHandler;
class DownloadManagerDelegateQt;
class UserScriptControllerHost;
class WebEngineVisitedLinksManager;
@@ -145,9 +145,9 @@ public:
bool trackVisitedLinks() const;
bool persistVisitedLinks() const;
- QVector<CustomUrlSchemeHandler*> &customUrlSchemeHandlers();
+ QHash<QByteArray, QWebEngineUrlSchemeHandler *> &customUrlSchemeHandlers();
void updateCustomUrlSchemeHandlers();
- void removeCustomUrlSchemeHandler(CustomUrlSchemeHandler*);
+ void removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *);
UserScriptControllerHost *userScriptController();
void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply);
@@ -173,7 +173,7 @@ private:
QString m_httpAcceptLanguage;
PersistentCookiesPolicy m_persistentCookiesPolicy;
VisitedLinksPolicy m_visitedLinksPolicy;
- QVector<CustomUrlSchemeHandler*> m_customUrlSchemeHandlers;
+ QHash<QByteArray, QWebEngineUrlSchemeHandler *> m_customUrlSchemeHandlers;
QList<BrowserContextAdapterClient*> m_clients;
int m_httpCacheMaxSize;
diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri
index cd12204f..50f94147 100644
--- a/src/core/config/embedded_linux.pri
+++ b/src/core/config/embedded_linux.pri
@@ -33,9 +33,6 @@ GYP_CONFIG += \
toolkit_views=1 \
use_custom_freetype=0 \
use_libpci=0 \
- use_nss_certs=0 \
- use_openssl=1 \
- use_openssl_certs=1 \
use_ozone=1 \
use_system_fontconfig=1 \
icu_use_data_file_flag=0 \
diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
index 4c2e70da..7f269245 100644
--- a/src/core/config/linux.pri
+++ b/src/core/config/linux.pri
@@ -18,23 +18,28 @@ GYP_CONFIG += \
use_kerberos=0 \
use_pango=0
-contains(QT_CONFIG, system-zlib): config_system_minizip: GYP_CONFIG += use_system_zlib=1
+!use?(nss) {
+ GYP_CONFIG += use_nss_certs=0 \
+ use_openssl=1 \
+ use_openssl_certs=1
+}
+
+contains(QT_CONFIG, system-zlib): use?(system_minizip): GYP_CONFIG += use_system_zlib=1
contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1
contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1
-contains(QT_CONFIG, system-harfbuzz): GYP_CONFIG += use_system_harfbuzz=1
!contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0
-config_system_libevent: GYP_CONFIG += use_system_libevent=1
-config_system_libwebp: GYP_CONFIG += use_system_libwebp=1
-config_system_libsrtp: GYP_CONFIG += use_system_libsrtp=1
-config_system_libxslt: GYP_CONFIG += use_system_libxml=1
-config_system_flac: GYP_CONFIG += use_system_flac=1
-config_system_jsoncpp: GYP_CONFIG += use_system_jsoncpp=1
-config_system_opus: GYP_CONFIG += use_system_opus=1
-config_system_snappy: GYP_CONFIG += use_system_snappy=1
-config_system_speex: GYP_CONFIG += use_system_speex=1
-config_system_vpx: GYP_CONFIG += use_system_libvpx=1
-
-contains(WEBENGINE_CONFIG, use_system_icu): GYP_CONFIG += use_system_icu=1
-contains(WEBENGINE_CONFIG, use_system_ffmpeg): GYP_CONFIG += use_system_ffmpeg=1
+use?(system_harfbuzz): GYP_CONFIG += use_system_harfbuzz=1
+use?(system_libevent): GYP_CONFIG += use_system_libevent=1
+use?(system_libwebp): GYP_CONFIG += use_system_libwebp=1
+use?(system_libsrtp): GYP_CONFIG += use_system_libsrtp=1
+use?(system_libxslt): GYP_CONFIG += use_system_libxml=1
+use?(system_flac): GYP_CONFIG += use_system_flac=1
+use?(system_jsoncpp): GYP_CONFIG += use_system_jsoncpp=1
+use?(system_opus): GYP_CONFIG += use_system_opus=1
+use?(system_snappy): GYP_CONFIG += use_system_snappy=1
+use?(system_speex): GYP_CONFIG += use_system_speex=1
+use?(system_vpx): GYP_CONFIG += use_system_libvpx=1
+use?(system_icu): GYP_CONFIG += use_system_icu=1
+use?(system_ffmpeg): GYP_CONFIG += use_system_ffmpeg=1
diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp
index 7838617b..7622614c 100644
--- a/src/core/cookie_monster_delegate_qt.cpp
+++ b/src/core/cookie_monster_delegate_qt.cpp
@@ -49,7 +49,7 @@
namespace QtWebEngineCore {
static GURL sourceUrlForCookie(const QNetworkCookie &cookie) {
- QString urlFragment = QString("%1%2").arg(cookie.domain()).arg(cookie.path());
+ QString urlFragment = QStringLiteral("%1%2").arg(cookie.domain()).arg(cookie.path());
return net::cookie_util::CookieOriginToURL(urlFragment.toStdString(), /* is_https */ cookie.isSecure());
}
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index c1b8179e..813626dc 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -45,7 +45,6 @@ SOURCES = \
content_main_delegate_qt.cpp \
cookie_monster_delegate_qt.cpp \
custom_protocol_handler.cpp \
- custom_url_scheme_handler.cpp \
delegated_frame_node.cpp \
desktop_screen_qt.cpp \
dev_tools_http_handler_delegate_qt.cpp \
@@ -117,7 +116,6 @@ HEADERS = \
content_main_delegate_qt.h \
cookie_monster_delegate_qt.h \
custom_protocol_handler.h \
- custom_url_scheme_handler.h \
delegated_frame_node.h \
desktop_screen_qt.h \
dev_tools_http_handler_delegate_qt.h \
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index cf253a73..68d46cd5 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -22,7 +22,7 @@ osx {
} else:msvc {
# Simulate -whole-archive by passing the list of object files that belong to the public
# API library as response file to the linker.
- LIBS_PRIVATE += /OPT:REF
+ QMAKE_LFLAGS += /OPT:REF
QMAKE_LFLAGS += @$${api_library_path}$${QMAKE_DIR_SEP}$${api_library_name}.lib.objects
} else {
LIBS_PRIVATE += -Wl,-whole-archive -l$$api_library_name -Wl,-no-whole-archive
diff --git a/src/core/custom_protocol_handler.cpp b/src/core/custom_protocol_handler.cpp
index f140f98c..fd1a4de4 100644
--- a/src/core/custom_protocol_handler.cpp
+++ b/src/core/custom_protocol_handler.cpp
@@ -43,7 +43,7 @@
namespace QtWebEngineCore {
-CustomProtocolHandler::CustomProtocolHandler(CustomUrlSchemeHandler *schemeHandler)
+CustomProtocolHandler::CustomProtocolHandler(QWebEngineUrlSchemeHandler *schemeHandler)
: m_schemeHandler(schemeHandler)
{
}
diff --git a/src/core/custom_protocol_handler.h b/src/core/custom_protocol_handler.h
index 225bb056..94da2867 100644
--- a/src/core/custom_protocol_handler.h
+++ b/src/core/custom_protocol_handler.h
@@ -45,6 +45,7 @@
#include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE
QT_FORWARD_DECLARE_CLASS(QIODevice)
+QT_FORWARD_DECLARE_CLASS(QWebEngineUrlSchemeHandler)
namespace net {
class NetworkDelegate;
@@ -54,20 +55,19 @@ class URLRequestJob;
namespace QtWebEngineCore {
class BrowserContextAdapter;
-class CustomUrlSchemeHandler;
// Implements a ProtocolHandler for custom URL schemes.
// If |network_delegate_| is NULL then all file requests will fail with ERR_ACCESS_DENIED.
class QWEBENGINE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
public:
- CustomProtocolHandler(CustomUrlSchemeHandler *);
+ CustomProtocolHandler(QWebEngineUrlSchemeHandler *);
virtual net::URLRequestJob *MaybeCreateJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate) const Q_DECL_OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler);
- CustomUrlSchemeHandler *m_schemeHandler;
+ QWebEngineUrlSchemeHandler *m_schemeHandler;
};
} // namespace
diff --git a/src/core/custom_url_scheme_handler.cpp b/src/core/custom_url_scheme_handler.cpp
deleted file mode 100644
index 29791b55..00000000
--- a/src/core/custom_url_scheme_handler.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "custom_url_scheme_handler.h"
-#include "custom_protocol_handler.h"
-
-namespace QtWebEngineCore {
-
-CustomUrlSchemeHandler::CustomUrlSchemeHandler(const QByteArray &scheme)
- : m_scheme(scheme)
-{
-}
-
-QByteArray CustomUrlSchemeHandler::scheme() const
-{
- return m_scheme;
-}
-
-void CustomUrlSchemeHandler::setScheme(const QByteArray &scheme)
-{
- m_scheme = scheme;
-}
-
-CustomProtocolHandler *CustomUrlSchemeHandler::createProtocolHandler()
-{
- // Will be owned by the JobFactory.
- return new CustomProtocolHandler(this);
-}
-
-} // namespace
diff --git a/src/core/custom_url_scheme_handler.h b/src/core/custom_url_scheme_handler.h
deleted file mode 100644
index d866628d..00000000
--- a/src/core/custom_url_scheme_handler.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** 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 CUSTOM_URL_SCHEME_HANDLER_H_
-#define CUSTOM_URL_SCHEME_HANDLER_H_
-
-#include "qtwebenginecoreglobal.h"
-
-#include <QtCore/QByteArray>
-#include <QtCore/QScopedPointer>
-
-QT_FORWARD_DECLARE_CLASS(QIODevice)
-
-namespace QtWebEngineCore {
-
-class BrowserContextAdapter;
-class CustomProtocolHandler;
-class URLRequestCustomJobDelegate;
-
-class QWEBENGINE_EXPORT CustomUrlSchemeHandler {
-public:
- explicit CustomUrlSchemeHandler(const QByteArray &);
- virtual ~CustomUrlSchemeHandler() { }
-
- QByteArray scheme() const;
- void setScheme(const QByteArray &);
- CustomProtocolHandler *createProtocolHandler();
-
- virtual bool handleJob(URLRequestCustomJobDelegate*) = 0;
-
-private:
- QByteArray m_scheme;
-};
-
-
-} // namespace
-
-#endif // CUSTOM_URL_SCHEME_HANDLER_H_
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index c01dcf63..e9af98fd 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -40,6 +40,7 @@
#include "content/public/browser/download_item.h"
#include "content/public/browser/save_page_type.h"
#include "content/public/browser/web_contents.h"
+#include "net/http/http_content_disposition.h"
#include <QDir>
#include <QFile>
@@ -104,6 +105,9 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i
std::string suggestedFilename = item->GetSuggestedFilename();
if (suggestedFilename.empty())
+ suggestedFilename = net::HttpContentDisposition(item->GetContentDisposition(), std::string()).filename();
+
+ if (suggestedFilename.empty())
suggestedFilename = item->GetTargetFilePath().AsUTF8Unsafe();
if (suggestedFilename.empty())
diff --git a/src/core/javascript_dialog_manager_qt.cpp b/src/core/javascript_dialog_manager_qt.cpp
index fdcd7bdb..24d42609 100644
--- a/src/core/javascript_dialog_manager_qt.cpp
+++ b/src/core/javascript_dialog_manager_qt.cpp
@@ -67,6 +67,12 @@ void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webCon
runDialogForContents(webContents, dialogType, toQt(messageText).toHtmlEscaped(), toQt(defaultPromptText).toHtmlEscaped(), toQt(originUrl), callback);
}
+void JavaScriptDialogManagerQt::RunBeforeUnloadDialog(content::WebContents *webContents, const base::string16 &messageText,
+ bool isReload, const content::JavaScriptDialogManager::DialogClosedCallback &callback) {
+ Q_UNUSED(isReload);
+ runDialogForContents(webContents, WebContentsAdapterClient::UnloadDialog, toQt(messageText).toHtmlEscaped(), QString() , QUrl(), callback);
+}
+
bool JavaScriptDialogManagerQt::HandleJavaScriptDialog(content::WebContents *contents, bool accept, const base::string16 *promptOverride)
{
QSharedPointer<JavaScriptDialogController> dialog = m_activeDialogs.value(contents);
diff --git a/src/core/javascript_dialog_manager_qt.h b/src/core/javascript_dialog_manager_qt.h
index 8bf7ac6b..fb47166c 100644
--- a/src/core/javascript_dialog_manager_qt.h
+++ b/src/core/javascript_dialog_manager_qt.h
@@ -63,7 +63,7 @@ public:
const content::JavaScriptDialogManager::DialogClosedCallback &callback, bool *didSuppressMessage) Q_DECL_OVERRIDE;
virtual void RunBeforeUnloadDialog(content::WebContents *, const base::string16 &messageText, bool isReload,
- const content::JavaScriptDialogManager::DialogClosedCallback &callback) Q_DECL_OVERRIDE { Q_UNUSED(messageText); Q_UNUSED(isReload); Q_UNUSED(callback); }
+ const content::JavaScriptDialogManager::DialogClosedCallback &callback) Q_DECL_OVERRIDE;
virtual bool HandleJavaScriptDialog(content::WebContents *, bool accept, const base::string16 *promptOverride) Q_DECL_OVERRIDE;
virtual void CancelActiveAndPendingDialogs(content::WebContents *contents) Q_DECL_OVERRIDE { takeDialogForContents(contents); }
virtual void ResetDialogState(content::WebContents *contents) Q_DECL_OVERRIDE { takeDialogForContents(contents); }
diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp
index d17fc3d2..e3be01b3 100644
--- a/src/core/location_provider_qt.cpp
+++ b/src/core/location_provider_qt.cpp
@@ -60,7 +60,7 @@ public:
QtPositioningHelper(LocationProviderQt *provider);
~QtPositioningHelper();
- bool start(bool highAccuracy);
+ void start(bool highAccuracy);
void stop();
void refresh();
@@ -88,15 +88,20 @@ QtPositioningHelper::~QtPositioningHelper()
m_locationProvider->m_positioningHelper = 0;
}
-bool QtPositioningHelper::start(bool highAccuracy)
+void QtPositioningHelper::start(bool highAccuracy)
{
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Q_UNUSED(highAccuracy);
// FIXME: go through availableSources until one supports QGeoPositionInfoSource::SatellitePositioningMethods
// for the highAccuracy case.
m_positionInfoSource = QGeoPositionInfoSource::createDefaultSource(this);
- if (!m_positionInfoSource)
- return false;
+ if (!m_positionInfoSource) {
+ qWarning("Failed to initialize location provider: The system either has no default "
+ "position source, no valid plugins could be found or the user does not have "
+ "the right permissions.");
+ error(QGeoPositionInfoSource::UnknownSourceError);
+ return;
+ }
connect(m_positionInfoSource, &QGeoPositionInfoSource::positionUpdated, this, &QtPositioningHelper::updatePosition);
// disambiguate the error getter and the signal in QGeoPositionInfoSource.
@@ -105,7 +110,7 @@ bool QtPositioningHelper::start(bool highAccuracy)
connect(m_positionInfoSource, &QGeoPositionInfoSource::updateTimeout, this, &QtPositioningHelper::timeout);
m_positionInfoSource->startUpdates();
- return true;
+ return;
}
void QtPositioningHelper::stop()
@@ -208,7 +213,7 @@ bool LocationProviderQt::StartProvider(bool highAccuracy)
m_positioningHelper = new QtPositioningHelper(this);
m_positioningHelper->moveToThread(guiThread);
}
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(base::IgnoreResult(&QtPositioningHelper::start)
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&QtPositioningHelper::start
, base::Unretained(m_positioningHelper), highAccuracy));
return true;
}
diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp
index 38fd3c71..3f67e7c0 100644
--- a/src/core/network_delegate_qt.cpp
+++ b/src/core/network_delegate_qt.cpp
@@ -55,7 +55,7 @@
namespace QtWebEngineCore {
-static int pageTransitionToNavigationType(ui::PageTransition transition)
+int pageTransitionToNavigationType(ui::PageTransition transition)
{
int32 qualifier = ui::PageTransitionGetQualifier(transition);
@@ -106,6 +106,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C
QWebEngineUrlRequestInfoPrivate *infoPrivate = new QWebEngineUrlRequestInfoPrivate(static_cast<QWebEngineUrlRequestInfo::ResourceType>(resourceType)
, static_cast<QWebEngineUrlRequestInfo::NavigationType>(navigationType)
, qUrl
+ , toQt(request->first_party_for_cookies())
, QByteArray::fromStdString(request->method()));
QWebEngineUrlRequestInfo requestInfo(infoPrivate);
if (interceptor->interceptRequest(requestInfo)) {
diff --git a/src/core/resource_dispatcher_host_delegate_qt.cpp b/src/core/resource_dispatcher_host_delegate_qt.cpp
index b63ecd5c..e6c513bf 100644
--- a/src/core/resource_dispatcher_host_delegate_qt.cpp
+++ b/src/core/resource_dispatcher_host_delegate_qt.cpp
@@ -130,6 +130,35 @@ void ResourceDispatcherHostLoginDelegateQt::destroy()
m_request = 0;
}
+static void LaunchURL(const GURL& url, int render_process_id, int render_view_id,
+ ui::PageTransition page_transition, bool is_main_frame)
+{
+ Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ content::RenderViewHost *render_view_host = content::RenderViewHost::FromID(render_process_id, render_view_id);
+ if (!render_view_host)
+ return;
+ content::WebContents* webContents = content::WebContents::FromRenderViewHost(render_view_host);
+ if (!webContents)
+ return;
+ WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate());
+ contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame);
+}
+
+bool ResourceDispatcherHostDelegateQt::HandleExternalProtocol(const GURL& url, int child_id, int route_id,
+ bool is_main_frame, ui::PageTransition page_transition, bool has_user_gesture)
+{
+ Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ // We don't want to launch external applications unless it is based on a user action
+ if (!has_user_gesture)
+ return false;
+
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&LaunchURL, url, child_id, route_id, page_transition, is_main_frame));
+ return true;
+}
+
content::ResourceDispatcherHostLoginDelegate *ResourceDispatcherHostDelegateQt::CreateLoginDelegate(net::AuthChallengeInfo *authInfo, net::URLRequest *request)
{
// ResourceDispatcherHostLoginDelegateQt is ref-counted and will be released after we called ClearLoginDelegateForRequest.
diff --git a/src/core/resource_dispatcher_host_delegate_qt.h b/src/core/resource_dispatcher_host_delegate_qt.h
index d6229299..57eaa3bc 100644
--- a/src/core/resource_dispatcher_host_delegate_qt.h
+++ b/src/core/resource_dispatcher_host_delegate_qt.h
@@ -86,6 +86,9 @@ private:
class ResourceDispatcherHostDelegateQt : public content::ResourceDispatcherHostDelegate {
public:
+ virtual bool HandleExternalProtocol(const GURL& url, int child_id, int route_id,
+ bool is_main_frame, ui::PageTransition page_transition, bool has_user_gesture) Q_DECL_OVERRIDE;
+
virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(net::AuthChallengeInfo *authInfo, net::URLRequest *request) Q_DECL_OVERRIDE;
};
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index c9ebf7f3..771a662b 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -66,9 +66,9 @@
#include "net/url_request/ftp_protocol_handler.h"
#include "net/ftp/ftp_network_layer.h"
+#include "api/qwebengineurlschemehandler.h"
#include "browser_context_adapter.h"
#include "custom_protocol_handler.h"
-#include "custom_url_scheme_handler.h"
#include "cookie_monster_delegate_qt.h"
#include "content_client_qt.h"
#include "network_delegate_qt.h"
@@ -350,8 +350,8 @@ void URLRequestContextGetterQt::generateJobFactory()
m_jobFactory->SetProtocolHandler(url::kFtpScheme,
new net::FtpProtocolHandler(new net::FtpNetworkLayer(m_urlRequestContext->host_resolver())));
- Q_FOREACH (CustomUrlSchemeHandler* handler, m_browserContext->customUrlSchemeHandlers()) {
- m_jobFactory->SetProtocolHandler(handler->scheme().toStdString(), handler->createProtocolHandler());
+ Q_FOREACH (QWebEngineUrlSchemeHandler *handler, m_browserContext->customUrlSchemeHandlers()) {
+ m_jobFactory->SetProtocolHandler(handler->scheme().toStdString(), new CustomProtocolHandler(handler));
}
m_urlRequestContext->set_job_factory(m_jobFactory.get());
diff --git a/src/core/url_request_custom_job.cpp b/src/core/url_request_custom_job.cpp
index afdcecdf..0a81d04a 100644
--- a/src/core/url_request_custom_job.cpp
+++ b/src/core/url_request_custom_job.cpp
@@ -37,7 +37,8 @@
#include "url_request_custom_job.h"
#include "url_request_custom_job_delegate.h"
-#include "custom_url_scheme_handler.h"
+#include "api/qwebengineurlrequestjob.h"
+#include "api/qwebengineurlschemehandler.h"
#include "type_conversion.h"
#include "content/public/browser/browser_thread.h"
@@ -53,7 +54,7 @@ using namespace net;
namespace QtWebEngineCore {
-URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, NetworkDelegate *networkDelegate, CustomUrlSchemeHandler *schemeHandler)
+URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, NetworkDelegate *networkDelegate, QWebEngineUrlSchemeHandler *schemeHandler)
: URLRequestJob(request, networkDelegate)
, m_device(0)
, m_schemeHandler(schemeHandler)
@@ -236,7 +237,8 @@ void URLRequestCustomJob::startAsync()
QMutexLocker lock(&m_mutex);
m_delegate = new URLRequestCustomJobDelegate(this);
lock.unlock();
- m_schemeHandler->handleJob(m_delegate);
+ QWebEngineUrlRequestJob *requestJob = new QWebEngineUrlRequestJob(m_delegate);
+ m_schemeHandler->requestStarted(requestJob);
}
} // namespace
diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h
index 60a1d60b..a994c467 100644
--- a/src/core/url_request_custom_job.h
+++ b/src/core/url_request_custom_job.h
@@ -45,16 +45,16 @@
#include <QtCore/QPointer>
QT_FORWARD_DECLARE_CLASS(QIODevice)
+QT_FORWARD_DECLARE_CLASS(QWebEngineUrlSchemeHandler)
namespace QtWebEngineCore {
-class CustomUrlSchemeHandler;
class URLRequestCustomJobDelegate;
// A request job that handles reading custom URL schemes
class URLRequestCustomJob : public net::URLRequestJob {
public:
- URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, CustomUrlSchemeHandler *schemeHandler);
+ URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, QWebEngineUrlSchemeHandler *schemeHandler);
virtual void Start() Q_DECL_OVERRIDE;
virtual void Kill() Q_DECL_OVERRIDE;
virtual bool ReadRawData(net::IOBuffer *buf, int bufSize, int *bytesRead) Q_DECL_OVERRIDE;
@@ -81,7 +81,7 @@ private:
QMutex m_mutex;
QPointer<QIODevice> m_device;
QPointer<URLRequestCustomJobDelegate> m_delegate;
- CustomUrlSchemeHandler *m_schemeHandler;
+ QWebEngineUrlSchemeHandler *m_schemeHandler;
std::string m_mimeType;
std::string m_charset;
int m_error;
diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp
index fb293c56..179febc4 100644
--- a/src/core/user_script.cpp
+++ b/src/core/user_script.cpp
@@ -168,14 +168,3 @@ UserScriptData &UserScript::data() const
}
} // namespace QtWebEngineCore
-
-QT_BEGIN_NAMESPACE
-uint qHash(const QtWebEngineCore::UserScript &script, uint seed)
-{
- if (script.isNull())
- return 0;
- return qHash(script.sourceCode(), seed) ^ qHash(script.name(), seed)
- ^ (script.injectionPoint() | (script.runsOnSubFrames() << 4))
- ^ script.worldId();
-}
-QT_END_NAMESPACE
diff --git a/src/core/user_script.h b/src/core/user_script.h
index 7aeba913..69c32c7b 100644
--- a/src/core/user_script.h
+++ b/src/core/user_script.h
@@ -93,8 +93,4 @@ private:
} // namespace QtWebEngineCore
-QT_BEGIN_NAMESPACE
-uint qHash(const QtWebEngineCore::UserScript &, uint seed = 0);
-QT_END_NAMESPACE
-
#endif // USER_SCRIPT_H
diff --git a/src/core/user_script_controller_host.cpp b/src/core/user_script_controller_host.cpp
index d5751827..a0d3f6fe 100644
--- a/src/core/user_script_controller_host.cpp
+++ b/src/core/user_script_controller_host.cpp
@@ -116,9 +116,11 @@ void UserScriptControllerHost::addUserScript(const UserScript &script, WebConten
return;
// Global scripts should be dispatched to all our render processes.
if (!adapter) {
- m_profileWideScripts.insert(script);
- Q_FOREACH (content::RenderProcessHost *renderer, m_observedProcesses)
- renderer->Send(new UserScriptController_AddScript(script.data()));
+ if (!m_profileWideScripts.contains(script)) {
+ m_profileWideScripts.append(script);
+ Q_FOREACH (content::RenderProcessHost *renderer, m_observedProcesses)
+ renderer->Send(new UserScriptController_AddScript(script.data()));
+ }
} else {
content::WebContents *contents = adapter->webContents();
ContentsScriptsMap::iterator it = m_perContentsScripts.find(contents);
@@ -126,11 +128,13 @@ void UserScriptControllerHost::addUserScript(const UserScript &script, WebConten
// We need to keep track of RenderView/RenderViewHost changes for a given contents
// in order to make sure the scripts stay in sync
new WebContentsObserverHelper(this, contents);
- it = m_perContentsScripts.insert(contents, (QSet<UserScript>() << script));
+ it = m_perContentsScripts.insert(contents, (QList<UserScript>() << script));
} else {
- QSet<UserScript> currentScripts = it.value();
- currentScripts.insert(script);
- m_perContentsScripts.insert(contents, currentScripts);
+ QList<UserScript> currentScripts = it.value();
+ if (!currentScripts.contains(script)) {
+ currentScripts.append(script);
+ m_perContentsScripts.insert(contents, currentScripts);
+ }
}
contents->Send(new RenderViewObserverHelper_AddScript(contents->GetRoutingID(), script.data()));
}
@@ -151,7 +155,8 @@ bool UserScriptControllerHost::removeUserScript(const UserScript &script, WebCon
if (script.isNull())
return false;
if (!adapter) {
- QSet<UserScript>::iterator it = m_profileWideScripts.find(script);
+ QList<UserScript>::iterator it
+ = std::find(m_profileWideScripts.begin(), m_profileWideScripts.end(), script);
if (it == m_profileWideScripts.end())
return false;
Q_FOREACH (content::RenderProcessHost *renderer, m_observedProcesses)
@@ -161,12 +166,12 @@ bool UserScriptControllerHost::removeUserScript(const UserScript &script, WebCon
content::WebContents *contents = adapter->webContents();
if (!m_perContentsScripts.contains(contents))
return false;
- QSet<UserScript> &set(m_perContentsScripts[contents]);
- QSet<UserScript>::iterator it = set.find(script);
- if (it == set.end())
+ QList<UserScript> &list(m_perContentsScripts[contents]);
+ QList<UserScript>::iterator it = std::find(list.begin(), list.end(), script);
+ if (it == list.end())
return false;
contents->Send(new RenderViewObserverHelper_RemoveScript(contents->GetRoutingID(), (*it).data()));
- set.erase(it);
+ list.erase(it);
}
return true;
}
@@ -184,7 +189,7 @@ void UserScriptControllerHost::clearAllScripts(WebContentsAdapter *adapter)
}
}
-const QSet<UserScript> UserScriptControllerHost::registeredScripts(WebContentsAdapter *adapter) const
+const QList<UserScript> UserScriptControllerHost::registeredScripts(WebContentsAdapter *adapter) const
{
if (!adapter)
return m_profileWideScripts;
diff --git a/src/core/user_script_controller_host.h b/src/core/user_script_controller_host.h
index 49c96b33..3884fb3b 100644
--- a/src/core/user_script_controller_host.h
+++ b/src/core/user_script_controller_host.h
@@ -64,7 +64,7 @@ public:
bool removeUserScript(const UserScript &script, WebContentsAdapter *adapter);
void clearAllScripts(WebContentsAdapter *adapter);
void reserve(WebContentsAdapter *adapter, int count);
- const QSet<UserScript> registeredScripts(WebContentsAdapter *adapter) const;
+ const QList<UserScript> registeredScripts(WebContentsAdapter *adapter) const;
void renderProcessStartedWithHost(content::RenderProcessHost *renderer);
@@ -75,8 +75,8 @@ private:
void webContentsDestroyed(content::WebContents *);
- QSet<UserScript> m_profileWideScripts;
- typedef QHash<content::WebContents *, QSet<UserScript>> ContentsScriptsMap;
+ QList<UserScript> m_profileWideScripts;
+ typedef QHash<content::WebContents *, QList<UserScript>> ContentsScriptsMap;
ContentsScriptsMap m_perContentsScripts;
QSet<content::RenderProcessHost *> m_observedProcesses;
QScopedPointer<RenderProcessObserverHelper> m_renderProcessObserver;
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 81c945d5..2ab2e947 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -576,6 +576,12 @@ void WebContentsAdapter::selectAll()
d->webContents->SelectAll();
}
+void WebContentsAdapter::requestClose()
+{
+ Q_D(WebContentsAdapter);
+ d->webContents->DispatchBeforeUnload(false);
+}
+
void WebContentsAdapter::unselect()
{
Q_D(const WebContentsAdapter);
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index c2ab6576..6e356bef 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -129,6 +129,7 @@ public:
void inspectElementAt(const QPoint &location);
bool hasInspector() const;
void exitFullScreen();
+ void requestClose();
void wasShown();
void wasHidden();
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 42e3e450..4a857b32 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -147,6 +147,7 @@ public:
AlertDialog,
ConfirmDialog,
PromptDialog,
+ UnloadDialog,
// Leave room for potential new specs
InternalAuthorizationDialog = 0x10,
};
@@ -207,6 +208,7 @@ public:
virtual void unhandledKeyEvent(QKeyEvent *event) = 0;
virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry) = 0;
virtual void close() = 0;
+ virtual void windowCloseRejected() = 0;
virtual bool contextMenuRequested(const WebEngineContextMenuData&) = 0;
virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) = 0;
virtual void requestFullScreen(bool) = 0;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index eb9c42ed..497910a9 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -43,6 +43,7 @@
#include "browser_context_adapter.h"
#include "file_picker_controller.h"
#include "media_capture_devices_dispatcher.h"
+#include "network_delegate_qt.h"
#include "type_conversion.h"
#include "web_contents_adapter_client.h"
#include "web_contents_adapter_p.h"
@@ -64,6 +65,8 @@
#include "content/public/common/web_preferences.h"
#include "ui/events/latency_info.h"
+#include <QDesktopServices>
+
namespace QtWebEngineCore {
// Maps the LogSeverity defines in base/logging.h to the web engines message levels.
@@ -357,6 +360,18 @@ void WebContentsDelegateQt::requestGeolocationPermission(const QUrl &requestingO
m_viewClient->runGeolocationPermissionRequest(requestingOrigin);
}
+extern int pageTransitionToNavigationType(ui::PageTransition transition);
+
+void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame)
+{
+ int navigationRequestAction = WebContentsAdapterClient::AcceptRequest;
+ m_viewClient->navigationRequested(pageTransitionToNavigationType(page_transition), url, navigationRequestAction, is_main_frame);
+#ifndef QT_NO_DESKTOPSERVICES
+ if (navigationRequestAction == WebContentsAdapterClient::AcceptRequest)
+ QDesktopServices::openUrl(url);
+#endif
+}
+
void WebContentsDelegateQt::ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text)
{
Q_UNUSED(web_contents);
@@ -375,4 +390,13 @@ void WebContentsDelegateQt::MoveValidationMessage(content::WebContents *web_cont
m_viewClient->moveValidationMessage(toQt(anchor_in_root_view));
}
+void WebContentsDelegateQt::BeforeUnloadFired(content::WebContents *tab, bool proceed, bool *proceed_to_fire_unload)
+{
+ Q_UNUSED(tab);
+ Q_ASSERT(proceed_to_fire_unload);
+ *proceed_to_fire_unload = proceed;
+ if (!proceed)
+ m_viewClient->windowCloseRejected();
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 3fda9611..abdf75fe 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -91,6 +91,7 @@ public:
virtual void ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) Q_DECL_OVERRIDE;
virtual void HideValidationMessage(content::WebContents *web_contents) Q_DECL_OVERRIDE;
virtual void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) Q_DECL_OVERRIDE;
+ void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) Q_DECL_OVERRIDE;
// WebContentsObserver overrides
virtual void RenderFrameDeleted(content::RenderFrameHost *render_frame_host) Q_DECL_OVERRIDE;
@@ -107,6 +108,7 @@ public:
void overrideWebPreferences(content::WebContents *, content::WebPreferences*);
void allowCertificateError(const QSharedPointer<CertificateErrorController> &) ;
void requestGeolocationPermission(const QUrl &requestingOrigin);
+ void launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame);
private:
WebContentsAdapter *createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture);
diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp
index 9a737fbb..175b5224 100644
--- a/src/webengine/api/qquickwebenginehistory.cpp
+++ b/src/webengine/api/qquickwebenginehistory.cpp
@@ -118,6 +118,26 @@ int QQuickWebEngineForwardHistoryListModelPrivate::offsetForIndex(int index) con
return index + 1;
}
+/*!
+ \qmltype WebEngineHistoryListModel
+ \instantiates QQuickWebEngineHistoryListModel
+ \inqmlmodule QtWebEngine 1.1
+ \since QtWebEngine 1.1
+
+ \brief A data model that represents the history of a web engine page.
+
+ The WebEngineHistoryListModel type exposes the \e title, \e url, and \e offset roles. The
+ \e title and \e url specify the title and URL of the visited page. The \e offset specifies
+ the position of the page in respect to the current page (0). A positive number indicates that
+ the page was visited after the current page, whereas a negative number indicates that the page
+ was visited before the current page.
+
+ This type is uncreatable, but it can be accessed by using the
+ \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property.
+
+ \sa WebEngineHistory
+*/
+
QQuickWebEngineHistoryListModel::QQuickWebEngineHistoryListModel()
: QAbstractListModel()
{
@@ -185,6 +205,67 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate()
{
}
+/*!
+ \qmltype WebEngineHistory
+ \instantiates QQuickWebEngineHistory
+ \inqmlmodule QtWebEngine 1.1
+ \since QtWebEngine 1.1
+
+ \brief Provides data models that represent the history of a web engine page.
+
+ The WebEngineHistory type can be accessed by using the
+ \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property.
+
+ The WebEngineHistory type providess the following WebEngineHistoryListModel data model objects:
+
+ \list
+ \li \c backItems, which contains the URLs of visited pages.
+ \li \c forwardItems, which contains the URLs of the pages that were visited after visiting
+ the current page.
+ \li \c items, which contains the URLs of the back and forward items, as well as the URL of
+ the current page.
+ \endlist
+
+ The easiest way to use these models is to use them in a ListView as illustrated by the
+ following code snippet:
+
+ \code
+ ListView {
+ id: historyItemsList
+ anchors.fill: parent
+ model: webEngineView.navigationHistory.items
+ delegate:
+ Text {
+ color: "black"
+ text: model.title + " - " + model.url + " (" + model.offset + ")"
+ }
+ }
+ \endcode
+
+ The ListView shows the content of the corresponding model. The delegate is responsible for the
+ format of the list items. The appearance of each item of the list in the delegate can be defined
+ separately (it is not web engine specific).
+
+ The model roles \e title and \e url specify the title and URL of the visited page. The \e offset
+ role specifies the position of the page in respect to the current page (0). A positive number
+ indicates that the page was visited after the current page, whereas a negative number indicates
+ that the page was visited before the current page.
+
+ The data models can also be used to create a menu, as illustrated by the following code
+ snippet:
+
+ \quotefromfile webengine/quicknanobrowser/browserwindow.qml
+ \skipto ToolBar
+ \printuntil onObjectRemoved
+ \printuntil }
+ \printuntil }
+ \printuntil }
+
+ For the complete example, see \l{WebEngine Quick Nano Browser}.
+
+ \sa WebEngineHistoryListModel
+*/
+
QQuickWebEngineHistory::QQuickWebEngineHistory(QQuickWebEngineViewPrivate *view)
: d_ptr(new QQuickWebEngineHistoryPrivate(view))
{
@@ -194,6 +275,13 @@ QQuickWebEngineHistory::~QQuickWebEngineHistory()
{
}
+/*!
+ \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::items
+ \readonly
+ \since QtWebEngine 1.1
+
+ URLs of back items, forward items, and the current item in the history.
+*/
QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::items() const
{
Q_D(const QQuickWebEngineHistory);
@@ -202,6 +290,13 @@ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::items() const
return d->m_navigationModel.data();
}
+/*!
+ \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::backItems
+ \readonly
+ \since QtWebEngine 1.1
+
+ URLs of visited pages.
+*/
QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::backItems() const
{
Q_D(const QQuickWebEngineHistory);
@@ -210,6 +305,13 @@ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::backItems() const
return d->m_backNavigationModel.data();
}
+/*!
+ \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::forwardItems
+ \readonly
+ \since QtWebEngine 1.1
+
+ URLs of the pages that were visited after visiting the current page.
+*/
QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::forwardItems() const
{
Q_D(const QQuickWebEngineHistory);
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index 539f211b..8f2e1bcf 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -54,13 +54,15 @@ QQuickWebEngineSettings::QQuickWebEngineSettings(QQuickWebEngineSettings *parent
\instantiates QQuickWebEngineSettings
\inqmlmodule QtWebEngine
\since QtWebEngine 1.1
- \brief WebEngineSettings allows configuration of browser properties and attributes.
+ \brief Allows configuration of browser properties and attributes.
- WebEngineSettings allows configuration of browser properties and generic attributes, such as
- JavaScript support, focus behavior, and access to remote content.
-
- Each WebEngineView can have individual settings.
+ The WebEngineSettings type can be used to configure browser properties and generic
+ attributes, such as JavaScript support, focus behavior, and access to remote content. This type
+ is uncreatable, but the default settings for all web engine views can be accessed by using
+ the \l [QML] {WebEngine::settings}{WebEngine.settings} property.
+ Each web engine view can have individual settings that can be accessed by using the
+ \l{WebEngineView::settings}{WebEngineView.settings} property.
*/
diff --git a/src/webengine/api/qquickwebenginesingleton.cpp b/src/webengine/api/qquickwebenginesingleton.cpp
index 3f0c8cb6..7ff974eb 100644
--- a/src/webengine/api/qquickwebenginesingleton.cpp
+++ b/src/webengine/api/qquickwebenginesingleton.cpp
@@ -41,11 +41,47 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmltype WebEngine
+ \instantiates QQuickWebEngineSingleton
+ \inqmlmodule QtWebEngine 1.1
+ \since QtWebEngine 1.1
+ \brief Provides access to the default settings and profiles shared by all web engine views.
+
+ The WebEngine singleton type provides access to the default profile and the default settings
+ shared by all web engine views. It can be used to change settings globally, as illustrated by
+ the following code snippet:
+
+ \code
+ Component.onCompleted: {
+ WebEngine.settings.javaScriptEnabled = true;
+ }
+ \endcode
+*/
+
+/*!
+ \qmlproperty WebEngineSettings WebEngine::settings
+ \readonly
+ \since QtWebEngine 1.1
+
+ Default settings for all web engine views.
+
+ \sa WebEngineSettings
+*/
QQuickWebEngineSettings *QQuickWebEngineSingleton::settings() const
{
return defaultProfile()->settings();
}
+/*!
+ \qmlproperty WebEngineProfile WebEngine::defaultProfile
+ \readonly
+ \since QtWebEngine 1.1
+
+ Default profile for all web engine views.
+
+ \sa WebEngineProfile
+*/
QQuickWebEngineProfile *QQuickWebEngineSingleton::defaultProfile() const
{
return QQuickWebEngineProfile::defaultProfile();
diff --git a/src/webengine/api/qquickwebenginetestsupport_p.h b/src/webengine/api/qquickwebenginetestsupport_p.h
index 9690e538..d4b50ac2 100644
--- a/src/webengine/api/qquickwebenginetestsupport_p.h
+++ b/src/webengine/api/qquickwebenginetestsupport_p.h
@@ -80,6 +80,7 @@ public:
Q_SIGNALS:
void validationMessageShown(const QString &mainText, const QString &subText);
+ void windowCloseRejected();
private:
QScopedPointer<QQuickWebEngineErrorPage> m_errorPage;
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index c1b21adf..d2fb7f19 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -507,7 +507,16 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(WebContentsAdapter *newWebConten
void QQuickWebEngineViewPrivate::close()
{
- // Not implemented yet.
+ Q_Q(QQuickWebEngineView);
+ emit q->windowCloseRequested();
+}
+
+void QQuickWebEngineViewPrivate::windowCloseRejected()
+{
+#ifdef ENABLE_QML_TESTSUPPORT_API
+ if (m_testSupport)
+ Q_EMIT m_testSupport->windowCloseRejected();
+#endif
}
void QQuickWebEngineViewPrivate::requestFullScreen(bool fullScreen)
@@ -1315,6 +1324,9 @@ void QQuickWebEngineView::triggerWebAction(WebAction action)
case ExitFullScreen:
d->adapter->exitFullScreen();
break;
+ case RequestClose:
+ d->adapter->requestClose();
+ break;
default:
Q_UNREACHABLE();
}
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index b512648d..b0fd5cff 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -230,6 +230,7 @@ public:
InspectElement,
ExitFullScreen,
+ RequestClose,
Unselect,
WebActionCount
@@ -310,6 +311,7 @@ Q_SIGNALS:
Q_REVISION(2) void activeFocusOnPressChanged(bool);
Q_REVISION(2) void backgroundColorChanged();
Q_REVISION(2) void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode);
+ Q_REVISION(2) void windowCloseRequested();
Q_REVISION(3) void contentsSizeChanged(const QSizeF& size);
Q_REVISION(3) void scrollPositionChanged(const QPointF& position);
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 08d58419..f2924faf 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -143,6 +143,7 @@ public:
virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) Q_DECL_OVERRIDE;
virtual void close() Q_DECL_OVERRIDE;
+ virtual void windowCloseRejected() Q_DECL_OVERRIDE;
virtual void requestFullScreen(bool) Q_DECL_OVERRIDE;
virtual bool isFullScreen() const Q_DECL_OVERRIDE;
virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &) Q_DECL_OVERRIDE;
diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf
index f833cf0d..e277f419 100644
--- a/src/webengine/doc/qtwebengine.qdocconf
+++ b/src/webengine/doc/qtwebengine.qdocconf
@@ -4,7 +4,7 @@ project = QtWebEngine
description = Qt WebEngine Reference Documentation
version = $QT_VERSION
-examplesinstallpath = webengine
+examplesinstallpath =
qhp.projects = QtWebEngine
@@ -44,21 +44,24 @@ depends += qtcore \
qtquickcontrols \
qtdoc \
qtwebchannel \
- qtwebenginewidgets
+ qtwidgets
-headerdirs += . \
- ../api \
- ../../core/api
+headerdirs += .. \
+ ../../core \
+ ../../webenginewidgets
-sourcedirs += . \
- ../api \
- ../../core/api \
- ../../core/doc/src
+sourcedirs += .. \
+ ../../core/ \
+ ../../webenginewidgets \
exampledirs += . \
- ../../../examples/webengine \
+ ../../../examples \
snippets \
- ../../core/doc/snippets
+ ../../core/doc/snippets \
+ ../../webenginewidgets/doc/snippets
+
+
+imagedirs += images
navigation.landingpage = "Qt WebEngine"
navigation.cppclassespage = "Qt WebEngine C++ Classes"
diff --git a/src/webengine/doc/src/external-resources.qdoc b/src/webengine/doc/src/external-resources.qdoc
new file mode 100644
index 00000000..34a66291
--- /dev/null
+++ b/src/webengine/doc/src/external-resources.qdoc
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \externalpage http://www.chromium.org
+ \title Chromium Project
+*/
+
+/*!
+ \externalpage https://developers.google.com/web/tools/chrome-devtools
+ \title Chrome DevTools
+*/
+
+/*
+ This prevents autolinking of each occurrence of 'WebEngine'
+ To link to the WebEngine QML type, use explicit linking:
+ \l [QML] WebEngine
+ \sa {QtWebEngine::}{WebEngine}
+*/
+/*!
+ \externalpage nolink
+ \title WebEngine
+ \internal
+*/
diff --git a/src/webengine/doc/src/qtwebengine-devtools.qdoc b/src/webengine/doc/src/qtwebengine-devtools.qdoc
index 008fa925..ee87214e 100644
--- a/src/webengine/doc/src/qtwebengine-devtools.qdoc
+++ b/src/webengine/doc/src/qtwebengine-devtools.qdoc
@@ -37,9 +37,11 @@
To activate the developer tools, start an application that uses Qt
WebEngine with the command-line arguments:
- \code
+
+ \badcode
--remote-debugging-port=<port_number>
\endcode
+
Where \c <port_number> refers to a local network port. The web developer
tools can then be accessed by launching a browser at the address
\c http://localhost:<port_number>.
@@ -52,5 +54,5 @@
device.
For a detailed explanation of the capabilities of developer tools, see the
- \l{https://developers.google.com/web/tools/chrome-devtools}{Chrome DevTools page}.
+ \l {Chrome DevTools} page.
*/
diff --git a/src/webengine/doc/src/qtwebengine-index.qdoc b/src/webengine/doc/src/qtwebengine-index.qdoc
index 20d2de48..e67bd43f 100644
--- a/src/webengine/doc/src/qtwebengine-index.qdoc
+++ b/src/webengine/doc/src/qtwebengine-index.qdoc
@@ -69,6 +69,7 @@
\list
\li \l{Qt WebEngine Overview}
+ \li \l{Qt WebEngine Platform Notes}
\li \l{Qt WebEngine Web Developer Tools}
\li \l{Porting from Qt WebKit to Qt WebEngine}
\endlist
@@ -83,8 +84,7 @@
\section1 API References
\list
- \li \l{Qt WebEngine Core C++ Classes}
- \li \l{Qt WebEngine Widgets C++ Classes}
+ \li \l{Qt WebEngine C++ Classes}
\li \l{Qt WebEngine QML Types}
\endlist
*/
diff --git a/src/webengine/doc/src/qtwebengine-modules.qdoc b/src/webengine/doc/src/qtwebengine-modules.qdoc
new file mode 100644
index 00000000..2e1b4c94
--- /dev/null
+++ b/src/webengine/doc/src/qtwebengine-modules.qdoc
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebengine-modules.html
+ \title Qt WebEngine C++ Classes
+ \brief Provides functionality for rendering regions of dynamic web content.
+
+ \e {Qt WebEngine} provides functionality for rendering regions of dynamic web content.
+
+ \section1 Classes
+
+ \section2 Qt WebEngineCore Module
+ \generatelist {classesbymodule QtWebEngineCore}
+
+ \section2 Qt WebEngineWidgets Module
+ \generatelist {classesbymodule QtWebEngineWidgets}
+*/
diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc
index 656dd13f..15052f6e 100644
--- a/src/webengine/doc/src/qtwebengine-overview.qdoc
+++ b/src/webengine/doc/src/qtwebengine-overview.qdoc
@@ -39,7 +39,8 @@
made fully editable by the user through the use of the \c{contenteditable} attribute on HTML
elements.
- Qt WebEngine supercedes the \l{Qt WebKit Widgets}{Qt WebKit} module, which is based on the
+ Qt WebEngine supercedes the \l{http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html}{Qt WebKit}
+ module, which is based on the
WebKit project, but has not been actively synchronized with the upstream WebKit code since
Qt 5.2 and has been deprecated in Qt 5.5. For tips on how to change a Qt WebKit widgets
application to use Qt WebEngine widgets, see \l{Porting from Qt WebKit to Qt WebEngine}. For new
@@ -60,11 +61,11 @@
Qt WebEngine Widgets
\endlist
- The Qt WebEngine core is based on the \l{http://www.chromium.org}{Chromium Project}. Chromium
- provides its own network and painting engines and is developed tightly together with its
- dependent modules, and therefore Qt WebEngine provides better and more reliable support for the
- latest HTML5 specification than Qt WebKit. However, Qt WebEngine is thus heavier than Qt WebKit
- and does not provide direct access to the network stack and the HTML document through C++ APIs.
+ The Qt WebEngine core is based on the \l {Chromium Project}. Chromium provides its own network
+ and painting engines and is developed tightly together with its dependent modules, and
+ therefore Qt WebEngine provides better and more reliable support for the latest HTML5
+ specification than Qt WebKit. However, Qt WebEngine is thus heavier than Qt WebKit and does
+ not provide direct access to the network stack and the HTML document through C++ APIs.
Chromium is tightly integrated to the \l{Qt Quick Scene Graph}{Qt Quick scene graph}, which is
based on OpenGL ES 2.0 or OpenGL 2.0 for its rendering. This provides you with one-pass
@@ -103,7 +104,7 @@
The following sample QML application loads a web page and responds to session history context:
- \code
+ \qml
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtWebEngine 1.1
@@ -118,7 +119,7 @@
anchors.fill: parent
}
}
- \endcode
+ \endqml
\section1 Using WebEngine Core
diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
new file mode 100644
index 00000000..86cccfa3
--- /dev/null
+++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebengine-platform-notes.html
+ \title Qt WebEngine Platform Notes
+
+ \brief Contains information about issues that are specific to the Qt WebEngine module.
+
+ \section1 Building Qt WebEngine from Source
+
+ The requirements for building Qt 5 modules from source are listed separately for each supported
+ platform:
+
+ \list
+ \li \l{Qt for Windows - Requirements}
+ \li \l{Qt for X11 Requirements}
+ \li \l{Qt for OS X - Requirements}
+ \endlist
+
+ In addition, the following tools are required for building the \l {Qt WebEngine} module:
+
+ \list
+ \li Windows: Visual Studio 2013 or Visual Studio 2013 Express
+ \li Linux: Clang or GCC version 4.7 or later
+ \li OS X: Xcode version 5.1 or later
+ \endlist
+*/
diff --git a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
index 6d3d7189..e098071b 100644
--- a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
+++ b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
@@ -32,7 +32,7 @@
The QML types can be imported into your application using the following import statements in
your .qml file:
- \code
+ \badcode
import QtQuick 2.0
import QtWebEngine 1.1
\endcode
diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc
index f763227e..f230ba26 100644
--- a/src/webengine/doc/src/webengineview.qdoc
+++ b/src/webengine/doc/src/webengineview.qdoc
@@ -75,6 +75,7 @@
/*!
\qmlmethod void WebEngineView::reloadAndBypassCache()
+ \since QtWebEngine 1.1
Reloads the current page, ignoring any cached content.
@@ -84,7 +85,7 @@
/*!
\qmlproperty url WebEngineView::url
- The location of the currently displaying HTML page. This writable
+ The location of the currently displayed HTML page. This writable
property offers the main interface to load a page into a web view.
It functions the same as the \c{window.location} DOM property.
@@ -95,7 +96,7 @@
\qmlproperty url WebEngineView::icon
\readonly
- This property holds the location of the currently displaying web site icon,
+ The location of the currently displayed web site icon,
also known as favicon or shortcut icon. This read-only URL corresponds to
the image used within a mobile browser application to represent a
bookmarked page on the device's home screen.
@@ -103,20 +104,20 @@
The following snippet uses the \c{icon} property to build an \c{Image}
component:
- \code
+ \qml
Image {
id: appIcon
source: webView.icon != "" ? webView.icon : "fallbackFavIcon.png";
- ...
+ // ...
}
- \endcode
+ \endqml
*/
/*!
\qmlproperty int WebEngineView::loadProgress
\readonly
- This property holds the amount of the page that has been loaded, expressed
+ The amount of data from the page that has been loaded, expressed
as an integer percentage in the range from \c{0} to \c{100}.
*/
@@ -147,7 +148,7 @@
\qmlproperty string WebEngineView::title
\readonly
- This property holds the title of the currently displaying HTML page, a
+ The title of the currently displayed HTML page. This is a
read-only value that reflects the contents of the \c{<title>} tag.
*/
@@ -207,6 +208,7 @@
/*!
\qmlproperty list<WebEngineScript> WebEngineView::userScripts
\readonly
+ \since QtWebEngine 1.1
List of script objects attached to the view.
*/
@@ -221,15 +223,15 @@
/*!
\qmlmethod void WebEngineView::loadHtml(string html, url baseUrl)
- \brief Loads the specified \a html as the content of the web view.
+ Loads the specified \a html as the content of the web view.
This method offers a lower-level alternative to the \c{url} property,
which references HTML pages via URL.
- External objects such as stylesheets or images referenced in the HTML
- document should be located relative to \a baseUrl. For example, if \a html
+ External objects, such as stylesheets or images referenced in the HTML
+ document, should be located relative to \a baseUrl. For example, if \a html
is retrieved from \c http://www.example.com/documents/overview.html, which
- is the base url, then an image referenced with the relative url, \c diagram.png,
+ is the base URL, then an image referenced with the relative URL, \c diagram.png,
should be at \c{http://www.example.com/documents/diagram.png}.
\sa url
@@ -237,15 +239,19 @@
/*!
\qmlmethod void WebEngineView::runJavaScript(string script, variant callback)
- \brief Runs the specified \a script in the content of the web view.
+ Runs the specified \a script in the content of the web view.
- In case a callback function is provided it will be invoked after the script
- finished running.
+ In case a callback function is provided, it will be invoked after the script
+ finishes running.
\code
runJavaScript("document.title", function(result) { console.log(result); });
\endcode
+ The script will run in the same \e world as other scripts that are
+ part of the loaded site.
+
+ See WebEngineView::userScripts for an alternative API to inject scripts.
*/
/*!
@@ -305,7 +311,7 @@
Immediately sets \c{isFullScreen} property to \c{false}. It can be used to notify the
browser engine when the windowing system forces the application to leave fullscreen mode.
- \code
+ \qml
ApplicationWindow {
onVisibilityChanged: {
if (webEngineView.isFullScreen && visibility != Window.FullScreen)
@@ -314,16 +320,37 @@
WebEngineView {
id: webEngineView
- ...
+ // ...
}
}
- \endcode
+ \endqml
\sa isFullScreen, fullScreenRequested()
*/
/*!
+ \qmlmethod void WebEngineView::setActiveFocusOnPress(bool arg)
+ \since QtWebEngine 1.2
+
+ Sets active focus to a clicked web engine view if \a arg is \c true. By setting it to \c false,
+ a web engine view can be used to create a UI element that should not get focus. This can be
+ useful in a hybrid UI.
+
+ \sa activeFocusOnPressChanged()
+*/
+
+/*!
+ \qmlmethod void WebEngineView::triggerWebAction(WebAction action)
+ \since QtWebEngine 1.2
+
+ Triggers the web action \a action.
+
+ \sa WebAction
+*/
+
+/*!
\qmlsignal WebEngineView::featurePermissionRequested(url securityOrigin, Feature feature)
+ \since QtWebEngine 1.1
This signal is emitted when the web site identified by \a securityOrigin requests
to make use of the resource or device identified by \a feature.
@@ -335,9 +362,9 @@
\qmlsignal WebEngineView::loadingChanged(loadRequest)
This signal is emitted when a page load begins, ends, or fails.
- The corresponding handler is onLoadingChanged.
+ The corresponding handler is \c onLoadingChanged.
- When handling the signal with onLoadingChanged, various read-only
+ When handling the signal with \c onLoadingChanged, various read-only
parameters are available on the \a loadRequest:
\table
@@ -349,10 +376,7 @@
\li The location of the resource that is loading.
\row
\li status
- \li Reflects one of four load states:
- \c{WebEngineView::LoadStartedStatus}, \c{WebEngineView::LoadStoppedStatus},
- \c{WebEngineView::LoadSucceededStatus}, or \c{WebEngineView::LoadFailedStatus}.
- See WebEngineLoadRequest::status and WebEngineView::LoadStatus.
+ \li The \l{LoadStatus}{load status} of the page.
\row
\li errorString
\li The description of load error.
@@ -361,13 +385,10 @@
\li The HTTP error code.
\row
\li errorDomain
- \li The high-level error types, one of
- \c{WebEngineView::ConnectionErrorDomain}, \c{WebEngineView::HttpErrorDomain}, \c{WebEngineView::InternalErrorDomain},
- \c{WebEngineView::DownloadErrorDomain}, or \c{WebEngineView::NoErrorDomain}. See
- \l{WebEngineView::ErrorDomain} for the full list.
+ \li The high-level \l{ErrorDomain}{error type}.
\endtable
- \sa loading
+ \sa loading, LoadStatus, ErrorDomain
*/
/*!
@@ -379,14 +400,14 @@
The certificate error can be rejected by calling WebEngineCertificateError::rejectCertificate,
which will stop loading the request.
- The certificate error can be ignored by calling WebEngineCertificateError::ignoreCertificateError
- which will resume loading the request.
+ The certificate error can be ignored by calling
+ WebEngineCertificateError::ignoreCertificateError, which will resume loading the request.
It is possible to defer the decision of rejecting the given certificate by calling
WebEngineCertificateError::defer, which is useful when waiting for user input.
- By default the invalid certificate will be automatically rejected.
+ By default, the invalid certificate will be automatically rejected.
- The corresponding handler is onCertificateError.
+ The corresponding handler is \c onCertificateError.
\sa WebEngineCertificateError
*/
@@ -400,19 +421,20 @@
events that are not cancelled with \c{preventDefault()}. \a{hoveredUrl}
provides the link's location.
- The corresponding handler is onLinkHovered.
+ The corresponding handler is \c onLinkHovered.
*/
/*!
\qmlsignal WebEngineView::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, message, lineNumber, sourceID)
This signal is emitted when a JavaScript program tries to print a \a message to the web browser's console.
- For example in case of evaluation errors the source URL may be provided in \a sourceID as well as the \a lineNumber.
+ For example, in case of evaluation errors the source URL may be provided in \a sourceID as well
+ as the \a lineNumber.
- \a level indicates the severity of the event that triggered the message, i.e. if it
+ \a level indicates the severity of the event that triggered the message, that is, whether it
was triggered by an error or a less severe event.
- The corresponding handler is onJavaScriptConsoleMessage.
+ The corresponding handler is \c onJavaScriptConsoleMessage.
*/
/*!
@@ -420,18 +442,18 @@
\since QtWebEngine 1.1
This signal is emitted when a page load is requested to happen in a separate
- WebEngineView. This can either be because the current page requested it explicitly
- through a JavaScript call to window.open, or because the user clicked on a link
- while holding Shift, Ctrl or a built-in combination that triggers the page to open
+ web engine view. This can either be because the current page requested it explicitly
+ through a JavaScript call to \c window.open, or because the user clicked on a link
+ while holding Shift, Ctrl, or a built-in combination that triggers the page to open
in a new window.
- If this signal isn't handled the requested load will fail.
+ If this signal is not handled, the requested load will fail.
An example implementation:
\snippet snippets/qtwebengine_webengineview_newviewrequested.qml 0
- The corresponding handler is onNewViewRequested.
+ The corresponding handler is \c onNewViewRequested.
\sa WebEngineNewViewRequest, NewViewDestination, {WebEngine Quick Nano Browser}
*/
@@ -443,15 +465,54 @@
This signal is emitted when the web page requests fullscreen mode through the
JavaScript API.
- The corresponding handler is onFullScreenRequested.
+ The corresponding handler is \c onFullScreenRequested.
\sa WebEngineFullScreenRequest, isFullScreen
*/
/*!
+ \qmlsignal WebEngineView::activeFocusOnPressChanged(bool)
+ \since QtWebEngine 1.2
+
+ This signal is emitted when the ability of the web engine view to get focus when clicked
+ changes.
+
+ \sa setActiveFocusOnPress()
+*/
+
+/*!
+ \qmlsignal WebEngineView::backgroundColorChanged()
+ \since QtWebEngine 1.2
+
+ This signal is emitted when the web engine view background color changes.
+*/
+
+/*!
+ \qmlsignal WebEngineView::renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode)
+
+ \since QtWebEngine 1.2
+
+ This signal is emitted when the render process is terminated with a non-zero exit status.
+ \a terminationStatus is the termination status of the process and \a exitCode is the status code
+ with which the process terminated.
+
+ \sa RenderProcessTerminationStatus
+*/
+
+/*!
+ \qmlsignal WebEngineView::windowCloseRequested()
+ \since QtWebEngine 1.2
+
+ This signal is emitted whenever the page requests the web browser window to be closed,
+ for example through the JavaScript \c{window.close()} call.
+
+ The corresponding handler is \c onWindowCloseRequested.
+*/
+
+/*!
\qmlproperty enumeration WebEngineView::ErrorDomain
- This enumeration details various high-level error types.
+ Describes various high-level error types:
\value WebEngineView::NoErrorDomain
\value WebEngineView::InternalErrorDomain
@@ -471,68 +532,42 @@
/*!
\qmlproperty enumeration WebEngineView::JavaScriptConsoleMessageLevel
- Indicates the severity of a JavaScript console message.
-
- \table
-
- \header
- \li Constant
- \li Description
-
- \row
- \li InfoMessageLevel
- \li Message is purely informative and should be safe to ignore.
-
- \row
- \li WarningMessageLevel
- \li Message indicates there might be a problem that may need attention.
-
- \row
- \li ErrorMessageLevel
- \li Message indicates there has been an error.
+ Indicates the severity of a JavaScript console message:
- \endtable
+ \value InfoMessageLevel
+ Message is purely informative and can safely be ignored.
+ \value WarningMessageLevel
+ Message indicates there might be a problem that may need attention.
+ \value ErrorMessageLevel
+ Message indicates there has been an error.
*/
/*!
\qmlproperty enumeration WebEngineView::LoadStatus
- Reflects a page's load status.
+ Reflects a page's load status:
- \table
-
- \header
- \li Constant
- \li Description
-
- \row
- \li LoadStartedStatus
- \li Page is currently loading.
-
- \row
- \li LoadSucceededStatus
- \li Page has successfully loaded, and is not currently loading.
-
- \row
- \li LoadFailedStatus
- \li Page has failed to load, and is not currently loading.
-
- \endtable
+ \value LoadStartedStatus
+ Page is currently loading.
+ \value LoadSucceededStatus
+ Page has successfully loaded, and is not currently loading.
+ \value LoadFailedStatus
+ Page has failed to load, and is not currently loading.
*/
/*!
\qmlproperty enumeration WebEngineView::NewViewDestination
- This enumeration details the format in which a new view request should be opened.
+ Describes how to open a new view:
\value WebEngineView::NewViewInWindow
- The page expects to be opened in a separate Window.
+ In a separate Window.
\value WebEngineView::NewViewInTab
- The page expects to be opened in a tab of the same window.
+ In a tab of the same window.
\value WebEngineView::NewViewInDialog
- The page expects to be opened in a Window without any tab, tool or URL bar.
+ In a Window without a tab bar, toolbar, or URL bar.
\value WebEngineView::NewViewInBackgroundTab
- The page expects to be opened in a tab of the same window, without hiding the currently visible WebEngineView.
+ In a tab of the same window, without hiding the currently visible web engine view.
\sa WebEngineNewViewRequest::destination
*/
@@ -540,7 +575,7 @@
/*!
\qmlproperty enumeration WebEngineView::FindFlags
- This enum describes the options available to the findText() function. The options
+ Describes the options available to the findText() function. The options
can be OR-ed together from the following list:
\value FindBackward Searches backwards instead of forwards.
@@ -551,14 +586,106 @@
*/
/*!
+ \qmlproperty enumeration WebEngineView::RenderProcessTerminationStatus
+ \since QtWebEngine 1.2
+
+ Describes the status with which the render process terminated:
+
+ \value NormalTerminationStatus
+ The render process terminated normally.
+ \value AbnormalTerminationStatus
+ The render process terminated with a non-zero exit status.
+ \value CrashedTerminationStatus
+ The render process crashed, for example because of a segmentation fault.
+ \value KilledTerminationStatus
+ The render process was killed, for example by \c SIGKILL or task manager kill.
+*/
+
+/*!
+ \qmlproperty enumeration WebEngineView::WebAction
+ \since QtWebEngine 1.2
+
+ Describes the types of action that can be performed on a web page:
+
+ \value NoWebAction
+ No action is triggered.
+ \value Back
+ Navigate back in the history of navigated links.
+ \value Forward
+ Navigate forward in the history of navigated links.
+ \value Stop
+ Stop loading the current page.
+ \value Reload
+ Reload the current page.
+ \value ReloadAndBypassCache
+ Reload the current page, but do not use any local cache.
+ \value Cut
+ Cut the content currently selected into the clipboard.
+ \value Copy
+ Copy the content currently selected into the clipboard.
+ \value Paste
+ Paste content from the clipboard.
+ \value Undo
+ Undo the last editing action.
+ \value Redo
+ Redo the last editing action.
+ \value SelectAll
+ Select all content.
+ \value PasteAndMatchStyle
+ Paste content from the clipboard with current style.
+ \value OpenLinkInThisWindow
+ Open the current link in the current window. (Added in Qt 5.6)
+ \value OpenLinkInNewWindow
+ Open the current link in a new window. (Added in Qt 5.6)
+ \value OpenLinkInNewTab
+ Open the current link in a new tab. (Added in Qt 5.6)
+ \value CopyLinkToClipboard
+ Copy the current link to the clipboard. (Added in Qt 5.6)
+ \value CopyImageToClipboard
+ Copy the clicked image to the clipboard. (Added in Qt 5.6)
+ \value CopyImageUrlToClipboard
+ Copy the clicked image's URL to the clipboard. (Added in Qt 5.6)
+ \value CopyMediaUrlToClipboard
+ Copy the hovered audio or video's URL to the clipboard. (Added in Qt 5.6)
+ \value ToggleMediaControls
+ Toggle between showing and hiding the controls for the hovered audio or video element.
+ (Added in Qt 5.6)
+ \value ToggleMediaLoop
+ Toggle whether the hovered audio or video should loop on completetion or not.
+ (Added in Qt 5.6)
+ \value ToggleMediaPlayPause
+ Toggle the play/pause state of the hovered audio or video element. (Added in Qt 5.6)
+ \value ToggleMediaMute
+ Mute or unmute the hovered audio or video element. (Added in Qt 5.6)
+ \value DownloadLinkToDisk
+ Download the current link to the disk. (Added in Qt 5.6)
+ \value DownloadImageToDisk
+ Download the highlighted image to the disk. (Added in Qt 5.6)
+ \value DownloadMediaToDisk
+ Download the hovered audio or video to the disk. (Added in Qt 5.6)
+ \value InspectElement
+ Trigger any attached Web Inspector to inspect the highlighed element.
+ (Added in Qt 5.6)
+ \value ExitFullScreen
+ Exit the fullscreen mode. (Added in Qt 5.6)
+
+ \omitvalue WebActionCount
+*/
+
+/*!
\qmlproperty enumeration WebEngineView::Feature
- This enum describes the platform feature access categories that the user may be asked to grant or deny access to.
+ Describes the platform feature access categories that the user may be asked to grant or deny
+ access to:
- \value Geolocation Access to location hardware or service
- \value MediaAudioCapture Audio capture devices such a microphones
- \value MediaVideoCapture Video devices, e.g. cameras
- \value MediaAudioVideoCapture Both Audio and Video capture devices.
+ \value Geolocation
+ Location hardware or service.
+ \value MediaAudioCapture
+ Audio capture devices, such as microphones.
+ \value MediaVideoCapture
+ Video devices, such as cameras.
+ \value MediaAudioVideoCapture
+ Both audio and video capture devices.
\sa featurePermissionRequested(), grantFeaturePermission()
*/
@@ -569,7 +696,7 @@
\inqmlmodule QtWebEngine 1.1
\since QtWebEngine 1.1
- \brief A utility class for the WebEngineView::fullScreenRequested() signal.
+ \brief A utility type for the WebEngineView::fullScreenRequested() signal.
\sa WebEngineView::fullScreenRequested()
*/
@@ -591,7 +718,7 @@
Call this method to accept the fullscreen request. It sets the WebEngineView::isFullScreen
property to be equal to toggleOn.
- \code
+ \qml
ApplicationWindow {
id: window
WebEngineView {
@@ -604,7 +731,7 @@
}
}
}
- \endcode
+ \endqml
\sa toggleOn
*/
diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes
index 9dcded7b..1e577bf5 100644
--- a/src/webengine/plugin/plugins.qmltypes
+++ b/src/webengine/plugin/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtWebEngine 1.1'
+// 'qmlplugindump -nonrelocatable QtWebEngine 1.2'
Module {
dependencies: []
@@ -571,8 +571,11 @@ Module {
Component {
name: "QQuickWebEngineProfile"
prototype: "QObject"
- exports: ["QtWebEngine/WebEngineProfile 1.1"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtWebEngine/WebEngineProfile 1.1",
+ "QtWebEngine/WebEngineProfile 1.2"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "HttpCacheType"
values: {
@@ -594,8 +597,10 @@ Module {
Property { name: "cachePath"; type: "string" }
Property { name: "httpUserAgent"; type: "string" }
Property { name: "httpCacheType"; type: "HttpCacheType" }
+ Property { name: "httpAcceptLanguage"; type: "string" }
Property { name: "persistentCookiesPolicy"; type: "PersistentCookiesPolicy" }
Property { name: "httpCacheMaximumSize"; type: "int" }
+ Signal { name: "httpAcceptLanguageChanged"; revision: 1 }
Signal {
name: "downloadRequested"
Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true }
@@ -604,6 +609,11 @@ Module {
name: "downloadFinished"
Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true }
}
+ Method {
+ name: "setCookieStoreClient"
+ revision: 1
+ Parameter { name: "client"; type: "QWebEngineCookieStoreClient"; isPointer: true }
+ }
}
Component {
name: "QQuickWebEngineScript"
@@ -685,9 +695,12 @@ Module {
Component {
name: "QQuickWebEngineSettings"
prototype: "QObject"
- exports: ["QtWebEngine/WebEngineSettings 1.1"]
+ exports: [
+ "QtWebEngine/WebEngineSettings 1.1",
+ "QtWebEngine/WebEngineSettings 1.2"
+ ]
isCreatable: false
- exportMetaObjectRevisions: [0]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "autoLoadImages"; type: "bool" }
Property { name: "javascriptEnabled"; type: "bool" }
Property { name: "javascriptCanOpenWindows"; type: "bool" }
@@ -699,7 +712,10 @@ Module {
Property { name: "localContentCanAccessFileUrls"; type: "bool" }
Property { name: "hyperlinkAuditingEnabled"; type: "bool" }
Property { name: "errorPageEnabled"; type: "bool" }
+ Property { name: "pluginsEnabled"; type: "bool" }
+ Property { name: "fullScreenSupportEnabled"; revision: 1; type: "bool" }
Property { name: "defaultTextEncoding"; type: "string" }
+ Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 }
}
Component {
name: "QQuickWebEngineSingleton"
@@ -723,9 +739,10 @@ Module {
prototype: "QQuickItem"
exports: [
"QtWebEngine/WebEngineView 1.0",
- "QtWebEngine/WebEngineView 1.1"
+ "QtWebEngine/WebEngineView 1.1",
+ "QtWebEngine/WebEngineView 1.2"
]
- exportMetaObjectRevisions: [0, 1]
+ exportMetaObjectRevisions: [0, 1, 2]
Enum {
name: "NavigationRequestAction"
values: {
@@ -784,6 +801,41 @@ Module {
}
}
Enum {
+ name: "WebAction"
+ values: {
+ "NoWebAction": -1,
+ "Back": 0,
+ "Forward": 1,
+ "Stop": 2,
+ "Reload": 3,
+ "Cut": 4,
+ "Copy": 5,
+ "Paste": 6,
+ "Undo": 7,
+ "Redo": 8,
+ "SelectAll": 9,
+ "ReloadAndBypassCache": 10,
+ "PasteAndMatchStyle": 11,
+ "OpenLinkInThisWindow": 12,
+ "OpenLinkInNewWindow": 13,
+ "OpenLinkInNewTab": 14,
+ "CopyLinkToClipboard": 15,
+ "DownloadLinkToDisk": 16,
+ "CopyImageToClipboard": 17,
+ "CopyImageUrlToClipboard": 18,
+ "DownloadImageToDisk": 19,
+ "CopyMediaUrlToClipboard": 20,
+ "ToggleMediaControls": 21,
+ "ToggleMediaLoop": 22,
+ "ToggleMediaPlayPause": 23,
+ "ToggleMediaMute": 24,
+ "DownloadMediaToDisk": 25,
+ "InspectElement": 26,
+ "ExitFullScreen": 27,
+ "WebActionCount": 28
+ }
+ }
+ Enum {
name: "JavaScriptConsoleMessageLevel"
values: {
"InfoMessageLevel": 0,
@@ -792,6 +844,15 @@ Module {
}
}
Enum {
+ name: "RenderProcessTerminationStatus"
+ values: {
+ "NormalTerminationStatus": 0,
+ "AbnormalTerminationStatus": 1,
+ "CrashedTerminationStatus": 2,
+ "KilledTerminationStatus": 3
+ }
+ }
+ Enum {
name: "FindFlags"
values: {
"FindBackward": 1,
@@ -830,6 +891,8 @@ Module {
isList: true
isReadonly: true
}
+ Property { name: "activeFocusOnPress"; revision: 2; type: "bool" }
+ Property { name: "backgroundColor"; revision: 2; type: "QColor" }
Signal {
name: "loadingChanged"
Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true }
@@ -878,6 +941,18 @@ Module {
}
Signal { name: "profileChanged"; revision: 1 }
Signal { name: "webChannelChanged"; revision: 1 }
+ Signal {
+ name: "activeFocusOnPressChanged"
+ revision: 2
+ Parameter { type: "bool" }
+ }
+ Signal { name: "backgroundColorChanged"; revision: 2 }
+ Signal {
+ name: "renderProcessTerminated"
+ revision: 2
+ Parameter { name: "terminationStatus"; type: "RenderProcessTerminationStatus" }
+ Parameter { name: "exitCode"; type: "int" }
+ }
Method {
name: "runJavaScript"
Parameter { type: "string" }
@@ -932,5 +1007,15 @@ Module {
Parameter { type: "Feature" }
Parameter { name: "granted"; type: "bool" }
}
+ Method {
+ name: "setActiveFocusOnPress"
+ revision: 2
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "triggerWebAction"
+ revision: 2
+ Parameter { name: "action"; type: "WebAction" }
+ }
}
}
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 5a5c261b..4cc64c8c 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -259,6 +259,10 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
dialogComponentType = PromptDialog;
title = QCoreApplication::translate("UIDelegatesManager", "Javascript Prompt - %1").arg(m_view->url().toString());
break;
+ case WebContentsAdapterClient::UnloadDialog:
+ dialogComponentType = ConfirmDialog;
+ title = QCoreApplication::translate("UIDelegatesManager", "Are you sure you want to leave this page?");
+ break;
case WebContentsAdapterClient::InternalAuthorizationDialog:
dialogComponentType = ConfirmDialog;
title = dialogController->title();
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 61e37dec..e13b5d31 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -224,6 +224,11 @@ void QWebEnginePagePrivate::close()
Q_EMIT q->windowCloseRequested();
}
+void QWebEnginePagePrivate::windowCloseRejected()
+{
+ // Do nothing for now.
+}
+
void QWebEnginePagePrivate::didRunJavaScript(quint64 requestId, const QVariant& result)
{
m_callbacks.invoke(requestId, result);
@@ -651,6 +656,9 @@ QAction *QWebEnginePage::action(WebAction action) const
case ExitFullScreen:
text = tr("Exit Full Screen Mode");
break;
+ case RequestClose:
+ text = tr("Close Page");
+ break;
case Unselect:
text = tr("Unselect");
break;
@@ -827,6 +835,9 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
case ExitFullScreen:
d->adapter->exitFullScreen();
break;
+ case RequestClose:
+ d->adapter->requestClose();
+ break;
default:
Q_UNREACHABLE();
}
@@ -922,6 +933,9 @@ void QWebEnginePagePrivate::javascriptDialog(QSharedPointer<JavaScriptDialogCont
if (accepted)
controller->textProvided(promptResult);
break;
+ case UnloadDialog:
+ accepted = (QMessageBox::information(view, QCoreApplication::translate("QWebEnginePage", "Are you sure you want to leave this page?"), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes);
+ break;
case InternalAuthorizationDialog:
accepted = (QMessageBox::question(view, controller->title(), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes);
break;
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index a7299177..a5930b39 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -110,6 +110,7 @@ public:
InspectElement,
ExitFullScreen,
+ RequestClose,
Unselect,
WebActionCount
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index d05f76b1..0ddca387 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -95,6 +95,7 @@ public:
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 void close() Q_DECL_OVERRIDE;
+ virtual void windowCloseRejected() Q_DECL_OVERRIDE;
virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &data) Q_DECL_OVERRIDE;
virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) Q_DECL_OVERRIDE;
virtual void requestFullScreen(bool) Q_DECL_OVERRIDE;
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 32365982..b98aa3a6 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -42,7 +42,6 @@
#include "qwebenginepage.h"
#include "qwebengineprofile_p.h"
#include "qwebenginesettings.h"
-#include "qwebengineurlschemehandler_p.h"
#include "qwebenginescriptcollection_p.h"
#include "browser_context_adapter.h"
@@ -545,8 +544,8 @@ QWebEngineSettings *QWebEngineProfile::settings() const
const QWebEngineUrlSchemeHandler *QWebEngineProfile::urlSchemeHandler(const QByteArray &scheme) const
{
const Q_D(QWebEngineProfile);
- if (d->m_urlSchemeHandlers.contains(scheme))
- return d->m_urlSchemeHandlers.value(scheme);
+ if (d->browserContext()->customUrlSchemeHandlers().contains(scheme))
+ return d->browserContext()->customUrlSchemeHandlers().value(scheme);
return 0;
}
@@ -571,18 +570,17 @@ void QWebEngineProfile::installUrlSchemeHandler(QWebEngineUrlSchemeHandler *hand
Q_ASSERT(handler);
QByteArray scheme = handler->scheme();
if (checkInternalScheme(scheme)) {
- qWarning() << "Can not install a URL scheme handler overriding internal scheme: " << scheme;
+ qWarning("Can not install a URL scheme handler overriding internal scheme: %s", scheme.constData());
return;
}
- if (d->m_urlSchemeHandlers.contains(scheme)) {
- qWarning() << "URL scheme handler already installed for the scheme: " << scheme;
+ if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) {
+ qWarning("URL scheme handler already installed for the scheme: %s", scheme.constData());
return;
}
- d->m_urlSchemeHandlers.insert(scheme, handler);
- d->browserContext()->customUrlSchemeHandlers().append(handler->d_func());
+ d->browserContext()->customUrlSchemeHandlers().insert(scheme, handler);
d->browserContext()->updateCustomUrlSchemeHandlers();
- connect(handler, SIGNAL(destroyed(QObject*)), this, SLOT(destroyedUrlSchemeHandler(QObject*)));
+ connect(handler, SIGNAL(destroyed(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)));
}
/*!
@@ -596,11 +594,10 @@ void QWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handl
Q_ASSERT(handler);
if (!handler)
return;
- int count = d->m_urlSchemeHandlers.remove(handler->scheme());
+ int count = d->browserContext()->customUrlSchemeHandlers().remove(handler->scheme());
if (!count)
return;
- disconnect(handler, SIGNAL(destroyed(QObject*)), this, SLOT(destroyedUrlSchemeHandler(QObject*)));
- d->browserContext()->removeCustomUrlSchemeHandler(handler->d_func());
+ disconnect(handler, SIGNAL(destroyed(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)));
d->browserContext()->updateCustomUrlSchemeHandlers();
}
@@ -612,14 +609,13 @@ void QWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handl
void QWebEngineProfile::clearUrlSchemeHandlers()
{
Q_D(QWebEngineProfile);
- d->m_urlSchemeHandlers.clear();
d->browserContext()->customUrlSchemeHandlers().clear();
d->browserContext()->updateCustomUrlSchemeHandlers();
}
-void QWebEngineProfile::destroyedUrlSchemeHandler(QObject *obj)
+void QWebEngineProfile::destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj)
{
- removeUrlSchemeHandler(qobject_cast<QWebEngineUrlSchemeHandler*>(obj));
+ removeUrlSchemeHandler(obj);
}
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h
index 5532f12e..82946a22 100644
--- a/src/webenginewidgets/api/qwebengineprofile.h
+++ b/src/webenginewidgets/api/qwebengineprofile.h
@@ -121,7 +121,7 @@ Q_SIGNALS:
void downloadRequested(QWebEngineDownloadItem *download);
private Q_SLOTS:
- void destroyedUrlSchemeHandler(QObject *obj);
+ void destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj);
private:
Q_DISABLE_COPY(QWebEngineProfile)
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h
index 8ba64c43..7dcc7659 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/webenginewidgets/api/qwebengineprofile_p.h
@@ -50,7 +50,6 @@
#include "browser_context_adapter_client.h"
#include "qwebengineprofile.h"
-#include "qwebengineurlschemehandler_p.h"
#include "qwebenginescriptcollection.h"
#include <QMap>
#include <QPointer>
@@ -85,7 +84,6 @@ private:
QScopedPointer<QWebEngineScriptCollection> m_scriptCollection;
QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef;
QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads;
- QMap<QByteArray, QWebEngineUrlSchemeHandler *> m_urlSchemeHandlers;
};
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index ddd1e4cb..9baa8e34 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -108,6 +108,14 @@ QWebEngineViewPrivate::QWebEngineViewPrivate()
#endif // QT_NO_ACCESSIBILITY
}
+/*!
+ \fn QWebEngineView::renderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode)
+
+ This signal is emitted when the render process is terminated with a non-zero exit status.
+ \a terminationStatus is the termination status of the process and \a exitCode is the status code
+ with which the process terminated.
+*/
+
QWebEngineView::QWebEngineView(QWidget *parent)
: QWidget(parent)
, d_ptr(new QWebEngineViewPrivate)
diff --git a/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf b/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf
deleted file mode 100644
index 7b48b7a1..00000000
--- a/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf
+++ /dev/null
@@ -1,43 +0,0 @@
-include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
-
-project = QtWebEngineWidgets
-description = Qt WebEngineWidgets Reference Documentation
-version = $QT_VERSION
-
-examplesinstallpath = webenginewidgets
-
-qhp.projects = QtWebEngineWidgets
-
-qhp.QtWebEngineWidgets.file = qtwebenginewidgets.qhp
-qhp.QtWebEngineWidgets.namespace = org.qt-project.qtwebenginewidgets.$QT_VERSION_TAG
-qhp.QtWebEngineWidgets.virtualFolder = qtwebenginewidgets
-qhp.QtWebEngineWidgets.indexTitle = Qt WebEngine Widgets
-qhp.QtWebEngineWidgets.indexRoot =
-
-qhp.QtWebEngineWidgets.filterAttributes = qtwebenginewidgets $QT_VERSION qtrefdoc
-qhp.QtWebEngineWidgets.customFilters.Qt.name = QtWebEngineWidgets $QT_VERSION
-qhp.QtWebEngineWidgets.customFilters.Qt.filterAttributes = qtwebenginewidgets $QT_VERSION
-qhp.QtWebEngineWidgets.subprojects = classes examples
-qhp.QtWebEngineWidgets.subprojects.classes.title = C++ Classes
-qhp.QtWebEngineWidgets.subprojects.classes.indexTitle = Qt WebEngine Widgets C++ Classes
-qhp.QtWebEngineWidgets.subprojects.classes.selectors = class fake:headerfile
-qhp.QtWebEngineWidgets.subprojects.classes.sortPages = true
-qhp.QtWebEngineWidgets.subprojects.examples.title = Examples
-qhp.QtWebEngineWidgets.subprojects.examples.indexTitle = Qt WebEngine Widgets Examples
-qhp.QtWebEngineWidgets.subprojects.examples.selectors = fake:example
-qhp.QtWebEngineWidgets.subprojects.examples.sortPages = true
-
-tagfile = ../../../doc/qtwebenginewidgets/qtwebenginewidgets.tags
-
-depends += qtwebengine qtcore qtnetwork qtgui qtwidgets qtwebkit qtdoc qtwebchannel
-
-headerdirs += ../api
-sourcedirs += ../api src
-
-exampledirs += ../../../examples/webenginewidgets \
- snippets
-
-navigation.landingpage = "Qt WebEngine Widgets"
-navigation.cppclassespage = "Qt WebEngine Widgets C++ Classes"
-
-Cpp.ignoretokens += QWEBENGINEWIDGETS_EXPORT
diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc
index 6373389f..a9ef6ad8 100644
--- a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc
@@ -30,7 +30,12 @@
\title Qt WebEngine Widgets C++ Classes
\brief Provides a web browser engine as well as C++ classes to render and
interact with web content
+ \ingroup modules
\ingroup qtwebengine-modules
+ \qtvariable webenginewidgets
+
+ The Qt WebEngineWidgets module provides a web browser engine as well as C++ classes to render
+ and interact with web content.
To include the definitions of the module's classes, use the
following directive:
diff --git a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
index 174f59d8..927b08cb 100644
--- a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
@@ -31,8 +31,10 @@
\brief This guide gives an overview of the differences between the Qt WebKit
and Qt WebEngine APIs in applications.
- This provides rough steps to follow when porting an application using
- Qt WebKit's QWebView API to use Qt WebEngine's QWebEngineView.
+ This guide provides rough steps to follow when porting an application that uses the
+ \l{http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html}{Qt WebKit}
+ \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
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 794cb56d..b7b3bf02 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -119,6 +119,9 @@
\value InspectElement Trigger any attached Web Inspector to inspect the highlighed element.
(Added in Qt 5.6)
\value ExitFullScreen Exit the fullscreen mode. (Added in Qt 5.6)
+ \value RequestClose Request to close the web page. If defined, the \c{window.onbeforeunload}
+ handler is run, and the user can confirm or reject to close the page. If the close
+ request is confirmed, \c windowCloseRequested is emitted. (Added in Qt 5.6)
\omitvalue WebActionCount
@@ -264,11 +267,11 @@
/*!
\fn bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame)
+ \since 5.5
This function is called upon receiving a request to navigate to the specified \a url by means of
the specified navigation type \a type. \a isMainFrame indicates whether the request corresponds
to the main frame or a sub frame. If the function returns \c true, the navigation request is
- accepted and Chromium continues to load the page. Otherwise, the request is ignored. The default
- implementation accepts the navigation request.
+ accepted and \c url is loaded. The default implementation accepts all navigation requests.
*/
@@ -482,6 +485,8 @@
This signal is emitted whenever the page requests the web browser window to be closed,
for example through the JavaScript \c{window.close()} call.
+
+ \sa QWebEnginePage::RequestClose
*/
/*!
@@ -596,16 +601,27 @@
/*!
\fn void QWebEnginePage::runJavaScript(const QString& scriptSource)
- Runs the JavaScript code contained in \a scriptSource.
+ \overload runJavaScript()
+
+ This convenience function runs the JavaScript code contained in \a scriptSource.
*/
/*!
\fn void QWebEnginePage::runJavaScript(const QString& scriptSource, FunctorOrLambda resultCallback)
+
Runs the JavaScript code contained in \a scriptSource.
+ The script will run in the same \e world as other scripts that are part of the loaded site.
+
When the script has been executed, \a resultCallback is called with the result of the last executed statement.
+ \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a
+ QVariant parameter. For example:
+
+ \code
+ page.runJavaScript("document.title", [](const QVariant &v) { qDebug() << v.toString(); });
+ \endcode
- \note \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a QVariant parameter.
+ See scripts() for an alternative API to inject scripts.
*/
/*!
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 76878e07..9d03527e 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -33,57 +33,48 @@
\inmodule QtWebEngineWidgets
- QWebEngineView is the main widget component of the Qt WebEngine web browsing module.
+ A \e {web view} is the main widget component of the Qt WebEngine web browsing module.
It can be used in various applications to display web content live from the
Internet.
- A web site can be loaded onto QWebEngineView with the load() function. Like all
+ A \e {web site} can be loaded to a web view with the load() function. Like all
Qt widgets, the show() function must be invoked in order to display
- QWebEngineView. The snippet below illustrates this:
+ the web view. The snippet below illustrates this:
\snippet simple/main.cpp Using QWebEngineView
- Alternatively, setUrl() can also be used to load a web site. If you have
+ Alternatively, setUrl() can be used to load a web site. If you have
the HTML content readily available, you can use setHtml() instead.
- The loadStarted() signal is emitted when the view begins loading. The
- loadProgress() signal, on the other hand, is emitted whenever an element of
- the web view completes loading, such as an embedded image, a script, etc.
- Finally, the loadFinished() signal is emitted when the view has loaded
- completely. It's argument - either \c true or \c false - indicates
- load success or failure.
+ The loadStarted() signal is emitted when the view begins loading and the loadProgress()
+ signal is emitted whenever an element of the web view completes loading, such as an embedded
+ image or a script. The loadFinished() signal is emitted when the view has been loaded
+ completely. Its argument, either \c true or \c false, indicates whether loading was
+ successful or failed.
- The page() function returns a pointer to the web page object. See
- \l{Elements of QWebEngineView} for an explanation of how the web page
- is related to the view.
+ The page() function returns a pointer to a \e {web page} object. A QWebEngineView contains a
+ QWebEnginePage, which in turn allows access to the QWebEngineHistory in the page's context.
The title of an HTML document can be accessed with the title() property.
- Additionally, a web site may also specify an icon, which can be accessed
+ Additionally, a web site may specify an icon, which can be accessed
using the iconUrl() property. If the title or the icon changes, the corresponding
titleChanged() and iconUrlChanged() signals will be emitted. The
- textSizeMultiplier() property can be used to change the overall size of
- the text displayed in the web view.
+ zoomFactor() property can be used to change the overall size of the contents of the web view.
If you require a custom context menu, you can implement it by reimplementing
\l{QWidget::}{contextMenuEvent()} and populating your QMenu with the actions
- obtained from pageAction(). More functionality such as reloading the view,
- copying selected text to the clipboard, or pasting into the view, is also
+ obtained from pageAction(). Additional functionality, such as reloading the view,
+ copying selected text to the clipboard, or pasting into the view, is
encapsulated within the QAction objects returned by pageAction(). These
actions can be programmatically triggered using triggerPageAction().
Alternatively, the actions can be added to a toolbar or a menu directly.
- QWebEngineView maintains the state of the returned actions but allows
+ The web view maintains the state of the returned actions but allows
modification of action properties such as \l{QAction::}{text} or
\l{QAction::}{icon}.
If you want to provide support for web sites that allow the user to open
new windows, such as pop-up windows, you can subclass QWebEngineView and
reimplement the createWindow() function.
-
- \section1 Elements of QWebEngineView
-
- QWebEngineView contains a QWebEnginePage, which in turn allows access to the
- QWebEngineHistory in the page's context.
-
*/
// FIXME: reintroduce the following when we have proper names for the examples.
// \sa {WebEngine Tab Browser Example}, {WebEngine Fancy Browser Example}
@@ -91,7 +82,7 @@
/*!
\fn QWebEngineView::QWebEngineView(QWidget *parent)
- Constructs an empty QWebEngineView with parent \a parent.
+ Constructs an empty web view with the parent \a parent.
\sa load()
*/
@@ -123,29 +114,29 @@
\fn void QWebEngineView::load(const QUrl &url)
Loads the specified \a url and displays it.
- \note The view remains the same until enough data has arrived to display the new \a url.
+ \note The view remains the same until enough data has arrived to display the new URL.
\sa setUrl(), url(), urlChanged(), QUrl::fromUserInput()
*/
/*!
\fn void QWebEngineView::setHtml(const QString &html, const QUrl &baseUrl)
- Sets the content of the web view to the specified \a html.
+ Sets the content of the web view to the specified \a html content.
- External objects such as stylesheets or images referenced in the HTML
- document are located relative to \a baseUrl.
+ External objects, such as stylesheets or images referenced in the HTML
+ document, are located relative to \a baseUrl.
- The \a html is loaded immediately; external objects are loaded asynchronously.
+ The HTML document is loaded immediately, whereas external objects are loaded asynchronously.
- When using this method, Qt WebEngine assumes that external resources such as
- JavaScript programs or style sheets are encoded in UTF-8 unless otherwise
+ When using this method, Qt WebEngine assumes that external resources, such as
+ JavaScript programs or style sheets, are encoded in UTF-8 unless otherwise
specified. For example, the encoding of an external script can be specified
- through the charset attribute of the HTML script tag. Alternatively, the
- encoding can also be specified by the web server.
+ through the \c charset attribute of the HTML script tag. Alternatively, the
+ encoding can be specified by the web server.
This is a convenience function equivalent to setContent(html, "text/html", baseUrl).
- \warning This function works only for HTML, for other mime types (i.e. XHTML, SVG)
+ \warning This function works only for HTML. For other MIME types (such as XHTML or SVG),
setContent() should be used instead.
\sa load(), setContent(), QWebEnginePage::toHtml(), QWebEnginePage::setContent()
@@ -154,12 +145,12 @@
/*!
\fn void QWebEngineView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
Sets the content of the web view to the specified content \a data. If the \a mimeType argument
- is empty it is currently assumed that the content is HTML but in future versions we may introduce
- auto-detection.
+ is empty, it is currently assumed that the content is HTML but in future versions we may
+ introduce auto-detection.
External objects referenced in the content are located relative to \a baseUrl.
- The \a data is loaded immediately; external objects are loaded asynchronously.
+ The data is loaded immediately; external objects are loaded asynchronously.
\sa load(), setHtml(), QWebEnginePage::toHtml()
*/
@@ -168,7 +159,7 @@
\fn QWebEngineHistory *QWebEngineView::history() const
Returns a pointer to the view's history of navigated web pages.
- It is equivalent to
+ It is equivalent to:
\snippet qtwebengine_qwebengineview_snippet.cpp 0
*/
@@ -184,7 +175,7 @@
/*!
\property QWebEngineView::url
- \brief the url of the web page currently viewed
+ \brief the URL of the web page currently viewed
Setting this property clears the view and loads the URL.
@@ -195,7 +186,7 @@
/*!
\property QWebEngineView::iconUrl
- \brief the url of the icon associated with the web page currently viewed
+ \brief the URL of the icon associated with the web page currently viewed
\sa iconUrlChanged()
*/
@@ -204,7 +195,7 @@
\property QWebEngineView::hasSelection
\brief whether this page contains selected content or not.
- By default, this property is false.
+ By default, this property is \c false.
\sa selectionChanged()
*/
@@ -225,7 +216,7 @@
/*!
\fn void QWebEngineView::triggerPageAction(QWebEnginePage::WebAction action, bool checked)
- Triggers the specified \a action. If it is a checkable action the specified
+ Triggers the specified \a action. If it is a checkable action, the specified
\a checked state is assumed.
The following example triggers the copy action and therefore copies any
@@ -256,8 +247,8 @@
To clear the selection, just pass an empty string.
- The \a resultCallback must take a boolean parameter. It will be called with a value of true if the \a subString
- was found; otherwise the callback value will be false.
+ \a resultCallback must take a boolean parameter. It will be called with a value of \c true
+ if \a subString was found; otherwise the callback value will be \c false.
\sa selectedText(), selectionChanged()
*/
@@ -266,7 +257,7 @@
\fn void QWebEngineView::stop()
Convenience slot that stops loading the document.
- It is equivalent to
+ It is equivalent to:
\snippet qtwebengine_qwebengineview_snippet.cpp 3
@@ -278,7 +269,7 @@
Convenience slot that loads the previous document in the list of documents
built by navigating links. Does nothing if there is no previous document.
- It is equivalent to
+ It is equivalent to:
\snippet qtwebengine_qwebengineview_snippet.cpp 4
@@ -290,7 +281,7 @@
Convenience slot that loads the next document in the list of documents
built by navigating links. Does nothing if there is no next document.
- It is equivalent to
+ It is equivalent to:
\snippet qtwebengine_qwebengineview_snippet.cpp 5
@@ -306,11 +297,11 @@
/*!
\fn QWebEngineView *QWebEngineView::createWindow(QWebEnginePage::WebWindowType type)
- This function is called from the createWindow() method of the associated QWebEnginePage,
- each time the page wants to create a new window of the given \a type. This might
- be the result, for example, of a JavaScript request to open a document in a new window.
+ This function is called from the \l{QWebEnginePage::}{createWindow()} method of the associated
+ QWebEnginePage each time the page wants to create a new window of the given \a type. For
+ example, when a JavaScript request to open a document in a new window is issued.
- \note If the createWindow() method of the associated page is reimplemented, this
+ \note If the \c createWindow() method of the associated page is reimplemented, this
method is not called, unless explicitly done so in the reimplementation.
\sa QWebEnginePage::createWindow()
@@ -351,8 +342,8 @@
/*!
\fn void QWebEngineView::loadFinished(bool ok)
- This signal is emitted when a load of the page is finished.
- \a ok will indicate whether the load was successful or any error occurred.
+ This signal is emitted when a load of the page has finished.
+ \a ok will indicate whether the load was successful or an error occurred.
\sa loadStarted()
*/
@@ -382,9 +373,9 @@
/*!
\fn QWebEngineSettings *QWebEngineView::settings() const
- Returns a pointer to the view/page specific settings object.
+ Returns a pointer to the view or page specific settings object.
- It is equivalent to
+ It is equivalent to:
\snippet qtwebengine_qwebengineview_snippet.cpp 6
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index c3218556..17a0a3db 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -6,8 +6,6 @@ DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB
QT += webengine webenginecore widgets network quick
QT_PRIVATE += quick-private gui-private core-private
-QMAKE_DOCS = $$PWD/doc/qtwebenginewidgets.qdocconf
-
INCLUDEPATH += $$PWD api ../core ../core/api ../webengine/api
SOURCES = \
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/resources/firstparty.html b/tests/auto/core/qwebengineurlrequestinterceptor/resources/firstparty.html
new file mode 100644
index 00000000..8bc540c0
--- /dev/null
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/resources/firstparty.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+<iframe src="qrc:///resources/content.html"></iframe>
+</body>
+</html>
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
index a2f9e0c3..4891cafd 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
@@ -66,6 +66,7 @@ private Q_SLOTS:
void ipv6HostEncoding();
void requestedUrl();
void setUrlSameUrl();
+ void firstPartyUrl();
};
tst_QWebEngineUrlRequestInterceptor::tst_QWebEngineUrlRequestInterceptor()
@@ -96,6 +97,7 @@ class TestRequestInterceptor : public QWebEngineUrlRequestInterceptor
{
public:
QList<QUrl> observedUrls;
+ QList<QUrl> firstPartyUrls;
bool shouldIntercept;
bool interceptRequest(QWebEngineUrlRequestInfo &info) override
@@ -105,6 +107,7 @@ public:
info.redirect(QUrl("qrc:///resources/content.html"));
observedUrls.append(info.requestUrl());
+ firstPartyUrls.append(info.firstPartyUrl());
return shouldIntercept;
}
TestRequestInterceptor(bool intercept)
@@ -253,5 +256,22 @@ void tst_QWebEngineUrlRequestInterceptor::setUrlSameUrl()
QCOMPARE(spy.count(), 4);
}
+void tst_QWebEngineUrlRequestInterceptor::firstPartyUrl()
+{
+ QWebEnginePage page;
+ TestRequestInterceptor interceptor(/* intercept */ false);
+ page.profile()->setRequestInterceptor(&interceptor);
+
+ QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
+
+ page.setUrl(QUrl("qrc:///resources/firstparty.html"));
+ waitForSignal(&page, SIGNAL(loadFinished(bool)));
+ QCOMPARE(interceptor.observedUrls.at(0), QUrl("qrc:///resources/firstparty.html"));
+ QCOMPARE(interceptor.observedUrls.at(1), QUrl("qrc:///resources/content.html"));
+ QCOMPARE(interceptor.firstPartyUrls.at(0), QUrl("qrc:///resources/firstparty.html"));
+ QCOMPARE(interceptor.firstPartyUrls.at(1), QUrl("qrc:///resources/firstparty.html"));
+ QCOMPARE(spy.count(), 1);
+}
+
QTEST_MAIN(tst_QWebEngineUrlRequestInterceptor)
#include "tst_qwebengineurlrequestinterceptor.moc"
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc
index afeae268..ca045e7f 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc
@@ -2,5 +2,6 @@
<qresource>
<file>resources/index.html</file>
<file>resources/content.html</file>
+ <file>resources/firstparty.html</file>
</qresource>
</RCC>
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 8f0c2f6e..bf0192e4 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -56,6 +56,7 @@
#include <private/qquickwebengineprofile_p.h>
#include <private/qquickwebenginescript_p.h>
#include <private/qquickwebenginesettings_p.h>
+#include <private/qquickwebenginesingleton_p.h>
class tst_publicapi : public QObject {
Q_OBJECT
@@ -76,6 +77,7 @@ static QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *>()
<< &QQuickWebEngineScript::staticMetaObject
<< &QQuickWebEngineSettings::staticMetaObject
<< &QQuickWebEngineFullScreenRequest::staticMetaObject
+ << &QQuickWebEngineSingleton::staticMetaObject
;
static QList<const char *> knownEnumNames = QList<const char *>();
@@ -87,28 +89,22 @@ static QStringList hardcodedTypes = QStringList()
// Ignore the testSupport types without making a fuss.
<< "QQuickWebEngineTestSupport*"
<< "QQuickWebEngineErrorPage*"
+ << "QWebEngineCookieStoreClient*"
;
static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.AcceptRequest --> NavigationRequestAction"
<< "QQuickWebEngineView.IgnoreRequest --> NavigationRequestAction"
+ << "QQuickWebEngineView.LinkClickedNavigation --> NavigationType"
+ << "QQuickWebEngineView.TypedNavigation --> NavigationType"
+ << "QQuickWebEngineView.FormSubmittedNavigation --> NavigationType"
+ << "QQuickWebEngineView.BackForwardNavigation --> NavigationType"
+ << "QQuickWebEngineView.ReloadNavigation --> NavigationType"
+ << "QQuickWebEngineView.OtherNavigation --> NavigationType"
<< "QQuickWebEngineView.LoadStartedStatus --> LoadStatus"
<< "QQuickWebEngineView.LoadStoppedStatus --> LoadStatus"
<< "QQuickWebEngineView.LoadSucceededStatus --> LoadStatus"
<< "QQuickWebEngineView.LoadFailedStatus --> LoadStatus"
- << "QQuickWebEngineCertificateError.SslPinnedKeyNotInCertificateChain --> Error"
- << "QQuickWebEngineCertificateError.CertificateCommonNameInvalid --> Error"
- << "QQuickWebEngineCertificateError.CertificateDateInvalid --> Error"
- << "QQuickWebEngineCertificateError.CertificateAuthorityInvalid --> Error"
- << "QQuickWebEngineCertificateError.CertificateContainsErrors --> Error"
- << "QQuickWebEngineCertificateError.CertificateNoRevocationMechanism --> Error"
- << "QQuickWebEngineCertificateError.CertificateUnableToCheckRevocation --> Error"
- << "QQuickWebEngineCertificateError.CertificateRevoked --> Error"
- << "QQuickWebEngineCertificateError.CertificateInvalid --> Error"
- << "QQuickWebEngineCertificateError.CertificateWeakSignatureAlgorithm --> Error"
- << "QQuickWebEngineCertificateError.CertificateNonUniqueName --> Error"
- << "QQuickWebEngineCertificateError.CertificateWeakKey --> Error"
- << "QQuickWebEngineCertificateError.CertificateNameConstraintViolation --> Error"
<< "QQuickWebEngineView.NoErrorDomain --> ErrorDomain"
<< "QQuickWebEngineView.InternalErrorDomain --> ErrorDomain"
<< "QQuickWebEngineView.ConnectionErrorDomain --> ErrorDomain"
@@ -116,14 +112,6 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.HttpErrorDomain --> ErrorDomain"
<< "QQuickWebEngineView.FtpErrorDomain --> ErrorDomain"
<< "QQuickWebEngineView.DnsErrorDomain --> ErrorDomain"
- << "QQuickWebEngineView.FindBackward --> FindFlags"
- << "QQuickWebEngineView.FindCaseSensitively --> FindFlags"
- << "QQuickWebEngineView.LinkClickedNavigation --> NavigationType"
- << "QQuickWebEngineView.TypedNavigation --> NavigationType"
- << "QQuickWebEngineView.FormSubmittedNavigation --> NavigationType"
- << "QQuickWebEngineView.BackForwardNavigation --> NavigationType"
- << "QQuickWebEngineView.ReloadNavigation --> NavigationType"
- << "QQuickWebEngineView.OtherNavigation --> NavigationType"
<< "QQuickWebEngineView.NewViewInWindow --> NewViewDestination"
<< "QQuickWebEngineView.NewViewInTab --> NewViewDestination"
<< "QQuickWebEngineView.NewViewInDialog --> NewViewDestination"
@@ -132,31 +120,81 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.MediaVideoCapture --> Feature"
<< "QQuickWebEngineView.MediaAudioVideoCapture --> Feature"
<< "QQuickWebEngineView.Geolocation --> Feature"
+ << "QQuickWebEngineView.NoWebAction --> WebAction"
+ << "QQuickWebEngineView.Back --> WebAction"
+ << "QQuickWebEngineView.Forward --> WebAction"
+ << "QQuickWebEngineView.Stop --> WebAction"
+ << "QQuickWebEngineView.Reload --> WebAction"
+ << "QQuickWebEngineView.Cut --> WebAction"
+ << "QQuickWebEngineView.Copy --> WebAction"
+ << "QQuickWebEngineView.Paste --> WebAction"
+ << "QQuickWebEngineView.Undo --> WebAction"
+ << "QQuickWebEngineView.Redo --> WebAction"
+ << "QQuickWebEngineView.SelectAll --> WebAction"
+ << "QQuickWebEngineView.ReloadAndBypassCache --> WebAction"
+ << "QQuickWebEngineView.PasteAndMatchStyle --> WebAction"
+ << "QQuickWebEngineView.OpenLinkInThisWindow --> WebAction"
+ << "QQuickWebEngineView.OpenLinkInNewWindow --> WebAction"
+ << "QQuickWebEngineView.OpenLinkInNewTab --> WebAction"
+ << "QQuickWebEngineView.CopyLinkToClipboard --> WebAction"
+ << "QQuickWebEngineView.DownloadLinkToDisk --> WebAction"
+ << "QQuickWebEngineView.CopyImageToClipboard --> WebAction"
+ << "QQuickWebEngineView.CopyImageUrlToClipboard --> WebAction"
+ << "QQuickWebEngineView.DownloadImageToDisk --> WebAction"
+ << "QQuickWebEngineView.CopyMediaUrlToClipboard --> WebAction"
+ << "QQuickWebEngineView.ToggleMediaControls --> WebAction"
+ << "QQuickWebEngineView.ToggleMediaLoop --> WebAction"
+ << "QQuickWebEngineView.ToggleMediaPlayPause --> WebAction"
+ << "QQuickWebEngineView.ToggleMediaMute --> WebAction"
+ << "QQuickWebEngineView.DownloadMediaToDisk --> WebAction"
+ << "QQuickWebEngineView.InspectElement --> WebAction"
+ << "QQuickWebEngineView.ExitFullScreen --> WebAction"
+ << "QQuickWebEngineView.WebActionCount --> WebAction"
<< "QQuickWebEngineView.InfoMessageLevel --> JavaScriptConsoleMessageLevel"
<< "QQuickWebEngineView.WarningMessageLevel --> JavaScriptConsoleMessageLevel"
<< "QQuickWebEngineView.ErrorMessageLevel --> JavaScriptConsoleMessageLevel"
- << "QQuickWebEngineView.title --> QString"
+ << "QQuickWebEngineView.NormalTerminationStatus --> RenderProcessTerminationStatus"
+ << "QQuickWebEngineView.AbnormalTerminationStatus --> RenderProcessTerminationStatus"
+ << "QQuickWebEngineView.CrashedTerminationStatus --> RenderProcessTerminationStatus"
+ << "QQuickWebEngineView.KilledTerminationStatus --> RenderProcessTerminationStatus"
+ << "QQuickWebEngineView.FindBackward --> FindFlags"
+ << "QQuickWebEngineView.FindCaseSensitively --> FindFlags"
<< "QQuickWebEngineView.url --> QUrl"
<< "QQuickWebEngineView.icon --> QUrl"
+ << "QQuickWebEngineView.loading --> bool"
+ << "QQuickWebEngineView.loadProgress --> int"
+ << "QQuickWebEngineView.title --> QString"
<< "QQuickWebEngineView.canGoBack --> bool"
<< "QQuickWebEngineView.canGoForward --> bool"
<< "QQuickWebEngineView.isFullScreen --> bool"
- << "QQuickWebEngineView.loading --> bool"
- << "QQuickWebEngineView.loadProgress --> int"
+ << "QQuickWebEngineView.zoomFactor --> double"
+ << "QQuickWebEngineView.profile --> QQuickWebEngineProfile*"
+ << "QQuickWebEngineView.settings --> QQuickWebEngineSettings*"
+ << "QQuickWebEngineView.navigationHistory --> QQuickWebEngineHistory*"
+ << "QQuickWebEngineView.webChannel --> QQmlWebChannel*"
+ << "QQuickWebEngineView.userScripts --> QQmlListProperty<QQuickWebEngineScript>"
+ << "QQuickWebEngineView.activeFocusOnPress --> bool"
+ << "QQuickWebEngineView.backgroundColor --> QColor"
+ << "QQuickWebEngineView.testSupport --> QQuickWebEngineTestSupport*"
<< "QQuickWebEngineView.titleChanged() --> void"
- << "QQuickWebEngineView.loadingChanged(QQuickWebEngineLoadRequest*) --> void"
- << "QQuickWebEngineView.certificateError(QQuickWebEngineCertificateError*) --> void"
- << "QQuickWebEngineView.loadProgressChanged() --> void"
- << "QQuickWebEngineView.javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString) --> void"
<< "QQuickWebEngineView.urlChanged() --> void"
<< "QQuickWebEngineView.iconChanged() --> void"
+ << "QQuickWebEngineView.loadingChanged(QQuickWebEngineLoadRequest*) --> void"
+ << "QQuickWebEngineView.loadProgressChanged() --> void"
<< "QQuickWebEngineView.linkHovered(QUrl) --> void"
<< "QQuickWebEngineView.navigationRequested(QQuickWebEngineNavigationRequest*) --> void"
+ << "QQuickWebEngineView.javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString) --> void"
+ << "QQuickWebEngineView.certificateError(QQuickWebEngineCertificateError*) --> void"
<< "QQuickWebEngineView.fullScreenRequested(QQuickWebEngineFullScreenRequest) --> void"
<< "QQuickWebEngineView.isFullScreenChanged() --> void"
- << "QQuickWebEngineView.fullScreenCancelled() --> void"
<< "QQuickWebEngineView.featurePermissionRequested(QUrl,Feature) --> void"
- << "QQuickWebEngineView.grantFeaturePermission(QUrl,Feature,bool) --> void"
+ << "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void"
+ << "QQuickWebEngineView.zoomFactorChanged(double) --> void"
+ << "QQuickWebEngineView.profileChanged() --> void"
+ << "QQuickWebEngineView.webChannelChanged() --> void"
+ << "QQuickWebEngineView.activeFocusOnPressChanged(bool) --> void"
+ << "QQuickWebEngineView.backgroundColorChanged() --> void"
+ << "QQuickWebEngineView.renderProcessTerminated(RenderProcessTerminationStatus,int) --> void"
<< "QQuickWebEngineView.runJavaScript(QString,QJSValue) --> void"
<< "QQuickWebEngineView.runJavaScript(QString) --> void"
<< "QQuickWebEngineView.loadHtml(QString,QUrl) --> void"
@@ -164,37 +202,50 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.goBack() --> void"
<< "QQuickWebEngineView.goForward() --> void"
<< "QQuickWebEngineView.goBackOrForward(int) --> void"
- << "QQuickWebEngineView.stop() --> void"
<< "QQuickWebEngineView.reload() --> void"
- << "QQuickWebEngineView.zoomFactor --> double"
- << "QQuickWebEngineView.zoomFactorChanged(double) --> void"
- << "QQuickWebEngineView.profile --> QQuickWebEngineProfile*"
- << "QQuickWebEngineView.profileChanged() --> void"
- << "QQuickWebEngineView.navigationHistory --> QQuickWebEngineHistory*"
- << "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void"
- << "QQuickWebEngineView.userScripts --> QQmlListProperty<QQuickWebEngineScript>"
- << "QQuickWebEngineView.settings --> QQuickWebEngineSettings*"
- << "QQuickWebEngineView.testSupport --> QQuickWebEngineTestSupport*"
- << "QQuickWebEngineView.webChannel --> QQmlWebChannel*"
- << "QQuickWebEngineView.webChannelChanged() --> void"
<< "QQuickWebEngineView.reloadAndBypassCache() --> void"
+ << "QQuickWebEngineView.stop() --> void"
<< "QQuickWebEngineView.findText(QString,FindFlags,QJSValue) --> void"
<< "QQuickWebEngineView.findText(QString,FindFlags) --> void"
<< "QQuickWebEngineView.findText(QString) --> void"
- << "QQuickWebEngineDownloadItem.id --> uint"
- << "QQuickWebEngineDownloadItem.state --> DownloadState"
- << "QQuickWebEngineDownloadItem.path --> QString"
- << "QQuickWebEngineDownloadItem.totalBytes --> qlonglong"
- << "QQuickWebEngineDownloadItem.receivedBytes --> qlonglong"
+ << "QQuickWebEngineView.fullScreenCancelled() --> void"
+ << "QQuickWebEngineView.grantFeaturePermission(QUrl,Feature,bool) --> void"
+ << "QQuickWebEngineView.setActiveFocusOnPress(bool) --> void"
+ << "QQuickWebEngineView.triggerWebAction(WebAction) --> void"
+ << "QQuickWebEngineCertificateError.SslPinnedKeyNotInCertificateChain --> Error"
+ << "QQuickWebEngineCertificateError.CertificateCommonNameInvalid --> Error"
+ << "QQuickWebEngineCertificateError.CertificateDateInvalid --> Error"
+ << "QQuickWebEngineCertificateError.CertificateAuthorityInvalid --> Error"
+ << "QQuickWebEngineCertificateError.CertificateContainsErrors --> Error"
+ << "QQuickWebEngineCertificateError.CertificateNoRevocationMechanism --> Error"
+ << "QQuickWebEngineCertificateError.CertificateUnableToCheckRevocation --> Error"
+ << "QQuickWebEngineCertificateError.CertificateRevoked --> Error"
+ << "QQuickWebEngineCertificateError.CertificateInvalid --> Error"
+ << "QQuickWebEngineCertificateError.CertificateWeakSignatureAlgorithm --> Error"
+ << "QQuickWebEngineCertificateError.CertificateNonUniqueName --> Error"
+ << "QQuickWebEngineCertificateError.CertificateWeakKey --> Error"
+ << "QQuickWebEngineCertificateError.CertificateNameConstraintViolation --> Error"
+ << "QQuickWebEngineCertificateError.url --> QUrl"
+ << "QQuickWebEngineCertificateError.error --> Error"
+ << "QQuickWebEngineCertificateError.description --> QString"
+ << "QQuickWebEngineCertificateError.overridable --> bool"
+ << "QQuickWebEngineCertificateError.defer() --> void"
+ << "QQuickWebEngineCertificateError.ignoreCertificateError() --> void"
+ << "QQuickWebEngineCertificateError.rejectCertificate() --> void"
<< "QQuickWebEngineDownloadItem.DownloadRequested --> DownloadState"
<< "QQuickWebEngineDownloadItem.DownloadInProgress --> DownloadState"
<< "QQuickWebEngineDownloadItem.DownloadCompleted --> DownloadState"
<< "QQuickWebEngineDownloadItem.DownloadCancelled --> DownloadState"
<< "QQuickWebEngineDownloadItem.DownloadInterrupted --> DownloadState"
+ << "QQuickWebEngineDownloadItem.id --> uint"
+ << "QQuickWebEngineDownloadItem.state --> DownloadState"
+ << "QQuickWebEngineDownloadItem.totalBytes --> qlonglong"
+ << "QQuickWebEngineDownloadItem.receivedBytes --> qlonglong"
+ << "QQuickWebEngineDownloadItem.path --> QString"
<< "QQuickWebEngineDownloadItem.stateChanged() --> void"
- << "QQuickWebEngineDownloadItem.pathChanged() --> void"
<< "QQuickWebEngineDownloadItem.receivedBytesChanged() --> void"
<< "QQuickWebEngineDownloadItem.totalBytesChanged() --> void"
+ << "QQuickWebEngineDownloadItem.pathChanged() --> void"
<< "QQuickWebEngineDownloadItem.accept() --> void"
<< "QQuickWebEngineDownloadItem.cancel() --> void"
<< "QQuickWebEngineHistory.items --> QQuickWebEngineHistoryListModel*"
@@ -224,6 +275,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.cachePath --> QString"
<< "QQuickWebEngineProfile.httpUserAgent --> QString"
<< "QQuickWebEngineProfile.httpCacheType --> HttpCacheType"
+ << "QQuickWebEngineProfile.httpAcceptLanguage --> QString"
<< "QQuickWebEngineProfile.persistentCookiesPolicy --> PersistentCookiesPolicy"
<< "QQuickWebEngineProfile.httpCacheMaximumSize --> int"
<< "QQuickWebEngineProfile.storageNameChanged() --> void"
@@ -234,39 +286,10 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.httpCacheTypeChanged() --> void"
<< "QQuickWebEngineProfile.persistentCookiesPolicyChanged() --> void"
<< "QQuickWebEngineProfile.httpCacheMaximumSizeChanged() --> void"
+ << "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void"
<< "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void"
<< "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void"
- << "QQuickWebEngineSettings.autoLoadImages --> bool"
- << "QQuickWebEngineSettings.javascriptEnabled --> bool"
- << "QQuickWebEngineSettings.javascriptCanOpenWindows --> bool"
- << "QQuickWebEngineSettings.javascriptCanAccessClipboard --> bool"
- << "QQuickWebEngineSettings.linksIncludedInFocusChain --> bool"
- << "QQuickWebEngineSettings.localStorageEnabled --> bool"
- << "QQuickWebEngineSettings.localContentCanAccessRemoteUrls --> bool"
- << "QQuickWebEngineSettings.spatialNavigationEnabled --> bool"
- << "QQuickWebEngineSettings.localContentCanAccessFileUrls --> bool"
- << "QQuickWebEngineSettings.hyperlinkAuditingEnabled --> bool"
- << "QQuickWebEngineSettings.errorPageEnabled --> bool"
- << "QQuickWebEngineSettings.defaultTextEncoding --> QString"
- << "QQuickWebEngineSettings.autoLoadImagesChanged() --> void"
- << "QQuickWebEngineSettings.javascriptEnabledChanged() --> void"
- << "QQuickWebEngineSettings.javascriptCanOpenWindowsChanged() --> void"
- << "QQuickWebEngineSettings.javascriptCanAccessClipboardChanged() --> void"
- << "QQuickWebEngineSettings.linksIncludedInFocusChainChanged() --> void"
- << "QQuickWebEngineSettings.localStorageEnabledChanged() --> void"
- << "QQuickWebEngineSettings.localContentCanAccessRemoteUrlsChanged() --> void"
- << "QQuickWebEngineSettings.spatialNavigationEnabledChanged() --> void"
- << "QQuickWebEngineSettings.localContentCanAccessFileUrlsChanged() --> void"
- << "QQuickWebEngineSettings.hyperlinkAuditingEnabledChanged() --> void"
- << "QQuickWebEngineSettings.errorPageEnabledChanged() --> void"
- << "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void"
- << "QQuickWebEngineCertificateError.ignoreCertificateError() --> void"
- << "QQuickWebEngineCertificateError.rejectCertificate() --> void"
- << "QQuickWebEngineCertificateError.defer() --> void"
- << "QQuickWebEngineCertificateError.url --> QUrl"
- << "QQuickWebEngineCertificateError.error --> Error"
- << "QQuickWebEngineCertificateError.description --> QString"
- << "QQuickWebEngineCertificateError.overridable --> bool"
+ << "QQuickWebEngineProfile.setCookieStoreClient(QWebEngineCookieStoreClient*) --> void"
<< "QQuickWebEngineScript.Deferred --> InjectionPoint"
<< "QQuickWebEngineScript.DocumentReady --> InjectionPoint"
<< "QQuickWebEngineScript.DocumentCreation --> InjectionPoint"
@@ -292,8 +315,38 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineScript.setWorldId(ScriptWorldId) --> void"
<< "QQuickWebEngineScript.setRunOnSubframes(bool) --> void"
<< "QQuickWebEngineScript.toString() --> QString"
+ << "QQuickWebEngineSettings.autoLoadImages --> bool"
+ << "QQuickWebEngineSettings.javascriptEnabled --> bool"
+ << "QQuickWebEngineSettings.javascriptCanOpenWindows --> bool"
+ << "QQuickWebEngineSettings.javascriptCanAccessClipboard --> bool"
+ << "QQuickWebEngineSettings.linksIncludedInFocusChain --> bool"
+ << "QQuickWebEngineSettings.localStorageEnabled --> bool"
+ << "QQuickWebEngineSettings.localContentCanAccessRemoteUrls --> bool"
+ << "QQuickWebEngineSettings.spatialNavigationEnabled --> bool"
+ << "QQuickWebEngineSettings.localContentCanAccessFileUrls --> bool"
+ << "QQuickWebEngineSettings.hyperlinkAuditingEnabled --> bool"
+ << "QQuickWebEngineSettings.errorPageEnabled --> bool"
+ << "QQuickWebEngineSettings.pluginsEnabled --> bool"
+ << "QQuickWebEngineSettings.fullScreenSupportEnabled --> bool"
+ << "QQuickWebEngineSettings.defaultTextEncoding --> QString"
+ << "QQuickWebEngineSettings.autoLoadImagesChanged() --> void"
+ << "QQuickWebEngineSettings.javascriptEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.javascriptCanOpenWindowsChanged() --> void"
+ << "QQuickWebEngineSettings.javascriptCanAccessClipboardChanged() --> void"
+ << "QQuickWebEngineSettings.linksIncludedInFocusChainChanged() --> void"
+ << "QQuickWebEngineSettings.localStorageEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.localContentCanAccessRemoteUrlsChanged() --> void"
+ << "QQuickWebEngineSettings.spatialNavigationEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.localContentCanAccessFileUrlsChanged() --> void"
+ << "QQuickWebEngineSettings.hyperlinkAuditingEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.errorPageEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.pluginsEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.fullScreenSupportEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void"
<< "QQuickWebEngineFullScreenRequest.toggleOn --> bool"
<< "QQuickWebEngineFullScreenRequest.accept() --> void"
+ << "QQuickWebEngineSingleton.settings --> QQuickWebEngineSettings*"
+ << "QQuickWebEngineSingleton.defaultProfile --> QQuickWebEngineProfile*"
;
static bool isCheckedEnum(const QByteArray &typeName)
diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml
index 8a01dfa0..e2c5c900 100644
--- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml
+++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml
@@ -47,6 +47,7 @@ import QtWebEngine.experimental 1.0
WebEngineView {
property var loadStatus: null
property var viewportReady: false
+ property bool windowCloseRequestedSignalEmitted: false
function waitForLoadSucceeded() {
var success = _waitFor(function() { return loadStatus == WebEngineView.LoadSucceededStatus })
@@ -69,6 +70,9 @@ WebEngineView {
loadStatus = null
return stop
}
+ function waitForWindowCloseRequested() {
+ return _waitFor(function() { return windowCloseRequestedSignalEmitted; });
+ }
function _waitFor(predicate) {
var timeout = 5000
var i = 0
@@ -87,5 +91,8 @@ WebEngineView {
viewportReady = false
}
+ onWindowCloseRequested: {
+ windowCloseRequestedSignalEmitted = true;
+ }
}
diff --git a/tests/auto/quick/qmltests/data/confirmclose.html b/tests/auto/quick/qmltests/data/confirmclose.html
new file mode 100644
index 00000000..ba11da7a
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/confirmclose.html
@@ -0,0 +1,5 @@
+<html>
+<body onbeforeunload="return 'You are about to miss out on some awesome content.';">
+ Be greeted, precious viewer!
+</body>
+</html>
diff --git a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml
index 75b45bfa..4294c5ba 100644
--- a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml
+++ b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml
@@ -42,11 +42,26 @@
import QtQuick 2.0
import QtTest 1.0
import QtWebEngine 1.2
+import QtWebEngine.testsupport 1.0
import "../mock-delegates/TestParams" 1.0
TestWebEngineView {
id: webEngineView
+ testSupport: WebEngineTestSupport {
+ property bool windowCloseRejectedSignalEmitted: false
+
+ function waitForWindowCloseRejected() {
+ return _waitFor(function () {
+ return testSupport.windowCloseRejectedSignalEmitted;
+ });
+ }
+
+ onWindowCloseRejected: {
+ windowCloseRejectedSignalEmitted = true;
+ }
+ }
+
TestCase {
id: test
name: "WebEngineViewJavaScriptDialogs"
@@ -80,6 +95,24 @@ TestWebEngineView {
}
+ function test_confirmClose() {
+ webEngineView.url = Qt.resolvedUrl("confirmclose.html");
+ verify(webEngineView.waitForLoadSucceeded());
+ webEngineView.windowCloseRequestedSignalEmitted = false;
+ JSDialogParams.shouldAcceptDialog = true;
+ webEngineView.triggerWebAction(WebEngineView.RequestClose);
+ verify(webEngineView.waitForWindowCloseRequested());
+ }
+
+ function test_rejectClose() {
+ webEngineView.url = Qt.resolvedUrl("confirmclose.html");
+ verify(webEngineView.waitForLoadSucceeded());
+ webEngineView.testSupport.windowCloseRejectedSignalEmitted = false;
+ JSDialogParams.shouldAcceptDialog = false;
+ webEngineView.triggerWebAction(WebEngineView.RequestClose);
+ verify(webEngineView.testSupport.waitForWindowCloseRejected());
+ }
+
function test_prompt() {
JSDialogParams.inputForPrompt = "tQ olleH"
webEngineView.url = Qt.resolvedUrl("prompt.html")
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index 01517af4..57649384 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -12,6 +12,7 @@ OTHER_FILES += \
$$PWD/data/change-document-title.js \
$$PWD/data/download.zip \
$$PWD/data/confirm.html \
+ $$PWD/data/confirmclose.html \
$$PWD/data/directoryupload.html \
$$PWD/data/favicon.html \
$$PWD/data/favicon.png \
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 6e397676..9559f3cf 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -40,6 +40,7 @@
#include <qpa/qplatforminputcontext.h>
#include <qwebenginehistory.h>
#include <qwebenginepage.h>
+#include <qwebengineprofile.h>
#include <qwebenginesettings.h>
#include <qwebengineview.h>
#include <qimagewriter.h>
@@ -2810,28 +2811,16 @@ void tst_QWebEnginePage::userAgentApplicationName()
#endif
}
-class CustomUserAgentWebPage : public QWebEnginePage
-{
-public:
- static const QLatin1String filteredUserAgent;
-protected:
- virtual QString userAgentForUrl(const QUrl& url) const
- {
- Q_UNUSED(url);
- return QString("My User Agent\nX-New-Http-Header: Oh Noes!");
- }
-};
-const QLatin1String CustomUserAgentWebPage::filteredUserAgent("My User AgentX-New-Http-Header: Oh Noes!");
-
void tst_QWebEnginePage::userAgentNewlineStripping()
{
-#if !defined(QWEBENGINEPAGE_USERAGENTFORURL)
- QSKIP("QWEBENGINEPAGE_USERAGENTFORURL");
-#else
- CustomUserAgentWebPage page;
- page.setHtml("<html><body></body></html>");
- QCOMPARE(evaluateJavaScriptSync(&page, "navigator.userAgent").toString(), CustomUserAgentWebPage::filteredUserAgent);
-#endif
+ QWebEngineProfile profile;
+ QWebEnginePage page(&profile);
+
+ profile.setHttpUserAgent(QStringLiteral("My User Agent\nX-New-Http-Header: Oh Noes!"));
+ // The user agent will be updated after a page load.
+ page.load(QUrl("about:blank"));
+
+ QCOMPARE(evaluateJavaScriptSync(&page, "navigator.userAgent").toString(), QStringLiteral("My User Agent X-New-Http-Header: Oh Noes!"));
}
void tst_QWebEnginePage::crashTests_LazyInitializationOfMainFrame()
diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf
index 321e67e9..758cd9fd 100644
--- a/tools/qmake/mkspecs/features/configure.prf
+++ b/tools/qmake/mkspecs/features/configure.prf
@@ -25,38 +25,47 @@ defineTest(runConfigure) {
!config_libcap:skipBuild("libcap development package appears to be missing")
!config_khr:skipBuild("khronos development headers appear to be missing (mesa/libegl1-mesa-dev)")
- REQUIRED_PACKAGES = dbus-1 fontconfig
+ REQUIRED_PACKAGES = dbus-1 fontconfig freetype2
contains(QT_CONFIG, xcb): REQUIRED_PACKAGES += libdrm xcomposite xcursor xi xrandr xscrnsaver xtst
contains(QT_CONFIG, pulseaudio): REQUIRED_PACKAGES += libpulse
contains(QT_CONFIG, system-png): REQUIRED_PACKAGES += libpng
- contains(QT_CONFIG, system-jpeg): REQUIRED_PACKAGES += libjpeg
- contains(QT_CONFIG, system-harfbuzz): REQUIRED_PACKAGES += harfbuzz
- !cross_compile: REQUIRED_PACKAGES += libpci nss
+ contains(QT_CONFIG, system-harfbuzz)|packagesExist("\'freetype2 >= 2.5.3\'"): {
+ WEBENGINE_CONFIG += use_system_harfbuzz
+ REQUIRED_PACKAGES += harfbuzz
+ }
+ !cross_compile: REQUIRED_PACKAGES += libpci
for(package, $$list($$REQUIRED_PACKAGES)) {
!packagesExist($$package):skipBuild("Unmet dependency: $$package")
}
- packagesExist(minizip, zlib): WEBENGINE_CONFIG += config_system_minizip
+ packagesExist(minizip, zlib): WEBENGINE_CONFIG += use_system_minizip
else: log("System zlib or minizip not found. Using Chromium's copies.$${EOL}")
- packagesExist(libwebp,libwebpdemux): WEBENGINE_CONFIG += config_system_libwebp
+ packagesExist(libwebp,libwebpdemux): WEBENGINE_CONFIG += use_system_libwebp
else: log("System libwebp or libwebpdemux not found. Using Chromium's copies.$${EOL}")
- packagesExist(libxml-2.0,libxslt): WEBENGINE_CONFIG += config_system_libxslt
+ packagesExist(libxml-2.0,libxslt): WEBENGINE_CONFIG += use_system_libxslt
else: log("System libxml2 or libxslt not found. Using Chromium's copies.$${EOL}")
for(package, $$list("libevent flac jsoncpp opus speex")) {
- packagesExist($$package): WEBENGINE_CONFIG += config_system_$$package
+ packagesExist($$package): WEBENGINE_CONFIG += use_system_$$package
else: log("System $$package not found. Using Chromium's copy.$${EOL}")
}
- packagesExist("\'vpx >= 1.4\'"): WEBENGINE_CONFIG += config_system_vpx
+ packagesExist("\'vpx >= 1.4\'"): WEBENGINE_CONFIG += use_system_vpx
else: log("System vpx >= 1.4 not found. Using Chromium's copy.$${EOL}")
- config_srtp: WEBENGINE_CONFIG += config_system_libsrtp
+ config_srtp: WEBENGINE_CONFIG += use_system_libsrtp
else: log("System libsrtp not found. Using Chromium's copy.$${EOL}")
- config_snappy: WEBENGINE_CONFIG += config_system_snappy
+ config_snappy: WEBENGINE_CONFIG += use_system_snappy
else: log("System snappy not found. Using Chromium's copy.$${EOL}")
+
+ # Optional dependencies
+ packagesExist(nss): WEBENGINE_CONFIG += use_nss
+ else: log("System NSS not found, BoringSSL will be used.$${EOL}")
}
isEmpty(skipBuildReason): {
cache(CONFIG, add, $$list(webengine_successfully_configured))
- !isEmpty(WEBENGINE_CONFIG): cache(CONFIG, add, $$list($$WEBENGINE_CONFIG))
+ !isEmpty(WEBENGINE_CONFIG) {
+ cache(WEBENGINE_CONFIG, add, $$list($$WEBENGINE_CONFIG))
+ export(WEBENGINE_CONFIG)
+ }
}
}
@@ -64,7 +73,12 @@ defineTest(runConfigure) {
# command line options
defineTest(finalizeConfigure) {
linux {
- contains(WEBENGINE_CONFIG, use_system_icu) {
+ use?(nss) {
+ log("SSL............................... Using system NSS$${EOL}")
+ } else {
+ log("SSL............................... Using bundled BoringSSL$${EOL}")
+ }
+ use?(system_icu) {
packagesExist("icu-uc icu-i18n") {
log("ICU............................... Using system version$${EOL}")
} else {
@@ -74,7 +88,7 @@ defineTest(finalizeConfigure) {
} else {
log("ICU............................... Using internal copy (Default, force system ICU with WEBENGINE_CONFIG += use_system_icu)$${EOL}")
}
- contains(WEBENGINE_CONFIG, use_system_ffmpeg) {
+ use?(system_ffmpeg) {
packagesExist("libavcodec libavformat libavutil") {
packagesExist("libwebp, libwebpdemux, opus, \'vpx >= 1.4\'"){
log("FFMPEG............................ Using system version$${EOL}")
@@ -90,7 +104,7 @@ defineTest(finalizeConfigure) {
log("FFMPEG............................ Using internal copy (Default, force system FFMPEG with WEBENGINE_CONFIG += use_system_ffmpeg)$${EOL}")
}
}
- contains(WEBENGINE_CONFIG, use_proprietary_codecs) {
+ use?(proprietary_codecs) {
log("Proprietary codecs (H264, MP3).... Enabled$${EOL}")
} else {
log("Proprietary codecs (H264, MP3).... Not enabled (Default, enable with WEBENGINE_CONFIG += use_proprietary_codecs)$${EOL}")
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf
index c0e1f90b..99f60d0e 100644
--- a/tools/qmake/mkspecs/features/functions.prf
+++ b/tools/qmake/mkspecs/features/functions.prf
@@ -22,11 +22,18 @@ defineTest(isPlatformSupported) {
}
defineTest(isPythonVersionSupported) {
- python_major_version = $$system('python -c "import sys; print sys.version_info.major"')
- python_minor_version = $$system('python -c "import sys; print sys.version_info.minor"')
- lessThan(python_major_version, 3): greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true)
- skipBuild("Using Python version "$$python_major_version"."$$python_minor_version", but Python version 2 (2.7 or later) is required to build Qt WebEngine.")
- return(false)
+ python_error_msg = "Python version 2 (2.7 or later) is required to build Qt WebEngine."
+ python_major_version = $$system('python -c "import sys; print(sys.version_info[0])"')
+ greaterThan(python_major_version, 2) {
+ skipBuild("Python version 3 is not supported by Chromium.")
+ skipBuild($$python_error_msg)
+ return(false)
+ }
+ python_minor_version = $$system('python -c "import sys; print(sys.version_info[1])"')
+ greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true)
+ skipBuild("Using Python version "$$python_major_version"."$$python_minor_version".")
+ skipBuild($$python_error_msg)
+ return(false)
}
defineTest(isGCCVersionSupported) {
@@ -142,6 +149,11 @@ defineReplace(which) {
return($$out)
}
+defineTest(use?) {
+ contains(WEBENGINE_CONFIG, use_$$lower($$1)): return(true)
+ return(false)
+}
+
defineReplace(findOrBuildNinja) {
# If NINJA_PATH env var is set, prefer that.
# Fallback to locating our own bootstrapped ninja.
diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py
index e5df2d80..5f911f36 100755
--- a/tools/scripts/take_snapshot.py
+++ b/tools/scripts/take_snapshot.py
@@ -123,6 +123,7 @@ def isInChromiumBlacklist(file_path):
not file_path.startswith('components/strings') and
not file_path.startswith('components/tracing') and
not file_path.startswith('components/visitedlink') and
+ not file_path.startswith('components/web_cache') and
not file_path.startswith('components/webcrypto') and
not file_path.endswith('.grdp') and
not 'components_strings' in file_path)
diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py
index f6aaedf6..baa4a468 100644
--- a/tools/scripts/version_resolver.py
+++ b/tools/scripts/version_resolver.py
@@ -51,7 +51,7 @@ import json
import urllib2
import git_submodule as GitSubmodule
-chromium_version = '45.0.2454.79'
+chromium_version = '45.0.2454.101'
chromium_branch = '2454'
ninja_version = 'v1.5.3'