• Daniel Cheng's avatar
    Mitigate a crash when a navigation to a media document fails. · f762a4c5
    Daniel Cheng authored
    Blink has some logic for rendering a custom error page if a navigation
    fails due to an HTTP error and the response body is empty, so the user
    does not simply seen a blank page on error.
    
    https://crrev.com/796508 added a number of `CHECK`s to assert that
    navigations always commit. However, it incorrectly trips in the case of
    a navigation to a media document that results in an HTTP error since:
    
    1. Media documents synchronously complete loading while handling the
       `CommitNavigation` IPC.
    2. When loading is complete, //content checks if the navigation
       resulted in an HTTP error—and if so, whether the response body was
       empty.
    3. If both of those conditions are true, //content synthesises a custom
       error page and calls `blink::WebNavigationControl::CommitNavigation`.
    
    Step 3 currently asserts that no commit is in progress, which is not
    true in the case of media documents. This CL is intended to be a small
    and mergeable patch and simply updates the error page handling in
    `RunScriptsAtDocumentReady()` to better handle reentrant commits.
    
    Bug: 1127837
    Change-Id: Ied6ce00e10ff8e3b75306e97dba3d28fcd2e4c6f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2430769
    Commit-Queue: Daniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
    Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#811593}
    f762a4c5
navigation_browsertest.cc 151 KB