fix(chromium): avoid premature continue of redirects (#27520)
This has recently regressed in #27429. We now continue requests that are paused for the second time. However, redirects share `networkId` with the original request, so we may confuse paused redirect with a second pause for the original request. This is covered by the flaky test `page-route.spec.ts:392 > should work with redirects for subresources` References #27294.
This commit is contained in:
parent
fd6bf8aa2c
commit
2407041090
|
|
@ -208,13 +208,16 @@ export class CRNetworkManager {
|
||||||
} else {
|
} else {
|
||||||
const existingRequest = this._requestIdToRequest.get(requestId);
|
const existingRequest = this._requestIdToRequest.get(requestId);
|
||||||
const alreadyContinuedParams = existingRequest?._route?._alreadyContinuedParams;
|
const alreadyContinuedParams = existingRequest?._route?._alreadyContinuedParams;
|
||||||
if (alreadyContinuedParams) {
|
if (alreadyContinuedParams && !event.redirectedRequestId) {
|
||||||
// Sometimes Chromium network stack restarts the request internally.
|
// Sometimes Chromium network stack restarts the request internally.
|
||||||
// For example, when no-cors request hits a "less public address space", it should be resent with cors.
|
// For example, when no-cors request hits a "less public address space", it should be resent with cors.
|
||||||
// There are some more examples here: https://source.chromium.org/chromium/chromium/src/+/main:services/network/url_loader.cc;l=1205-1234;drc=d5dd931e0ad3d9ffe74888ec62a3cc106efd7ea6
|
// There are some more examples here: https://source.chromium.org/chromium/chromium/src/+/main:services/network/url_loader.cc;l=1205-1234;drc=d5dd931e0ad3d9ffe74888ec62a3cc106efd7ea6
|
||||||
// There are probably even more cases deep inside the network stack.
|
// There are probably even more cases deep inside the network stack.
|
||||||
//
|
//
|
||||||
// Anyway, in this case, continue the request in the same way as before, and it should go through.
|
// Anyway, in this case, continue the request in the same way as before, and it should go through.
|
||||||
|
//
|
||||||
|
// Note: make sure not to prematurely continue the redirect, which shares the
|
||||||
|
// `networkId` between the original request and the redirect.
|
||||||
this._session._sendMayFail('Fetch.continueRequest', {
|
this._session._sendMayFail('Fetch.continueRequest', {
|
||||||
...alreadyContinuedParams,
|
...alreadyContinuedParams,
|
||||||
requestId: event.requestId,
|
requestId: event.requestId,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue