mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
refactor: remove unused promise (#7830)
This commit is contained in:
parent
c03429444d
commit
71cc1b9591
@ -3,8 +3,6 @@ import { HTTPRequest } from './HTTPRequest.js';
|
||||
|
||||
export type QueuedEventGroup = {
|
||||
responseReceivedEvent: Protocol.Network.ResponseReceivedEvent;
|
||||
promise: Promise<void>;
|
||||
resolver: () => void;
|
||||
loadingFinishedEvent?: Protocol.Network.LoadingFinishedEvent;
|
||||
loadingFailedEvent?: Protocol.Network.LoadingFailedEvent;
|
||||
};
|
||||
|
@ -22,11 +22,7 @@ import { helper, debugError } from './helper.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { HTTPRequest } from './HTTPRequest.js';
|
||||
import { HTTPResponse } from './HTTPResponse.js';
|
||||
import {
|
||||
FetchRequestId,
|
||||
NetworkEventManager,
|
||||
NetworkRequestId,
|
||||
} from './NetworkEventManager.js';
|
||||
import { FetchRequestId, NetworkEventManager } from './NetworkEventManager.js';
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -480,12 +476,8 @@ export class NetworkManager extends EventEmitter {
|
||||
.shift();
|
||||
if (!extraInfo) {
|
||||
// Wait until we get the corresponding ExtraInfo event.
|
||||
let resolver = null;
|
||||
const promise = new Promise<void>((resolve) => (resolver = resolve));
|
||||
this._networkEventManager.queueEventGroup(event.requestId, {
|
||||
responseReceivedEvent: event,
|
||||
promise,
|
||||
resolver,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -493,15 +485,6 @@ export class NetworkManager extends EventEmitter {
|
||||
this._emitResponseEvent(event, extraInfo);
|
||||
}
|
||||
|
||||
responseWaitingForExtraInfoPromise(
|
||||
networkRequestId: NetworkRequestId
|
||||
): Promise<void> {
|
||||
const responseReceived =
|
||||
this._networkEventManager.getQueuedEventGroup(networkRequestId);
|
||||
if (!responseReceived) return Promise.resolve();
|
||||
return responseReceived.promise;
|
||||
}
|
||||
|
||||
_onResponseReceivedExtraInfo(
|
||||
event: Protocol.Network.ResponseReceivedExtraInfoEvent
|
||||
): void {
|
||||
@ -530,7 +513,6 @@ export class NetworkManager extends EventEmitter {
|
||||
if (queuedEvents.loadingFailedEvent) {
|
||||
this._emitLoadingFailed(queuedEvents.loadingFailedEvent);
|
||||
}
|
||||
queuedEvents.resolver();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user