• Lukasz Anforowicz's avatar
    Remove ChromeContentBrowserClientExtensionsPart::OverrideNavigationParams · c7250012
    Lukasz Anforowicz authored
    Why it is okay to remove this method
    ====================================
    
    The ChromeContentBrowserClientExtensionsPart::OverrideNavigationParams
    method ensured that the referrer used in navigations never points at an
    extension-specific URL.  This method is not needed - even without this
    method, the referrer is never set to an extension-specific - this is
    because of the following places in the code (*all* 4 places need to be
    tweaked to start using extension-specific URL in the newly added browser
    test):
    
    1. //content: blink::mojom::ReferrerPtr Referrer::SanitizeForRequest:
    
      if (!request.SchemeIsHTTPOrHTTPS() ||
          !sanitized_referrer->url.SchemeIsValidForReferrer()) {
        sanitized_referrer->url = GURL();
        return sanitized_referrer;
      }
    
    2. //third_party/blink:
    2a. String KURL::StrippedForUseAsReferrer()
    
      if (!ProtocolIsInHTTPFamily())
        return String();
    
    2b. URLSchemesRegistry
    
      allowed_in_referrer_schemes({"http", "https"})
    
    4. //url: GURL GURL::GetAsReferrer()
    
      if (!SchemeIsValidForReferrer())
        return GURL();
    
    
    Why new test is desirable
    =========================
    
    This CL adds a new end-to-end test:
    ExtensionBrowserTest.NoExtensionsInRefererHeader.
    
    This test is desirable, because after tweaking all 4 places above, all
    other tests continued to pass, except for a
    ReferrerSanitizerTest.OnlyHTTPFamilyReferrer unit test.
    
    
    Why removing the method is desirable
    ====================================
    
    If we can remove ContentBrowserClient::OverrideNavigationParams
    (overrides deal with extensions and NTP), then we may be able to proceed
    with removal of ContentRendererClient::ShouldFork.  Removing the
    extension-specific part of OverrideNavigationParams helps toward these
    goals.
    
    
    Bug: 1003957
    Change-Id: I31399d62cf86d1caeb935b0218faf18a7f590248
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1834890Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
    Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#704368}
    c7250012
chrome_content_browser_client.cc 221 KB