• Lukasz Anforowicz's avatar
    GuestViewBase::GetOwnerSiteURL needs to work before the owner commits. · 31beb806
    Lukasz Anforowicz authored
    Before this CL, GuestViewBase::GetOwnerSiteURL would return:
        owner_web_contents()->GetLastCommittedURL()
    
    The code above is incorrect for two reasons:
    1. It doesn't account for about:blank URLs
    2. It doesn't work before |owner_web_contents()| commit their first
       navigation.
    
    Problem #2 is what happens when a new, blank popup is opened and then
    written to via document.write.  In such scenario, GetOwnerSiteURL would
    return an invalid URL which incorrectly caused PDF rendering pipeline to
    fail by rejecting invalid URLs in URLPattern::MatchesURL:
      URLPattern::MatchesURL()
      extensions::URLPatternSet::MatchesURL()
      extensions::SimpleFeature::GetContextAvailability()
      extensions::SimpleFeature::IsAvailableToContext()
      extensions::ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext()
         ^- IsGuestAvailableToContext passes result of
            GetOwnerSiteURL to IsAvailableToContext above
      guest_view::GuestViewBase::Init()
      guest_view::GuestViewManager::CreateGuest()
      extensions::MimeHandlerViewEmbedder::CreateMimeHandlerViewGuest()
    
    Bug: 1041880
    Change-Id: I252a15e464d70a7131c101b4f4889fa9fa968a66
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023047Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
    Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#737817}
    31beb806
guest_view_base.cc 32 KB