mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: requestInterception should play nicely with canceled redirects (#1758)
Since interception events and `loadingFailed` events come from different processes and are not serialized, we might get `loadingFailed` event and a subsequent outdated `requestIntercepted`. Short-term, this patch stops assuming that interception events are aligned with `loadingFailed`. Long-term, this will be resolved as @caseq completes network servicification effort in chromium. Fixes #880.
This commit is contained in:
parent
f6b7c13316
commit
9634d13be2
@ -151,9 +151,10 @@ class NetworkManager extends EventEmitter {
|
||||
|
||||
if (event.redirectUrl) {
|
||||
const request = this._interceptionIdToRequest.get(event.interceptionId);
|
||||
console.assert(request, 'INTERNAL ERROR: failed to find request for interception redirect.');
|
||||
if (request) {
|
||||
this._handleRequestRedirect(request, event.responseStatusCode, event.responseHeaders);
|
||||
this._handleRequestStart(request._requestId, event.interceptionId, event.redirectUrl, event.resourceType, event.request, event.frameId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const requestHash = generateRequestHash(event.request);
|
||||
|
Loading…
Reference in New Issue
Block a user