DescriptionFix bug where Navigation Timing reports negative load time when redirecting to
a cached page.
The problem is that the same ResourceLoadTiming struct is re-used for each
redirect. So, we record the deltas for connect time, headers, send request, etc.,
for each redirect. But, after the last redirect, we simply have a cache hit. So,
the base_time is updated for that cache hit, but the deltas are still relative
to the old base_time value. When we apply the old deltas to the new base_time,
we end up with a time in the future.
To fix this, I clear ResourceLoadTimingInfo after each redirect.
I've added a UI test for this. I could've done a unit test, but we have no end-
to-end Navigation Timing tests and it'd be easy for this to be broken by some
unrelated change to NetLog and redirects, so I prefer having this test be a
safe guard.
On a related note, I noticed that LoadTimingObserver::OnAddURLRequestEntry() is
called at least twice for each source.id. Once for the normal URLRequest, and
once for the AppCacheURLRequest. Fortunately, they're only 100 ns apart, so it
doesn't screw up the times. But, it was a surprise to me. Perhaps we should
ignore the AppCache requests?
BUG=None
TEST=ui_tests
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=107604
Patch Set 1 #Patch Set 2 : Fix Win build #
Messages
Total messages: 9 (0 generated)
|