chore: fix BiDi redirects (#10929)
This commit is contained in:
parent
04384aeaec
commit
825dd17d2a
@ -93,12 +93,10 @@ export class BidiNetworkManager extends EventEmitter<BidiNetworkManagerEvents> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const request = this.#requestMap.get(event.request.request);
|
const request = this.#requestMap.get(event.request.request);
|
||||||
|
|
||||||
let upsertRequest: BidiHTTPRequest;
|
let upsertRequest: BidiHTTPRequest;
|
||||||
if (request) {
|
if (request) {
|
||||||
const requestChain = request._redirectChain;
|
request._redirectChain.push(request);
|
||||||
|
upsertRequest = new BidiHTTPRequest(event, frame, request._redirectChain);
|
||||||
upsertRequest = new BidiHTTPRequest(event, frame, requestChain);
|
|
||||||
} else {
|
} else {
|
||||||
upsertRequest = new BidiHTTPRequest(event, frame, []);
|
upsertRequest = new BidiHTTPRequest(event, frame, []);
|
||||||
}
|
}
|
||||||
@ -123,7 +121,6 @@ export class BidiNetworkManager extends EventEmitter<BidiNetworkManagerEvents> {
|
|||||||
}
|
}
|
||||||
this.emit(NetworkManagerEvent.Response, response);
|
this.emit(NetworkManagerEvent.Response, response);
|
||||||
this.emit(NetworkManagerEvent.RequestFinished, request);
|
this.emit(NetworkManagerEvent.RequestFinished, request);
|
||||||
this.#requestMap.delete(event.request.request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#onFetchError(event: Bidi.Network.FetchErrorParameters) {
|
#onFetchError(event: Bidi.Network.FetchErrorParameters) {
|
||||||
|
@ -37,12 +37,7 @@ import {assert} from '../util/assert.js';
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export class CdpHTTPRequest extends HTTPRequest {
|
export class CdpHTTPRequest extends HTTPRequest {
|
||||||
override _requestId: string;
|
declare _redirectChain: CdpHTTPRequest[];
|
||||||
override _interceptionId: string | undefined;
|
|
||||||
override _failureText: string | null = null;
|
|
||||||
override _response: HTTPResponse | null = null;
|
|
||||||
override _fromMemoryCache = false;
|
|
||||||
override _redirectChain: CdpHTTPRequest[];
|
|
||||||
|
|
||||||
#client: CDPSession;
|
#client: CDPSession;
|
||||||
#isNavigationRequest: boolean;
|
#isNavigationRequest: boolean;
|
||||||
|
@ -57,7 +57,7 @@ export class CdpHTTPResponse extends HTTPResponse {
|
|||||||
port: responsePayload.remotePort,
|
port: responsePayload.remotePort,
|
||||||
};
|
};
|
||||||
this.#statusText =
|
this.#statusText =
|
||||||
this.#parseStatusTextFromExtrInfo(extraInfo) ||
|
this.#parseStatusTextFromExtraInfo(extraInfo) ||
|
||||||
responsePayload.statusText;
|
responsePayload.statusText;
|
||||||
this.#url = request.url();
|
this.#url = request.url();
|
||||||
this.#fromDiskCache = !!responsePayload.fromDiskCache;
|
this.#fromDiskCache = !!responsePayload.fromDiskCache;
|
||||||
@ -75,7 +75,7 @@ export class CdpHTTPResponse extends HTTPResponse {
|
|||||||
this.#timing = responsePayload.timing || null;
|
this.#timing = responsePayload.timing || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#parseStatusTextFromExtrInfo(
|
#parseStatusTextFromExtraInfo(
|
||||||
extraInfo: Protocol.Network.ResponseReceivedExtraInfoEvent | null
|
extraInfo: Protocol.Network.ResponseReceivedExtraInfoEvent | null
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
if (!extraInfo || !extraInfo.headersText) {
|
if (!extraInfo || !extraInfo.headersText) {
|
||||||
|
@ -2597,12 +2597,6 @@
|
|||||||
"parameters": ["chrome", "webDriverBiDi"],
|
"parameters": ["chrome", "webDriverBiDi"],
|
||||||
"expectations": ["PASS"]
|
"expectations": ["PASS"]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"testIdPattern": "[navigation.spec] navigation Page.goto should return last response in redirect chain",
|
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
|
||||||
"parameters": ["firefox", "webDriverBiDi"],
|
|
||||||
"expectations": ["FAIL"]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"testIdPattern": "[navigation.spec] navigation Page.goto should return response when page changes its URL after load",
|
"testIdPattern": "[navigation.spec] navigation Page.goto should return response when page changes its URL after load",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
Loading…
Reference in New Issue
Block a user