summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-10 10:19:28 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-10 10:19:28 +0100
commitd1f4409a2b1e0143be0d4fd734f3dd83255ea35c (patch)
tree52daa990c1da2c2ce9656fe4065b73a848a57a5a /src
parent8e5ac243ac774209b77bec42eda2ec43f9c9b04a (diff)
parent776442f2117c4b2d6dac75ab56b42bd82e2ce6d0 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp tests/auto/widgets/widgets.pro Change-Id: Id9444359ed2e35d469331db96a355c9ea2d095d5
Diffstat (limited to 'src')
-rw-r--r--src/core/api/qwebenginecallback.h2
-rw-r--r--src/core/api/qwebenginecallback_p.h2
-rw-r--r--src/core/api/qwebengineurlrequestinfo.cpp3
-rw-r--r--src/core/core.pro4
-rw-r--r--src/webengine/api/qquickwebenginescript.cpp68
-rw-r--r--src/webengine/doc/qtwebengine.qdocconf4
-rw-r--r--src/webengine/doc/src/qtwebengine-platform-notes.qdoc10
-rw-r--r--src/webengine/doc/src/webengineview.qdoc2
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp15
-rw-r--r--src/webenginewidgets/api/qwebenginehistory.h2
-rw-r--r--src/webenginewidgets/api/qwebenginescript.h2
-rw-r--r--src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc9
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc2
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp21
14 files changed, 140 insertions, 6 deletions
diff --git a/src/core/api/qwebenginecallback.h b/src/core/api/qwebenginecallback.h
index de617eb25..9c7e43b92 100644
--- a/src/core/api/qwebenginecallback.h
+++ b/src/core/api/qwebenginecallback.h
@@ -93,9 +93,11 @@ private:
Q_DECLARE_SHARED(QWebEngineCallback<int>)
Q_DECLARE_SHARED(QWebEngineCallback<const QByteArray &>)
+#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<bool>)
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<const QString &>)
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<const QVariant &>)
+#endif
QT_END_NAMESPACE
diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h
index fdaf84d21..b88ef4d2c 100644
--- a/src/core/api/qwebenginecallback_p.h
+++ b/src/core/api/qwebenginecallback_p.h
@@ -242,10 +242,12 @@ void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty()
parent->invokeEmptyInternal(callback);
}
+#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
#define CHECK_RELOCATABLE(x) \
Q_STATIC_ASSERT((QTypeInfoQuery<QWebEngineCallback< x > >::isRelocatable));
FOR_EACH_TYPE(CHECK_RELOCATABLE)
#undef CHECK_RELOCATABLE
+#endif
} // namespace QtWebEngineCore
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index 7325b131e..029c77fe8 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -110,6 +110,9 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q
it possible to intercept URL requests. This function is executed on the IO thread,
and therefore running long tasks here will block networking.
+ \a info contains the information about the URL request and will track internally
+ whether its members have been altered.
+
\sa QWebEngineProfile::setRequestInterceptor
*/
diff --git a/src/core/core.pro b/src/core/core.pro
index 09eee496f..a205d39a0 100644
--- a/src/core/core.pro
+++ b/src/core/core.pro
@@ -20,7 +20,8 @@ core_api.depends = gyp_run
core_module.file = core_module.pro
core_module.depends = core_api
-SUBDIRS += core_gyp_generator
+SUBDIRS += core_headers \
+ core_gyp_generator
!win32 {
# gyp_configure_host.pro and gyp_configure_target.pro are phony pro files that
@@ -36,6 +37,5 @@ SUBDIRS += core_gyp_generator
}
SUBDIRS += gyp_run \
- core_headers \
core_api \
core_module
diff --git a/src/webengine/api/qquickwebenginescript.cpp b/src/webengine/api/qquickwebenginescript.cpp
index 7e5ff863f..aa32041e4 100644
--- a/src/webengine/api/qquickwebenginescript.cpp
+++ b/src/webengine/api/qquickwebenginescript.cpp
@@ -48,6 +48,27 @@
using QtWebEngineCore::UserScript;
+/*!
+ \qmltype WebEngineScript
+ \instantiates QQuickWebEngineScript
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.1
+ \brief Enables the programmatic injection of scripts in the JavaScript engine.
+
+ The WebEngineScript type enables the programmatic injection of so called \e {user scripts} in
+ the JavaScript engine at different points, determined by injectionPoint, during the loading of
+ web content.
+
+ Scripts can be executed either in the main JavaScript \e world, along with the rest of the
+ JavaScript coming from the web contents, or in their own isolated world. While the DOM of the
+ page can be accessed from any world, JavaScript variables of a function defined in one world are
+ not accessible from a different one. The worldId property provides some predefined IDs for this
+ purpose.
+
+ Use \l{WebEngineView::userScripts}{WebEngineView.userScripts} to access a list of scripts
+ attached to the web view.
+*/
+
QQuickWebEngineScript::QQuickWebEngineScript()
: d_ptr(new QQuickWebEngineScriptPrivate)
{
@@ -81,6 +102,12 @@ QString QQuickWebEngineScript::toString() const
return ret;
}
+/*!
+ \qmlproperty QString WebEngineScript::name
+
+ The name of the script. Can be useful to retrieve a particular script from
+ \l{WebEngineView::userScripts}{WebEngineView.userScripts}.
+*/
QString QQuickWebEngineScript::name() const
{
Q_D(const QQuickWebEngineScript);
@@ -93,7 +120,7 @@ QString QQuickWebEngineScript::name() const
This property holds the remote source location of the user script (if any).
Unlike \l sourceCode, this property allows referring to user scripts that
- are not already loaded in memory, for instance, when stored on disk.
+ are not already loaded in memory, for instance, when stored on disk.
Setting this property will change the \l sourceCode of the script.
@@ -124,20 +151,57 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineScript::Deferred, UserScript::AfterLoad)
ASSERT_ENUMS_MATCH(QQuickWebEngineScript::DocumentReady, UserScript::DocumentLoadFinished)
ASSERT_ENUMS_MATCH(QQuickWebEngineScript::DocumentCreation, UserScript::DocumentElementCreation)
+/*!
+ \qmlproperty enumeration WebEngineScript::injectionPoint
+
+ The point in the loading process at which the script will be executed.
+ The default value is \c Deferred.
+
+ \value DocumentCreation
+ The script will be executed as soon as the document is created. This is not suitable for
+ any DOM operation.
+ \value DocumentReady
+ The script will run as soon as the DOM is ready. This is equivalent to the
+ \c DOMContentLoaded event firing in JavaScript.
+ \value Deferred
+ The script will run when the page load finishes, or 500 ms after the document is ready,
+ whichever comes first.
+*/
QQuickWebEngineScript::InjectionPoint QQuickWebEngineScript::injectionPoint() const
{
Q_D(const QQuickWebEngineScript);
return static_cast<QQuickWebEngineScript::InjectionPoint>(d->coreScript.injectionPoint());
}
-
+/*!
+ \qmlproperty enumeration WebEngineScript::worldId
+
+ The world ID defining which isolated world the script is executed in.
+
+ \value MainWorld
+ The world used by the page's web contents. It can be useful in order to expose custom
+ functionality to web contents in certain scenarios.
+ \value ApplicationWorld
+ The default isolated world used for application level functionality implemented in
+ JavaScript.
+ \value UserWorld
+ The first isolated world to be used by scripts set by users if the application is not
+ making use of more worlds. As a rule of thumb, if that functionality is exposed to the
+ application users, each individual script should probably get its own isolated world.
+*/
QQuickWebEngineScript::ScriptWorldId QQuickWebEngineScript::worldId() const
{
Q_D(const QQuickWebEngineScript);
return static_cast<QQuickWebEngineScript::ScriptWorldId>(d->coreScript.worldId());
}
+/*!
+ \qmlproperty int WebEngineScript::runOnSubframes
+ Set this property to \c true if the script is executed on every frame in the page, or \c false
+ if it is only ran for the main frame.
+ The default value is \c{false}.
+ */
bool QQuickWebEngineScript::runOnSubframes() const
{
Q_D(const QQuickWebEngineScript);
diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf
index 02f9a9ffd..2fbdef93e 100644
--- a/src/webengine/doc/qtwebengine.qdocconf
+++ b/src/webengine/doc/qtwebengine.qdocconf
@@ -35,6 +35,9 @@ qhp.QtWebEngine.subprojects.examples.indexTitle = Qt WebEngine Examples
qhp.QtWebEngine.subprojects.examples.selectors = doc:example
qhp.QtWebEngine.subprojects.examples.sortPages = true
+manifestmeta.highlighted.names += "QtWebEngine/WebEngine Markdown Editor Example" \
+ "QtWebEngine/WebEngine Quick Nano Browser"
+
tagfile = ../../../doc/qtwebengine/qtwebengine.tags
depends += qtcore \
@@ -45,6 +48,7 @@ depends += qtcore \
qtquickcontrols \
qtdoc \
qtwebchannel \
+ qtwebview \
qtwidgets
headerdirs += .. \
diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
index 29b8db42e..1f2d9dcf2 100644
--- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
+++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
@@ -116,4 +116,14 @@
be configured for use with several codecs, which rises licensing issues during distribution
with the codec libraries. For some codecs, open source implementations, such as \l {OpenH264},
are available.
+
+ \section1 Default QSurfaceFormat OpenGL Profile Support
+
+ If a new default QSurfaceFormat with a modified OpenGL profile has to be set, it should be set
+ before the application instance is declared, to make sure that all created OpenGL contexts use
+ the same OpenGL profile.
+
+ On OS X, if the default QSurfaceFormat is set after the application instance, the application
+ will exit with qFatal(), and print a message that the default QSurfaceFormat should be set
+ before the application instance.
*/
diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc
index a242acffc..8e09d2b89 100644
--- a/src/webengine/doc/src/webengineview.qdoc
+++ b/src/webengine/doc/src/webengineview.qdoc
@@ -227,6 +227,8 @@
\since QtWebEngine 1.1
List of script objects attached to the view.
+
+ \sa WebEngineScript
*/
/*!
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index eebf0ceb6..1101bd483 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -44,6 +44,7 @@
#include <QGuiApplication>
#include <QQuickPaintedItem>
#include <QQuickWindow>
+#include <QSurfaceFormat>
#include <QVariant>
#include <QWindow>
#include <private/qquickwindow_p.h>
@@ -63,6 +64,20 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW
return;
setFocus(true);
setActiveFocusOnTab(true);
+
+#ifdef Q_OS_OSX
+ // Check that the default QSurfaceFormat OpenGL profile matches the global OpenGL shared
+ // context profile, otherwise this could lead to a nasty crash.
+ QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext();
+ if (globalSharedContext) {
+ QSurfaceFormat sharedFormat = globalSharedContext->format();
+ QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat();
+ if (defaultFormat.profile() != sharedFormat.profile()) {
+ qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile does not match global shared context OpenGL profile. Please make sure you set a new QSurfaceFormat before the QtGui application instance is created.");
+ }
+ }
+#endif
+
}
void RenderWidgetHostViewQtDelegateQuick::initAsChild(WebContentsAdapterClient* container)
diff --git a/src/webenginewidgets/api/qwebenginehistory.h b/src/webenginewidgets/api/qwebenginehistory.h
index 33d91d523..21ebbf41d 100644
--- a/src/webenginewidgets/api/qwebenginehistory.h
+++ b/src/webenginewidgets/api/qwebenginehistory.h
@@ -79,7 +79,9 @@ private:
friend class QWebEngineHistoryPrivate;
};
+#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineHistoryItem)
+#endif
class QWebEngineHistoryPrivate;
class QWEBENGINEWIDGETS_EXPORT QWebEngineHistory {
diff --git a/src/webenginewidgets/api/qwebenginescript.h b/src/webenginewidgets/api/qwebenginescript.h
index e3f65ec59..34c13e4b7 100644
--- a/src/webenginewidgets/api/qwebenginescript.h
+++ b/src/webenginewidgets/api/qwebenginescript.h
@@ -102,7 +102,9 @@ private:
QSharedDataPointer<QtWebEngineCore::UserScript> d;
};
+#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineScript)
+#endif
#ifndef QT_NO_DEBUG_STREAM
QWEBENGINEWIDGETS_EXPORT QDebug operator<<(QDebug, const QWebEngineScript &);
diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
index 6b518a1f2..461af086a 100644
--- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
@@ -101,7 +101,14 @@
\value LocalStorageEnabled
Enables support for the HTML 5 local storage feature. Enabled by default.
\value LocalContentCanAccessRemoteUrls
- Allows locally loaded documents to access remote URLs. Disabled by default.
+ Allows locally loaded documents to ignore cross-origin rules so that they can access
+ remote resources that would normally be blocked, because all remote resources are
+ considered cross-origin for a local file. Remote access that would not be blocked by
+ cross-origin rules is still possible when this setting is disabled (default).
+ Note that disabling this setting does not stop XMLHttpRequests or media elements in
+ local files from accessing remote content. Basically, it only stops some HTML
+ subresources, such as scripts, and therefore disabling this setting is not a safety
+ mechanism.
\value XSSAuditingEnabled
Monitors load requests for cross-site scripting attempts. Suspicious scripts are blocked
and reported in the inspector's JavaScript console. Disabled by default, because it
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 397b9f51b..1ec831ac2 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -76,7 +76,7 @@
new windows, such as pop-up windows, you can subclass QWebEngineView and
reimplement the createWindow() function.
- \sa {WebEngine Demo Browser Example}, {WebEngine Content Manipulation Example}, {Markdown Editor Example}
+ \sa {WebEngine Demo Browser Example}, {WebEngine Content Manipulation Example}, {WebEngine Markdown Editor Example}
*/
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index d9a62fce7..90eb0e76e 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -67,9 +67,30 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende
setFocusPolicy(Qt::StrongFocus);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
+
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
+
+ QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext();
+ if (globalSharedContext) {
+ QSurfaceFormat sharedFormat = globalSharedContext->format();
+
+#ifdef Q_OS_OSX
+ // Check that the default QSurfaceFormat OpenGL profile matches the global OpenGL shared
+ // context profile, otherwise this could lead to a nasty crash.
+ QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat();
+ if (defaultFormat.profile() != sharedFormat.profile()) {
+ qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile does not match global shared context OpenGL profile. Please make sure you set a new QSurfaceFormat before the QtGui application instance is created.");
+ }
+#endif
+
+ // Make sure the OpenGL profile of the QOpenGLWidget matches the shared context profile.
+ format.setMajorVersion(sharedFormat.majorVersion());
+ format.setMinorVersion(sharedFormat.minorVersion());
+ format.setProfile(sharedFormat.profile());
+ }
+
setFormat(format);
#endif