Page::didCommitLoad is invoked multiple times for most page loads |
||||
Issue description
I believe Page::didCommitLoad expects to be invoked once per frame as it starts loading, and most of it's logic expects to run exactly once per page load (for some concept of "page load"):
void Page::didCommitLoad(LocalFrame* frame)
{
notifyDidCommitLoad(frame);
if (m_mainFrame == frame) {
frame->console().clearMessages();
useCounter().didCommitLoad();
deprecation().clearSuppression();
frameHost().visualViewport().sendUMAMetrics();
m_hostsUsingFeatures.updateMeasurementsAndClear();
UserGestureIndicator::clearProcessedUserGestureSinceLoad();
}
}
The particular case that's impacting me is issue 236262 , but it looks like the other examples here are probably also affected. Eg. when loading a page like http://jsbin.com, I see the logic inside the m_mainFrame==frame check get invoked 7 times.
Many of these appear to be due to SVG images - blink::SVGImage::dataChanged ultimately calls DocumentLoader::createWriterFor to create the SVG document writer, but that's using the same FrameLoader as the main document in the frame and so it's call to FrameLoader::receivedFirstData seems wrong (the frame has long ago received it's first data).
FrameLoader::didBeginDocument() seems likely affected by the same thing.
What's the right way to update this logic to run exactly once for each top-level navigation? Brain can you please help / route?
,
Jun 2 2016
,
Jun 2 2016
Thanks! I can certainly add a hack like that. I think Page instances are re-used across distinct navigations so their lifetime is too long, but perhaps it would make sense for FrameLoader to track such a bit? I'll play with this a bit for issue 236262 (but leave this issue for the larger problem here for loading-dev). However I'm now leaning towards keeping our existing UseCounter metrics in place while we transition to more correct ones. So whatever we do to "fix" this bug, we need to continue to invoke the logic in useCounter().didCommitLoad() according to the existing flawed behavior (although should probably rename the functions at least to make it clear that it's not what you'd expect).
,
Aug 25 2016
Note that I realized SVGImage is really weird in that it has it's own Page instance (which explains why each SVGImage results in a Page::didCommitLoad call). I'm not sure which other cases I was seeing, I'll dig further...
,
Dec 23 2016
Ok, I think I've convinced myself that the only really strange case here is SVGImage. There are loads from some other Page instances you might not always anticipate (plugin placeholders, workers, omnibox helpers). But AFAICT there aren't any actual bugs. See issue 236262 . |
||||
►
Sign in to add a comment |
||||
Comment 1 by bmcquade@chromium.org
, Jun 2 2016Owner: ----