• Lukasz Anforowicz's avatar
    Fix and re-enable separate URLLoaderFactories for extensions (AppCache). · 4b630b4e
    Lukasz Anforowicz authored
    Overview
    ========
    
    This CL re-enables separate URLLoaderFactories for extensions.  This is
    possible because of AppCache-related fixes described below.  Re-enabling
    is done by effectively reverting r599434.
    
    AppCache is important, because it represents the scenarios when
    RenderFrameHostImpl::CommitNavigation uses a non-network-bound default
    URLLoaderFactory (e.g. in these scenarios the default factory is *not*
    created via CreateNetworkServiceDefaultFactoryAndObserve).
    A regression test for such scenarios is added in
    CrossOriginReadBlockingExtensionTest.ProgrammaticContentScriptVsAppCache
    
    For an overview of separate URLLoaderFactories for extensions, see
    https://docs.google.com/document/d/1fuBUmLZj1H319jMkK8waUbf5WdQS0N95J_mWXVzbP7A
    
    
    Avoiding cloberring of the default factory
    ==========================================
    
    This CL ensures that the initial injection of a content script doesn't
    result in cloberring the default URLLoaderFactory, by making sure
    RenderFrameHostImpl::MarkInitiatorsAsRequiringSeparateURLLoaderFactory
    is capable of pushing down only the new, initiator-specific factories
    (without touching the default factory and/or other, untouched
    initiator-specific factories).  This also requires ensuring that
    RenderFrameHostImpl::CreateInitiatorSpecificURLLoaderFactories takes
    as input the origins that need new factories (instead of using all the
    origins that the frame needs initiator-specific factories for).
    
    
    Handling NetworkService crashes
    ===============================
    
    By having RenderFrameHostImpl::CreateInitiatorSpecificURLLoaderFactories
    call CreateNetworkServiceDefaultFactoryAndObserve instead of
    CreateNetworkServiceDefaultFactoryInternal, this CL ensures that a
    NetworkService crash is detected when initiator-specific (network-bound)
    factories are used (and that the crash is detected even if the default
    factory is not network-bound).  This makes sure that content scripts in
    the test continue to be able to issue network-bound requests after the
    crash.
    
    Additionally, introducing
    |recreate_default_url_loader_factory_after_network_service_crash_| field
    ensures that if the default factory is not network-bound, then it will
    not get cloberred when handling a network service crash.  This helps
    ensure that the final AppCache request made by the test is successful.
    
    
    Bug: 846346
    Change-Id: Ie53710d17526c140ef8ee65a41de5d3312bfae5b
    Reviewed-on: https://chromium-review.googlesource.com/c/1318082
    Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
    Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
    Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
    Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#606352}
    4b630b4e