feat(socket): destroy contexts upon disconnect (#1119)

This commit is contained in:
Pavel Feldman 2020-02-26 11:01:01 -08:00 committed by GitHub
parent 72fa945689
commit 3afaeef557
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -68,7 +68,7 @@ export class CRBrowser extends platform.EventEmitter implements Browser {
async newContext(options: BrowserContextOptions = {}): Promise<BrowserContext> {
options = validateBrowserContextOptions(options);
const { browserContextId } = await this._client.send('Target.createBrowserContext');
const { browserContextId } = await this._client.send('Target.createBrowserContext', { disposeOnDetach: true });
const context = new CRBrowserContext(this, browserContextId, options);
await context._initialize();
this._contexts.set(browserContextId, context);

View file

@ -90,6 +90,7 @@ export class FFBrowser extends platform.EventEmitter implements Browser {
bypassCSP: options.bypassCSP,
javaScriptDisabled: options.javaScriptEnabled === false ? true : undefined,
viewport,
removeOnDetach: true
});
// TODO: move ignoreHTTPSErrors to browser context level.
if (options.ignoreHTTPSErrors)