Hey everyone, I wanted to publicly summarize a discussion that I had with shivanisha@ earlier today that may impact the work that will be done on MPArch long-tail audit for fenced frames.
Right now there are four ways of determining whether or not various brower-side objects are associated with a fenced frame:
- FrameTreeNode::IsFencedFrame() (being renamed to IsFencedFrameRoot() in this CL)
- ShadowDOM implementation: This will only return true for the FrameTreeNode corresponding with the internal <iframe> backing the <fencedframe> element
- MPArch implementation: This will only return true for the root FrameTreeNode of the inner FrameTree (not the outer delegate dummy child FrameTreeNode) (literally just delegates to IsMainFrame() and FrameTree::type())
- FrameTreeNode::IsInFencedFrameTree()
- ShadowDOM implementation: Returns true for all FrameTreeNodes under-and-including the internal <iframe> backing the <fencedframe> element.
- MPArch implementation: Returns true for all FrameTreeNodes in the inner FrameTree (literally just delegates to FrameTree::type())
- RenderFrameHost(Impl)::HostedByFencedFrame()
- Just delegates directly to FrameTreeNode::IsFencedFrame(). I'm renaming this method to IsFencedFrameRoot() just like the FTN method for clarity.
- This method is needed to expose something to the public API for consumers that are dealing directly with the RenderFrameHost interface
- FrameTree::IsFencedFrameTree() // FrameTree::type()
- This is only used for unit tests right now before the MPArch impl lands. I'm removing it in CL 3057656 in favor of having people just call type() directly and check there
This begs the question: when working on the long-tail for fenced frames, which one(s) should we use? There are some significant differences between them, notably that FrameTree::type() will only return kFencedFrame for the MPArch implementation, whereas the RFHI/FTN methods will indicate fenced-frame-ness even in the ShadowDOM Origin Trial implementation.
The MPArch long-tail spreadsheet is called the MPArch long-tail spreadsheet for a reason, so I don't think it makes sense to address each row for both the MPArch version of fenced frames as well as the ShadowDOM Origin Trial implementation. With that said, presumably many long-tail fixes will be made by determining whether or not we're in a fenced frame FrameTree, and then implementing some behavior difference etc. If these fixes attempt to determine whether or not we're in a fenced frame's FrameTree by checking the RFHI/FTN methods, then these changes will be live for both the MPArch implementation as well as the ShadowDOM implementation, even though only the MPArch implementation will be tested.
That is not very great, since having lots of untested code paths is never a good thing, which is why I'm thinking a good policy to have for writing/reviewing long-tail fenced frame fixes would be: "Stay away from the FrameTreeNode methods, and always prefer
FrameTree::type() when trying to determine if you're associated with a fenced frame FrameTree, and not a kPrimary one".
You might be asking "Then who is going to use the FrameTreeNode methods? What good are they?" These will continue to be used probably mostly by myself, Shivani, and perhaps
FLEDGE folks. The only consumers of these methods should be objects whose fenced-frame-specific-behavior is so core to the fenced frame experience, it must be present for both the origin trial and the long-term implementation. Each of these impl paths will be tested by us specifically. But since most of the long-tail MPArch fixes are not critical to the core ads use-cases of fenced frames (beacuse we were always planning on OT'ing before the long-tail work began), we can refrain from having the long-tail fix behavior apply to the ShadowDOM OT impl, which is important because we don't want to write 2x tests for all of the long-tail sheet items.
I know that is all a bit complicated, but we're looking to create some guidance for external folks that will work on the MPArch+FencedFrames and I think this is an important one to touch on, and I'd like to hear your opinions too.
Thanks,
Dom