sitespeedio / chrome-har

Create HAR files from Chrome Debugging Protocol data
MIT License
148 stars 50 forks source link

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

Closed ifduyue closed 1 month ago

ifduyue commented 1 month ago

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

responseReceivedExtraInfo may be fired before or after responseReceived.

And reading code at https://github.com/sitespeedio/chrome-har/blob/7a821bbae0e22d54c5e47714b26cb220e5a0f69b/index.js#L317-L362

Only responseReceivedExtraInfo fired after responseReceived was handled.

ifduyue commented 1 month ago
             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 commented 1 month ago

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 commented 1 month ago

Hi @soulgalore, OK, I'll try