Prerendering is paving the path as the first and main MPArch consumer, which has revealed various assumptions in the codebase that are incompatible with MPArch. While working on Fenced Frames, I've been running into similar long-tail related problems that prerendering is facing, and I have some questions about how to integrate Fenced Frames (and more generally other MPArch consumers) into this whole space.
One of the first issues I ran into was the PageLoadMetricsObserver DCHECK'ing [
cs] when navigating a <fencedframe> hosted by MPArch. This was fixed for prerendering by this
CL, however I noticed that the fix did not work for Fenced Frames out-of-the-box because our WIP does not add a new RFHI LifecycleState enum value.
My understanding is that in order to fix problems like this for fenced frames, it is necessary to add:
- A new RenderFrameHostImpl::LifecycleStateImpl enum value (presumably one for RFH and for RFHI)
- This was made clear by altimin@ given some discussion in the internal MPArch channel
- A new FrameTree::Type enum value for fenced frames as well
- This was mentioned by sreejakshetty@ also in the internal MPArch channel
I'm happy to add a new kFencedFrames value to each of these enums, however I want to make sure I'm doing so responsibly. My initial interest is to suppress bugs in e.g., PageLoadMetricsObserver and ContentFaviconDriver for fenced frames in the same way we do for prerendering, but I'm worried about introducing side effects.
There is certainly code that conditionally allows some behavior for kActive RenderFrameHostImpls and kPrimary FrameTrees, that we disallow for prerenders via the kPrerendering value among other things. I imagine we'll want a similar set of restrictions for fenced frames, but I'd like to get some MPArch folks' opinion on how to introduce a kFencedFrames value and protect against inadvertently losing a bunch of kActive-esque behavior that we may actually want for fenced frames. The only mitigation I can think of is doing a full audit of all kActive and kPrerendering usages, and ensuring that we'd have the right behavior for kFencedFrames in each place. This seems tedious and dependent on domain-specific knowledge in some places, so I just want to see if folks have other guidance here for MPArch-consuming projects. The alternative seems to be: just introduce the value, and hope it doesn't break important things. The only way to verify that <fencedframe> is truly correct in this case seems to be to write a test for every single web platform feature being used in a <fencedframe>, which certainly isn't scalable :)
More generally, I imagine we'll have two types of MPArch consumers in the long-run:
- Fully hidden consumers with some set of needs and restrictions similar to kPrerendering today
- Nested-and-visible consumers with perhaps a different set of needs and restrictions. This is similar to kPrerendering, but may look a little more like kActive in some places, since we'll support rendering/input and act more like a subframe than a truly invisible page
At the moment I'm not sure what the difference in needs might be between the two, but any work that we can do for Fenced Frames to help generalize this pattern seems like a good idea if my perspective is at all correct.
Thanks,
Dom