Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
browser(firefox): make sure response is sent when context is closed (#3553)
Yury Semikhatsky5ba0254c990d
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBERindex 03fb4e1920..b800a0ea81 100644--- a/browser_patches/firefox/BUILD_NUMBER+++ b/browser_patches/firefox/BUILD_NUMBER@@ -1,2 +1,2 @@-1164-Changed: [email protected] Thu Aug 20 10:30:04 PDT 2020+1165+Changed: [email protected] Thu Aug 20 13:05:37 PDT 2020diff --git a/browser_patches/firefox/juggler/TargetRegistry.js b/browser_patches/firefox/juggler/TargetRegistry.jsindex ff857eccbc..8f9c2b79d9 100644--- a/browser_patches/firefox/juggler/TargetRegistry.js+++ b/browser_patches/firefox/juggler/TargetRegistry.js@@ -134,7 +134,8 @@ class TargetRegistry {if (!target)return;target.emit('crashed');- this._destroyTarget(target).catch(e => dump(`Failed to destroy target: ${e}`));+ if (target)+ target.dispose().catch(e => dump(`Failed to destroy target: ${e}`));}}, 'oop-frameloader-crashed');@@ -202,7 +203,8 @@ class TargetRegistry {const tab = event.target;const linkedBrowser = tab.linkedBrowser;const target = this._browserToTarget.get(linkedBrowser);- this._destroyTarget(target).catch(e => dump(`Failed to destroy target: ${e}`));+ if (target)+ target.dispose().catch(e => dump(`Failed to destroy target: ${e}`));};Services.wm.addListener({@@ -240,16 +242,6 @@ class TargetRegistry {extHelperAppSvc.setDownloadInterceptor(new DownloadInterceptor(this));}- async _destroyTarget(target) {- if (!target)- return;- const event = { pendingActivity: [], target };- this.emit(TargetRegistry.Events.TargetWillBeDestroyed, event);- await Promise.all(event.pendingActivity);- target.dispose();- this.emit(TargetRegistry.Events.TargetDestroyed, target);- }-setBrowserProxy(proxy) {this._browserProxy = proxy;}@@ -468,12 +460,18 @@ class PageTarget {return await this._channel.connect('').send('hasFailedToOverrideTimezone').catch(e => true);}- dispose() {+ async dispose() {this._disposed = true;- this._browserContext.pages.delete(this);this._registry._browserToTarget.delete(this._linkedBrowser);this._registry._browserBrowsingContextToTarget.delete(this._linkedBrowser.browsingContext);helper.removeListeners(this._eventListeners);++ const event = { pendingActivity: [], target: this };+ this._registry.emit(TargetRegistry.Events.TargetWillBeDestroyed, event);+ await Promise.all(event.pendingActivity);++ this._browserContext.pages.delete(this);+ this._registry.emit(TargetRegistry.Events.TargetDestroyed, this);}}