• Lukasz Anforowicz's avatar
    Always use an opaque origin for about:blank, even on Android WebView. · 998e04ba
    Lukasz Anforowicz authored
    Before this CL, in presence of AllowNonStandardSchemesForAndroidWebView,
    there would be an inconsistency between origins calculated for
    about:blank URL by Blink and //url:
    
    - The assertions added by this CL to SecurityOriginTest,
      NonStandardSchemeWithAndroidWebViewHack would pass before
      and after this CL (always returning an opaque, unique origin
      for "about:blank" URL).
    
    - The assertions added by this CL to OriginTest,
      NonStandardSchemeWithAndroidWebViewHack would fail before
      this CL (returning "about://" origin for "about:blank" URL)
      and pass after this CL.
    
    Before and after this CL, Blink would use an opaque origin because
    ShouldTreatAsOpaqueOrigin in Blink's security_origin.cc would
    match "about" in SchemeRegistry::ShouldTreatURLSchemeAsNoAccess.
    This CL makes sure that IsValidInput in //url's scheme_host_port.cc
    also takes no-access schemes into account.
    
    Making sure that Blink and //url origins are consistent is a step toward
    being able to calculate the origin to commit on the browser-side.
    Without this CL, Android WebView tests (e.g.
    ...android_webview.test.LoadDataWithBaseUrlTest#testNullBaseUrl)
    would fail in the follow-up CL here: https://crrev.com/c/2581008/13
    
    Change-Id: Ic302abb8f61b16bacdcd5dc15f33718f94c106c9
    Bug: 888079
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2601844
    Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
    Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
    Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#839672}
    998e04ba
origin_unittest.cc 40.4 KB