fix(webkit): emit close on pages before clearing them (#1386)

This commit is contained in:
Dmitry Gozman 2020-03-13 14:43:49 -07:00 committed by GitHub
parent 69be12ae12
commit a96dec58c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,9 +68,10 @@ export class WKBrowser extends platform.EventEmitter implements Browser {
_onDisconnect() {
for (const wkPage of this._wkPages.values())
wkPage.dispose();
this._wkPages.clear();
for (const context of this._contexts.values())
context._browserClosed();
// Note: previous method uses pages to issue 'close' event on them, so we clear them after.
this._wkPages.clear();
this.emit(Events.Browser.Disconnected);
}