I have some navigation questions regarding initial about:blank navigations and how they relate to fenced frames.
https://g-issues.chromium.org/issues/334991040I was assigned this bug, where an extension that tries to inject a script into a fenced frame that hasn't done an initial navigation causes the promise to not resolve until the fenced frame is navigated. Iframes don't have this problem. I traced the root cause to the fact that fenced frames do not do an initial navigation to about:blank the same way that iframes do. This results in the fenced frame's document never entering an idle state if not explicitly navigated to a config. There were 2 ways I considered fixing this:
1. Add a carveout in the
script injector for un-navigated fenced frames. This is the least amount of work, but feels more like a band-aid solution.
2. Do an explicit
navigation to about:blank when a fenced frame is first inserted into a document, the same way that iframes do (
HTMLFrameElementBase::DidNotifySubtreeInsertionsToDocument() calls
HTMLFrameOwnerElement::LoadOrRedirectSubframe() even if src is blank).
2.5. Do an explicit
somewhat synchronous navigation to about:blank to match what iframes do. I say
somewhat synchronous because the inner frame root will need to be notified by the HTMLFencedFrameElement through the browser that it needs to perform an about:blank navigation. (Though there's probably some way to have it detect that it's a newly created fenced frame inner root and do the synchronous navigation)
I have a WIP CL for option 1 working (
https://chromium-review.googlesource.com/c/chromium/src/+/5492360), but I'd like to get option 2 to work if possible.
When I try to get option #2 or #2.5 to work, a bunch of browser tests start failing (WIP CL for option 2.5:
https://chromium-review.googlesource.com/c/chromium/src/+/5512064). It seems that because there's this extra about:blank navigation, a lot of existing tests break because they're waiting for a navigation commit, but the navigation that commits is the about:blank navigation.
Before I actually start trying to fix all these tests (and before I spend any more effort on this bug), I want to confirm that what I'm doing seems reasonable and that there's nothing I'm missing. I guess more specifically these are my questions:
1. Is there any reason to
not match the about:blank initial navigation behavior of iframes? Is it fine to have fenced frames do this about:blank initial (possibly semi-synchronous) navigation?
2. How do iframes not run into the browser test navigation observer issue I'm running into? Do their about:blank navigations happen early enough that they commit before any navigation observers even start running?
3. Do you think it's possible to have the same fully synchronous about:blank navigation behavior for inner fenced frame roots? Or is that not doable because of the fact that an inner root lives cross-process from the HTMLFencedFrameElement? Could I have the inner root's frame do an about:blank navigation once it detects it's inserted into the document and knows it's a fenced frame root that has not performed a navigation previously?