summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-03 16:50:27 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-09 17:58:00 +0000
commit70e04420eb8fbd61d7f4afd293d3ac135ca7ffd6 (patch)
treed69e20264b727879f94cc2e40734c13fd33129ed /src
parentaf91351b817e28e26c4b00c04de1017e6dcf2f67 (diff)
Get rid of a few redundant method variants
Use default arguments to get rid of the old method version without breaking API. Change-Id: I2f71b04bff491567df564c66cd98d0d04bfa0517 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io> (cherry picked from commit 41c6eabd3b0c652bb8681f0ff14294a698f76b2e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
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