mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
fix(webkit): swallow requests from detached frames (#6242)
This commit is contained in:
parent
fd4253991f
commit
6219042c74
@ -898,7 +898,12 @@ export class WKPage implements PageDelegate {
|
|||||||
redirectedFrom = request.request;
|
redirectedFrom = request.request;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const frame = this._page._frameManager.frame(event.frameId)!;
|
const frame = redirectedFrom ? redirectedFrom.frame() : this._page._frameManager.frame(event.frameId);
|
||||||
|
// sometimes we get stray network events for detached frames
|
||||||
|
// TODO(einbinder) why?
|
||||||
|
if (!frame)
|
||||||
|
return;
|
||||||
|
|
||||||
// TODO(einbinder) this will fail if we are an XHR document request
|
// TODO(einbinder) this will fail if we are an XHR document request
|
||||||
const isNavigationRequest = event.type === 'Document';
|
const isNavigationRequest = event.type === 'Document';
|
||||||
const documentId = isNavigationRequest ? event.loaderId : undefined;
|
const documentId = isNavigationRequest ? event.loaderId : undefined;
|
||||||
@ -919,8 +924,10 @@ export class WKPage implements PageDelegate {
|
|||||||
|
|
||||||
_onRequestIntercepted(event: Protocol.Network.requestInterceptedPayload) {
|
_onRequestIntercepted(event: Protocol.Network.requestInterceptedPayload) {
|
||||||
const request = this._requestIdToRequest.get(event.requestId);
|
const request = this._requestIdToRequest.get(event.requestId);
|
||||||
if (!request)
|
if (!request) {
|
||||||
|
this._session.sendMayFail('Network.interceptRequestWithError', {errorType: 'Cancellation', requestId: event.requestId});
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (!request._allowInterception) {
|
if (!request._allowInterception) {
|
||||||
// Intercepted, although we do not intend to allow interception.
|
// Intercepted, although we do not intend to allow interception.
|
||||||
// Just continue.
|
// Just continue.
|
||||||
|
Loading…
Reference in New Issue
Block a user