fix(close): actually mark the page as closing (#2798)

Currently double-closing flakiness is seen on Firefox bots.
This commit is contained in:
Dmitry Gozman 2020-07-01 16:05:56 -07:00 committed by GitHub
parent 5c4751d5dd
commit ff1fe3ac39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -480,6 +480,7 @@ export class Page extends EventEmitter {
return;
const runBeforeUnload = !!options && !!options.runBeforeUnload;
if (this._closedState !== 'closing') {
this._closedState = 'closing';
assert(!this._disconnected, 'Protocol error: Connection closed. Most likely the page has been closed.');
await this._delegate.closePage(runBeforeUnload);
}