summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/api/qwebenginepage.cpp32
-rw-r--r--src/core/api/qwebenginepage.h10
-rw-r--r--src/core/doc/src/qwebenginepage_lgpl.qdoc3
3 files changed, 6 insertions, 39 deletions
diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp
index 3b47f12c5..df2eb7a65 100644
--- a/src/core/api/qwebenginepage.cpp
+++ b/src/core/api/qwebenginepage.cpp
@@ -924,25 +924,6 @@ QWebChannel *QWebEnginePage::webChannel() const
}
/*!
- * \overload
- *
- * Sets the web channel instance to be used by this page to \a channel and installs
- * it in the main JavaScript world.
- *
- * With this method the web channel can be accessed by web page content. If the content
- * is not under your control and might be hostile, this could be a security issue and
- * you should consider installing it in a private JavaScript world.
- *
- * \since 5.5
- * \sa QWebEngineScript::MainWorld
- */
-
-void QWebEnginePage::setWebChannel(QWebChannel *channel)
-{
- setWebChannel(channel, QWebEngineScript::MainWorld);
-}
-
-/*!
* Sets the web channel instance to be used by this page to \a channel and connects it to
* web engine's transport using Chromium IPC messages. The transport is exposed in the JavaScript
* world \a worldId as
@@ -955,7 +936,7 @@ void QWebEnginePage::setWebChannel(QWebChannel *channel)
* \since 5.7
* \sa QWebEngineScript::ScriptWorldId
*/
-void QWebEnginePage::setWebChannel(QWebChannel *channel, uint worldId)
+void QWebEnginePage::setWebChannel(QWebChannel *channel, quint32 worldId)
{
#if QT_CONFIG(webengine_webchannel)
Q_D(QWebEnginePage);
@@ -2019,17 +2000,6 @@ void QWebEnginePage::setZoomFactor(qreal factor)
d->adapter->setZoomFactor(factor);
}
-void QWebEnginePage::runJavaScript(const QString &scriptSource)
-{
- Q_D(QWebEnginePage);
- d->ensureInitialized();
- if (d->adapter->lifecycleState() == WebContentsAdapter::LifecycleState::Discarded) {
- qWarning("runJavaScript: disabled in Discarded state");
- return;
- }
- d->adapter->runJavaScript(scriptSource, QWebEngineScript::MainWorld);
-}
-
void QWebEnginePage::runJavaScript(const QString& scriptSource, const std::function<void(const QVariant &)> &resultCallback)
{
Q_D(QWebEnginePage);
diff --git a/src/core/api/qwebenginepage.h b/src/core/api/qwebenginepage.h
index 2afc75dc9..801bcf84d 100644
--- a/src/core/api/qwebenginepage.h
+++ b/src/core/api/qwebenginepage.h
@@ -283,16 +283,14 @@ public:
QPointF scrollPosition() const;
QSizeF contentsSize() const;
- void runJavaScript(const QString& scriptSource);
- void runJavaScript(const QString& scriptSource, quint32 worldId);
- void runJavaScript(const QString& scriptSource, const std::function<void(const QVariant &)> &resultCallback);
- void runJavaScript(const QString& scriptSource, quint32 worldId, const std::function<void(const QVariant &)> &resultCallback);
+ void runJavaScript(const QString &scriptSource, quint32 worldId = 0);
+ void runJavaScript(const QString &scriptSource, const std::function<void(const QVariant &)> &resultCallback);
+ void runJavaScript(const QString &scriptSource, quint32 worldId, const std::function<void(const QVariant &)> &resultCallback);
QWebEngineScriptCollection &scripts();
QWebEngineSettings *settings() const;
QWebChannel *webChannel() const;
- void setWebChannel(QWebChannel *);
- void setWebChannel(QWebChannel *, uint worldId);
+ void setWebChannel(QWebChannel *, quint32 worldId = 0);
QColor backgroundColor() const;
void setBackgroundColor(const QColor &color);
diff --git a/src/core/doc/src/qwebenginepage_lgpl.qdoc b/src/core/doc/src/qwebenginepage_lgpl.qdoc
index b1a79bcae..bbe1e0110 100644
--- a/src/core/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/core/doc/src/qwebenginepage_lgpl.qdoc
@@ -742,8 +742,7 @@
/*!
\fn void QWebEnginePage::runJavaScript(const QString &scriptSource, quint32 worldId, const std::function<void(const QVariant &)> &resultCallback)
- \fn void QWebEnginePage::runJavaScript(const QString &scriptSource, quint32 worldId)
- \fn void QWebEnginePage::runJavaScript(const QString &scriptSource)
+ \fn void QWebEnginePage::runJavaScript(const QString &scriptSource, quint32 worldId = 0)
\fn void QWebEnginePage::runJavaScript(const QString &scriptSource, const std::function<void(const QVariant &)> &resultCallback)
\since 5.7