• Emily Stark's avatar
    Only dispatch auth requests to extensions once per request · 71933f58
    Emily Stark authored
    (This is a reland of
    https://chromium-review.googlesource.com/c/chromium/src/+/1978898,
    with a different test that relies on a slow HTTP response instead of a
    long one, to avoid OOMing some trybots.)
    
    With HTTP auth committed interstitials enabled, extensions were
    getting notified of each auth request twice: once when LoginHandler is
    first called to cancel the auth request and show a blank error page,
    and again when LoginHandler is called after committing the error page
    to show a login prompt on top of it.
    
    In common operation, the second extension dispatch was a no-op,
    because the request had been destroyed already by the second entry
    into LoginHandler. But, there was a race ticked by long response
    bodies. That is, it was possible that the second onAuthRequired event
    would be dispatched to an extension before the request was
    destroyed. The request was destroyed between the second dispatch and
    the extension's reply. When the extension replied,the WebRequestAPI
    would simply drop the reply for the now non-existent request, never
    returning control to LoginHandler so that it can proceed to show the
    login prompt.
    
    The fix is to ensure that auth requests are dispatched to extensions
    only once, on the first time LoginHandler is called, before the
    request is cancelled.
    
    Bug: 1034468
    Change-Id: I735f9c76bce5788c5362d7d04e6f81fdcd9535d7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1978898Reviewed-by: default avatarMustafa Emre Acer <meacer@chromium.org>
    Commit-Queue: Emily Stark <estark@chromium.org>
    Cr-Original-Commit-Position: refs/heads/master@{#727041}
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1980766
    Cr-Commit-Position: refs/heads/master@{#727664}
    71933f58
manifest.json 238 Bytes