chore: remove graceful browser.close cleanup (#27916)

This commit is contained in:
Pavel Feldman 2023-11-01 20:17:10 -07:00 committed by GitHub
parent 817a130cdc
commit 0f2de59b7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions

View File

@ -240,13 +240,7 @@ export abstract class BrowserContext extends SdkObject {
// at the same time.
return;
}
const gotClosedGracefully = this._closedStatus === 'closing';
this._closedStatus = 'closed';
if (!gotClosedGracefully) {
this._deleteAllDownloads();
this._downloads.clear();
}
this.tracing.dispose().catch(() => {});
this.tracing.abort();
if (this._isPersistentContext)
this.onClosePersistent();
this._closePromiseFulfill!(new Error('Context closed'));
@ -422,7 +416,7 @@ export abstract class BrowserContext extends SdkObject {
for (const harRecorder of this._harRecorders.values())
await harRecorder.flush();
await this.tracing.dispose();
await this.tracing.flush();
// Cleanup.
const promises: Promise<void>[] = [];

View File

@ -551,7 +551,7 @@ export class GlobalAPIRequestContext extends APIRequestContext {
}
override async dispose() {
await this._tracing.dispose();
await this._tracing.flush();
await this._tracing.deleteTmpTracesDir();
this._disposeImpl();
}

View File

@ -249,9 +249,13 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
return this._tracesTmpDir;
}
async dispose() {
abort() {
this._snapshotter?.dispose();
this._harTracer.stop();
}
async flush() {
this.abort();
await this._fs.syncAndGetError();
}