From 8a942e2e73dce7640d667c17100fea391d08347a Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 6 Feb 2017 20:45:28 +0100 Subject: [PATCH] WebView: Remove QWebChannel resetting workaround It was fixed while ago in Qt --- src/lib/webengine/webpage.cpp | 19 +++---------------- src/lib/webengine/webpage.h | 2 -- src/lib/webengine/webview.cpp | 3 --- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/lib/webengine/webpage.cpp b/src/lib/webengine/webpage.cpp index c2c100978..3af63680a 100644 --- a/src/lib/webengine/webpage.cpp +++ b/src/lib/webengine/webpage.cpp @@ -73,7 +73,9 @@ WebPage::WebPage(QObject* parent) , m_secureStatus(false) , m_adjustingScheduled(false) { - setupWebChannel(); + QWebChannel *channel = new QWebChannel(this); + channel->registerObject(QSL("qz_object"), new ExternalJsObject(this)); + setWebChannel(channel); connect(this, &QWebEnginePage::loadProgress, this, &WebPage::progress); connect(this, &QWebEnginePage::loadFinished, this, &WebPage::finished); @@ -312,21 +314,6 @@ void WebPage::desktopServicesOpen(const QUrl &url) } } -void WebPage::setupWebChannel() -{ - QWebChannel *old = webChannel(); - const QString objectName = QSL("qz_object"); - - QWebChannel *channel = new QWebChannel(this); - channel->registerObject(QSL("qz_object"), new ExternalJsObject(this)); - setWebChannel(channel); - - if (old) { - delete old->registeredObjects().value(objectName); - delete old; - } -} - void WebPage::windowCloseRequested() { if (!view()) diff --git a/src/lib/webengine/webpage.h b/src/lib/webengine/webpage.h index 40dbe841c..532818fc0 100644 --- a/src/lib/webengine/webpage.h +++ b/src/lib/webengine/webpage.h @@ -69,8 +69,6 @@ public: bool isLoading() const; - void setupWebChannel(); - signals: void privacyChanged(bool status); diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index 39ad68fcf..cadcba624 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -262,9 +262,6 @@ void WebView::restoreHistory(const QByteArray &data) { QDataStream stream(data); stream >> *history(); - - // Workaround clearing QWebChannel after restoring history - page()->setupWebChannel(); } QWidget *WebView::inputWidget() const