Skip to content

Commit

Permalink
Network.responseReceivedExtraInfo may be fired before or after respon…
Browse files Browse the repository at this point in the history
…seReceived

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

    responseReceivedExtraInfo may be fired before or after responseReceived.
  • Loading branch information
ifduyue committed Jul 11, 2024
1 parent e1b7c6c commit 2f28ddf
Show file tree
Hide file tree
Showing 3 changed files with 77,039 additions and 8 deletions.
17 changes: 9 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ module.exports = {
entriesWithoutPage = [],
responsesWithoutPage = [],
paramsWithoutPage = [],
responseReceivedExtraInfos = [],
currentPageId;

for (const message of messages) {
Expand Down Expand Up @@ -336,11 +337,7 @@ module.exports = {
}

if (!entry) {
debug(
`Received response extra info for requestId ${
params.requestId
} with no matching request.`
);
responseReceivedExtraInfos.push(params);
continue;
}

Expand All @@ -350,13 +347,12 @@ module.exports = {
headers: parseHeaders(params.headers),
blockedCookies: params.blockedCookies
};
responseReceivedExtraInfos.push(params);
continue;
}

if (params.headers) {
entry.response.headers = entry.response.headers.concat(
parseHeaders(params.headers)
);
entry.response.headers = parseHeaders(params.headers);
}
}
break;
Expand Down Expand Up @@ -418,6 +414,11 @@ module.exports = {
);
throw e;
}

const responseReceivedExtraInfo = responseReceivedExtraInfos.find(responseReceivedExtraInfo => responseReceivedExtraInfo.requestId == params.requestId);

Check failure on line 418 in index.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `responseReceivedExtraInfo·=>·responseReceivedExtraInfo.requestId·==·params.requestId` with `⏎··············responseReceivedExtraInfo·=>⏎················responseReceivedExtraInfo.requestId·==·params.requestId⏎············`

Check failure on line 418 in index.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `responseReceivedExtraInfo·=>·responseReceivedExtraInfo.requestId·==·params.requestId` with `⏎··············responseReceivedExtraInfo·=>⏎················responseReceivedExtraInfo.requestId·==·params.requestId⏎············`

Check failure on line 418 in index.js

View workflow job for this annotation

GitHub Actions / build (22.x)

Replace `responseReceivedExtraInfo·=>·responseReceivedExtraInfo.requestId·==·params.requestId` with `⏎··············responseReceivedExtraInfo·=>⏎················responseReceivedExtraInfo.requestId·==·params.requestId⏎············`
if (responseReceivedExtraInfo && responseReceivedExtraInfo.headers) {

Check failure on line 419 in index.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `responseReceivedExtraInfo·&&·responseReceivedExtraInfo.headers` with `⏎··············responseReceivedExtraInfo·&&⏎··············responseReceivedExtraInfo.headers⏎············`

Check failure on line 419 in index.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `responseReceivedExtraInfo·&&·responseReceivedExtraInfo.headers` with `⏎··············responseReceivedExtraInfo·&&⏎··············responseReceivedExtraInfo.headers⏎············`

Check failure on line 419 in index.js

View workflow job for this annotation

GitHub Actions / build (22.x)

Replace `responseReceivedExtraInfo·&&·responseReceivedExtraInfo.headers` with `⏎··············responseReceivedExtraInfo·&&⏎··············responseReceivedExtraInfo.headers⏎············`
entry.response.headers = parseHeaders(responseReceivedExtraInfo.headers);

Check failure on line 420 in index.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `responseReceivedExtraInfo.headers` with `⏎················responseReceivedExtraInfo.headers⏎··············`

Check failure on line 420 in index.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `responseReceivedExtraInfo.headers` with `⏎················responseReceivedExtraInfo.headers⏎··············`

Check failure on line 420 in index.js

View workflow job for this annotation

GitHub Actions / build (22.x)

Replace `responseReceivedExtraInfo.headers` with `⏎················responseReceivedExtraInfo.headers⏎··············`
}
}
break;

Expand Down
Loading

0 comments on commit 2f28ddf

Please sign in to comment.