fix(close): allow errors when closing all pages of a context (#4324)
This commit is contained in:
parent
3da1f73f1d
commit
31bebc7ea0
|
|
@ -409,7 +409,9 @@ export class Page extends EventEmitter {
|
||||||
if (this._closedState !== 'closing') {
|
if (this._closedState !== 'closing') {
|
||||||
this._closedState = 'closing';
|
this._closedState = 'closing';
|
||||||
assert(!this._disconnected, 'Protocol error: Connection closed. Most likely the page has been closed.');
|
assert(!this._disconnected, 'Protocol error: Connection closed. Most likely the page has been closed.');
|
||||||
await this._delegate.closePage(runBeforeUnload);
|
// This might throw if the browser context containing the page closes
|
||||||
|
// while we are trying to close the page.
|
||||||
|
await this._delegate.closePage(runBeforeUnload).catch(e => debugLogger.log('error', e));
|
||||||
}
|
}
|
||||||
if (!runBeforeUnload)
|
if (!runBeforeUnload)
|
||||||
await this._closedPromise;
|
await this._closedPromise;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue