Ensure every LocalFrame has a fully functional PolicyContainer
A LocalFrame's PolicyContainer is the counterpart of the RenderFrameHost's PolicyContainerHost. There are LocalFrames without a corresponding RenderFrameHost, and there are RenderFrameHost (the speculative ones) without a PolicyContainerHost. Previously, in those cases, we were setting a LocalFrame's PolicyContainer to be nullptr. We were trying to handle accesses to a non-defined LocalFrame's PolicyContainer with single nullptr checks. However, a LocalFrame's PolicyContainer is needed every time a LocalFrame needs to handle security policies. It turn out this can happen in a myriad of cases. For example, SVG images included via the img tag (which are rendered using a fake LocalFrame) allow meta tags delivering security policies (although those policies effectively do nothing). Using nullptr checks to handle those cases everywhere is tedious and error prone. With this CL we adopt a similar approach as for the EmptyFrameClients. We always define a PolicyContainer for a LocalFrame, even if it has no RenderFrameHost. In this case, the PolicyContainer is an "empty" client: it is fully functional for Blink's purposes, but it treats all mojo messaging to its (non-existent) Browser counterpart as no-ops. Bug: 1158034,1130587 Change-Id: I18347b9a16c6c7d71931c1f34abda793e66a9324 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594768Reviewed-by:Arthur Sonzogni <arthursonzogni@chromium.org> Reviewed-by:
Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Pâris Meuleman <pmeuleman@chromium.org> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/master@{#843501}
Showing
Please register or sign in to comment