summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;