From ede95c2a1186c17996091950ec57c5998f73fa7a Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 21 Aug 2014 14:02:10 +0200 Subject: Don't forward loading of error pages to the API layer The fact that the error pages are HTML and get loaded through the same mechanism should be kept an implementation detail and not be considered as a new load in the API sense. Also implement HasErrorPage for good measure and remove an anoying warning from the demo browser. The issue of the url not being changed remains in the QML test (but it doesn't affect a typical browser-like UI since the user input is still there untouched in the address bar), just make sure that failure does not affect the later checks. It also seems like we have a focus problem somehow, but the test should probably use a click for that matter. Change-Id: Ib5e363981a11287fdf4bfe84b93c999d96ed8087 Reviewed-by: Jocelyn Turcotte --- src/core/renderer/content_renderer_client_qt.cpp | 11 +++++++++++ src/core/renderer/content_renderer_client_qt.h | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/core/renderer') diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index bb8c52266..6d4315b64 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -73,6 +73,17 @@ void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view new QtRenderViewObserver(render_view); } +bool ContentRendererClientQt::HasErrorPage(int httpStatusCode, std::string *errorDomain) +{ + // Use an internal error page, if we have one for the status code. + if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, httpStatusCode)) { + return false; + } + + *errorDomain = LocalizedError::kHttpErrorDomain; + return true; +} + // To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified). void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame *frame, const blink::WebURLRequest &failed_request, const blink::WebURLError &error, std::string *error_html, base::string16 *error_description) { diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index af1aa0676..386495e20 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -50,7 +50,8 @@ public: virtual void RenderThreadStarted() Q_DECL_OVERRIDE; virtual void RenderViewCreated(content::RenderView *render_view) Q_DECL_OVERRIDE; - virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE { return true; } + virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE { return false; } + virtual bool HasErrorPage(int httpStatusCode, std::string *errorDomain) Q_DECL_OVERRIDE; virtual void GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame* frame, const blink::WebURLRequest& failed_request , const blink::WebURLError& error, std::string* error_html, base::string16* error_description) Q_DECL_OVERRIDE; -- cgit v1.2.3