fix(chromium): abort fetch requests that lack networkId (#2254)
These requests are usually internal ones, and we can safely abort them. An example would be DevTools loading cached resources to show the content. There will never be a matching Network.requestWillBeSent event, so we do not report them to the user.
This commit is contained in:
parent
99b7aaace8
commit
4bf5742d47
|
|
@ -140,7 +140,17 @@ export class CRNetworkManager {
|
||||||
requestId: event.requestId
|
requestId: event.requestId
|
||||||
}).catch(logError(this._page));
|
}).catch(logError(this._page));
|
||||||
}
|
}
|
||||||
if (!event.networkId || event.request.url.startsWith('data:'))
|
if (!event.networkId) {
|
||||||
|
// Fetch without networkId means that request was not recongnized by inspector, and
|
||||||
|
// it will never receive Network.requestWillBeSent. Most likely, this is an internal request
|
||||||
|
// that we can safely fail.
|
||||||
|
this._client.send('Fetch.failRequest', {
|
||||||
|
requestId: event.requestId,
|
||||||
|
errorReason: 'Aborted',
|
||||||
|
}).catch(logError(this._page));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.request.url.startsWith('data:'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const requestId = event.networkId;
|
const requestId = event.networkId;
|
||||||
|
|
|
||||||
|
|
@ -215,8 +215,13 @@ export class FrameManager {
|
||||||
this._inflightRequestStarted(request);
|
this._inflightRequestStarted(request);
|
||||||
for (const task of request.frame()._frameTasks)
|
for (const task of request.frame()._frameTasks)
|
||||||
task.onRequest(request);
|
task.onRequest(request);
|
||||||
if (!request._isFavicon)
|
if (request._isFavicon) {
|
||||||
this._page._requestStarted(request);
|
const route = request._route();
|
||||||
|
if (route)
|
||||||
|
route.continue();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._page._requestStarted(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestReceivedResponse(response: network.Response) {
|
requestReceivedResponse(response: network.Response) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue