-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core(network-recorder): consider iframe responses finished #6078
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,18 @@ class NetworkRecorder extends EventEmitter { | |
return !!(isQUIC && receivedHeaders && record.endTime); | ||
} | ||
|
||
/** | ||
* frame root network requests don't always "finish" even when they're done loading data, use responseReceived instead | ||
* @see https://github.com/GoogleChrome/lighthouse/issues/6067#issuecomment-423211201 | ||
* @param {LH.Artifacts.NetworkRequest} record | ||
* @return {boolean} | ||
*/ | ||
static _isFrameRootRequestAndFinished(record) { | ||
const isFrameRootRequest = record.url === record.documentURL; | ||
const responseReceived = record.responseReceivedTime > 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really hate trying to remember the difference between data-received/response-received/finished/etc (as well as where things like requestServedFromCache fall into things), but just to make sure I understand, typically There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct that is my understanding as well, data received can fire lots of times, but we always expect response received + one of loadingFinished/loadingFailed to signal the end of the request. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to consider preloads or won't this affect anything? I was thinking if a preloaded iframe was requested we might get endTime of 0. (not sure if people preload iframes) or it even counts when appending with javascript |
||
return !!(isFrameRootRequest && responseReceived && record.endTime); | ||
} | ||
|
||
/** | ||
* Finds all time periods where the number of inflight requests is less than or equal to the | ||
* number of allowed concurrent requests. | ||
|
@@ -119,7 +131,9 @@ class NetworkRecorder extends EventEmitter { | |
|
||
// convert the network record timestamp to ms | ||
timeBoundaries.push({time: record.startTime * 1000, isStart: true}); | ||
if (record.finished || NetworkRecorder._isQUICAndFinished(record)) { | ||
if (record.finished || | ||
NetworkRecorder._isQUICAndFinished(record) || | ||
NetworkRecorder._isFrameRootRequestAndFinished(record)) { | ||
timeBoundaries.push({time: record.endTime * 1000, isStart: false}); | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have to worry about query strings or anything else throwing this check off? (are these fields ever canonicalized through different paths, I guess I'm asking)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I could tell this is always the full query string-included URL. There were lots of samples on the verge that had misc query string params.