diff --git a/src/lib/downloads/downloadfilehelper.cpp b/src/lib/downloads/downloadfilehelper.cpp index 55b19eb71..55cf5f0f2 100644 --- a/src/lib/downloads/downloadfilehelper.cpp +++ b/src/lib/downloads/downloadfilehelper.cpp @@ -80,7 +80,7 @@ void DownloadFileHelper::handleUnsupportedContent(QNetworkReply* reply, bool ask // Close Empty Tab if (m_webPage) { WebView* view = qobject_cast(m_webPage->view()); - if (!m_webPage->url().isEmpty() && m_webPage->url().toString() != "about:blank") { + if (!m_webPage->url().isEmpty()) { m_downloadPage = m_webPage->url(); } else if (m_webPage->history()->canGoBack()) { diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index e37b2794e..526019b3a 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -104,6 +104,10 @@ QUrl WebView::url() const returnUrl = m_aboutToLoadUrl; } + if (returnUrl.toString() == "about:blank") { + returnUrl = QUrl(); + } + return returnUrl; } @@ -131,23 +135,23 @@ void WebView::load(const QUrl &url) void WebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body) { - const QUrl &url = request.url(); + const QUrl &reqUrl = request.url(); - if (url.scheme() == "javascript") { + if (reqUrl.scheme() == "javascript") { // Getting scriptSource from PercentEncoding to properly load bookmarklets - QString scriptSource = QUrl::fromPercentEncoding(url.toString().mid(11).toUtf8()); + QString scriptSource = QUrl::fromPercentEncoding(reqUrl.toString().mid(11).toUtf8()); page()->mainFrame()->evaluateJavaScript(scriptSource); return; } - if (url.isEmpty() || isUrlValid(url)) { + if (reqUrl.isEmpty() || isUrlValid(reqUrl)) { QWebView::load(request, operation, body); - emit urlChanged(url); - m_aboutToLoadUrl = url; + emit urlChanged(url()); + m_aboutToLoadUrl = reqUrl; return; } - const QUrl &searchUrl = mApp->searchEnginesManager()->searchUrl(url.toString()); + const QUrl &searchUrl = mApp->searchEnginesManager()->searchUrl(reqUrl.toString()); QWebView::load(searchUrl); emit urlChanged(searchUrl);