Skip to content
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

Network.responseReceivedExtraInfo may be fired before or after responseReceived. #119

Closed
ifduyue opened this issue Jul 4, 2024 · 3 comments

Comments

@ifduyue
Copy link
Contributor

ifduyue commented Jul 4, 2024

From https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-responseReceivedExtraInfo

responseReceivedExtraInfo may be fired before or after responseReceived.

And reading code at

chrome-har/index.js

Lines 317 to 362 in 7a821bb

case 'Network.responseReceivedExtraInfo':
{
if (pages.length < 1) {
//we haven't loaded any pages yet.
continue;
}
if (ignoredRequests.has(params.requestId)) {
continue;
}
let entry = entries.find(
entry => entry._requestId === params.requestId
);
if (!entry) {
entry = entriesWithoutPage.find(
entry => entry._requestId === params.requestId
);
}
if (!entry) {
debug(
`Received response extra info for requestId ${
params.requestId
} with no matching request.`
);
continue;
}
if (!entry.response) {
// Extra info received before response
entry.extraResponseInfo = {
headers: parseHeaders(params.headers),
blockedCookies: params.blockedCookies
};
continue;
}
if (params.headers) {
entry.response.headers = entry.response.headers.concat(
parseHeaders(params.headers)
);
}
}
break;

Only responseReceivedExtraInfo fired after responseReceived was handled.

@ifduyue
Copy link
Contributor Author

ifduyue commented Jul 4, 2024

             if (params.headers) { 
               entry.response.headers = entry.response.headers.concat( 
                 parseHeaders(params.headers) 
               ); 
             } 

Also responseReceivedExtraInfo.headers and responseReceived.headers are almost identical, so here concat is a bug too?

@soulgalore
Copy link
Member

Hi @ifduyue ok cool. Do you have time to make PR to fix it or do you have an example trace where it's out of order, then we can setup a test case for it so we know it's fixed?

@ifduyue
Copy link
Contributor Author

ifduyue commented Jul 6, 2024

Hi @soulgalore, OK, I'll try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants