summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_delegate_qt.cpp
diff options
context:
space:
mode:
authorAdam Kallai <kadam@inf.u-szeged.hu>2015-11-17 17:47:43 +0100
committerAdam Kallai <kadam@inf.u-szeged.hu>2016-04-01 08:07:48 +0000
commitf22435da983a9e0070ef9c969bb9aa8c1191c0a6 (patch)
tree9f5143006de75618785190b0dbec88a7dad36ef4 /src/core/web_contents_delegate_qt.cpp
parent8dbb6dde40bba8f4269196fbcc4309f7b84da98f (diff)
Avoid triggering extra urlChanged signal
Chromium usually clears the pending entry when it fails, so that an arbitrary URL is not left visible above a committed page. However, it does preserve the pending entry in some cases, such as on the initial navigation of an unmodified blank tab. So in other cases Chromium clears the pending entry (if the navigation is not in progress), and it does force the UI (URL bar) to refresh. In our case we allow failed URLs to stick around in the URL bar but only when alternate error pages are used. Change-Id: I26e81e7a99415aa184880dcb647a06d977584119 Task-number: QTBUG-48995 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r--src/core/web_contents_delegate_qt.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index baf61b5fc..e3903c902 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -122,6 +122,20 @@ void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source,
m_viewClient->titleChanged(toQt(source->GetTitle()));
}
+bool WebContentsDelegateQt::ShouldPreserveAbortedURLs(content::WebContents *source)
+{
+ Q_UNUSED(source)
+
+ // Allow failed URLs to stick around in the URL bar, but only when the error-page is enabled.
+ WebEngineSettings *settings = m_viewClient->webEngineSettings();
+ bool isErrorPageEnabled = settings->testAttribute(settings->Attribute::ErrorPageEnabled);
+
+ if (isErrorPageEnabled)
+ return true;
+
+ return false;
+}
+
void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked)
{
Q_UNUSED(source)