refactor: remove unused promise (#7830)

This commit is contained in:
Ben Allfree 2021-12-09 06:35:23 -08:00 committed by GitHub
parent c03429444d
commit 71cc1b9591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 21 deletions

View File

@ -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;
};

View File

@ -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;
}