feat(socket): destroy contexts upon disconnect (#1119)
This commit is contained in:
parent
72fa945689
commit
3afaeef557
|
|
@ -68,7 +68,7 @@ export class CRBrowser extends platform.EventEmitter implements Browser {
|
||||||
|
|
||||||
async newContext(options: BrowserContextOptions = {}): Promise<BrowserContext> {
|
async newContext(options: BrowserContextOptions = {}): Promise<BrowserContext> {
|
||||||
options = validateBrowserContextOptions(options);
|
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);
|
const context = new CRBrowserContext(this, browserContextId, options);
|
||||||
await context._initialize();
|
await context._initialize();
|
||||||
this._contexts.set(browserContextId, context);
|
this._contexts.set(browserContextId, context);
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ export class FFBrowser extends platform.EventEmitter implements Browser {
|
||||||
bypassCSP: options.bypassCSP,
|
bypassCSP: options.bypassCSP,
|
||||||
javaScriptDisabled: options.javaScriptEnabled === false ? true : undefined,
|
javaScriptDisabled: options.javaScriptEnabled === false ? true : undefined,
|
||||||
viewport,
|
viewport,
|
||||||
|
removeOnDetach: true
|
||||||
});
|
});
|
||||||
// TODO: move ignoreHTTPSErrors to browser context level.
|
// TODO: move ignoreHTTPSErrors to browser context level.
|
||||||
if (options.ignoreHTTPSErrors)
|
if (options.ignoreHTTPSErrors)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue