• Colin Blundell's avatar
    [WebLayer] Bring in WebView's ContentRendererClient::HasErrorPage() impl · 826f07c2
    Colin Blundell authored
    ContentRendererClient::HasErrorPage(http_status_error) determines
    whether the embedder has an error page for the given http status error.
    This method is used when a navigation results in an empty document
    (https://cs.chromium.org/chromium/src/content/renderer/render_frame_impl.cc?q=render_frame_impl&sq=package:chromium&g=0&l=4740). When it returns
    true, RenderFrameImpl will do the following:
    
    - Allow the embedder to display an error page if desired (via
      ContentRendererClient::PrepareErrorPageForHttpStatusError()).
    - Commit the navigation as a failed navigation.
    
    The default implementation returns false, which means that such
    navigations commit as successful rather than failed navigations.
    
    This CL does the following:
    - Copies //android_webview's implementation of HasErrorPage() into
      //weblayer to have WebLayer regard such navigations as failed
      navigations.
    - Adds a browsertest that navigates to an empty page returning a 404
      and waits for the navigation to fail (this test fails without the
      production change in this CL, since prior to this change the
      navigation in question would actually complete in WebLayer).
    - Adds a page whose presence is necessary for navigations made in
      ssl_browsertest.cc to continue to complete following the production
      change in this CL (prior to this change the fact that the page was
      missing was not a problem, due to the very fact that WebLayer
      completed rather than failed navigations to empty pages with 404's).
    
    As detailed in crbug.com/1024212, it's not clear whether
    //android_webview *not* implementing
    ContentRendererClient::PrepareErrorPageForHttpStatusError() is
    intentional. The resolution of that discussion will impact whether/how
    we implement that method for WebLayer as well, but in the meantime,
    we are now matching WebView's behavior in this case.
    
    Bug: 1024212
    Change-Id: I1e8012afd8ddf2f7cd3d1fcb6fcfd65421ddd31f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914388Reviewed-by: default avatarBo <boliu@chromium.org>
    Commit-Queue: Colin Blundell <blundell@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#715271}
    826f07c2
empty404.html.mock-http-headers 47 Bytes