summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/core/web_contents_delegate_qt.cpp14
-rw-r--r--src/core/web_contents_delegate_qt.h1
2 files changed, 15 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)
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 356b2df88..c971c75e8 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -91,6 +91,7 @@ public:
virtual bool IsPopupOrPanel(const content::WebContents *source) const Q_DECL_OVERRIDE;
virtual void UpdateTargetURL(content::WebContents* source, const GURL& url) Q_DECL_OVERRIDE;
virtual void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) Q_DECL_OVERRIDE;
+ virtual bool ShouldPreserveAbortedURLs(content::WebContents *source) Q_DECL_OVERRIDE;
virtual void ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) Q_DECL_OVERRIDE;
virtual void HideValidationMessage(content::WebContents *web_contents) Q_DECL_OVERRIDE;
virtual void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) Q_DECL_OVERRIDE;