Move the call to GetOriginForURLLoaderFactory slightly earlier.
There are multiple calls to GetOriginForURLLoaderFactory made from RenderFrameHostImpl::CommitNavigation. Instead of making these calls, we can make a single call early during CommitNavigation and store the result in a variable that gets reused later on. This refactoring has been suggested when code reviewing another CL here: https://chromium-review.googlesource.com/c/chromium/src/+/1875273/15/content/browser/frame_host/render_frame_host_impl.cc#5420 It turns out that moving the GetOriginForURLLoaderFactory call earlier means that it also gets called for navigations to about:srcdoc. In this case the URLLoaderFactory should be inherited from the parent, so the origin calculated by GetOriginForURLLoaderFactory is not technically needed. OTOH, GetOriginForURLLoaderFactory should in the future calculate the origin to commit, and therefore we should make sure it correctly handles all the cases. In particular, without special-casing about:srcdoc, NavigationBrowserTest.BlockedSrcDocRendererInitiated* tests would hit a CHECK(...CanAccessDataForOrigin...) in GetOriginForURLLoaderFactory. This CL fixes this. Bug: 998247, 920634, 936310 Change-Id: I1ca851c8e574d24f05b4943f6bee186ebd50aa61 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1910865Reviewed-by:Nasko Oskov <nasko@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/master@{#714952}
Showing
Please register or sign in to comment