Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(firefox): set opener for popup opened from iframe (#9837)

Yury Semikhatsky7560f40c7739
diff --git a/browser_patches/firefox-beta/BUILD_NUMBER b/browser_patches/firefox-beta/BUILD_NUMBER
index aebcbfe0e6..59dad47440 100644
--- a/browser_patches/firefox-beta/BUILD_NUMBER
+++ b/browser_patches/firefox-beta/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1299
-Changed: [email protected] Wed 27 Oct 2021 12:40:16 AM PDT
+1300
+Changed: [email protected] Wed Oct 27 17:58:07 PDT 2021
diff --git a/browser_patches/firefox-beta/juggler/TargetRegistry.js b/browser_patches/firefox-beta/juggler/TargetRegistry.js
index d8f5dbbc89..a0b470c71d 100644
--- a/browser_patches/firefox-beta/juggler/TargetRegistry.js
+++ b/browser_patches/firefox-beta/juggler/TargetRegistry.js
@@ -159,8 +159,9 @@ class TargetRegistry {
const openerContext = tab.linkedBrowser.browsingContext.opener;
let openerTarget;
if (openerContext) {
- // Popups usually have opener context.
- openerTarget = this._browserBrowsingContextToTarget.get(openerContext);
+ // Popups usually have opener context. Get top context for the case when opener is
+ // an iframe.
+ openerTarget = this._browserBrowsingContextToTarget.get(openerContext.top);
} else if (tab.openerTab) {
// Noopener popups from the same window have opener tab instead.
openerTarget = this._browserToTarget.get(tab.openerTab.linkedBrowser);
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER
index cee08010e5..6b399055af 100644
--- a/browser_patches/firefox/BUILD_NUMBER
+++ b/browser_patches/firefox/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1297
-Changed: [email protected] Fri Oct 15 18:51:16 PDT 2021
+1298
+Changed: [email protected] Wed Oct 27 17:58:07 PDT 2021
diff --git a/browser_patches/firefox/juggler/TargetRegistry.js b/browser_patches/firefox/juggler/TargetRegistry.js
index d8f5dbbc89..a0b470c71d 100644
--- a/browser_patches/firefox/juggler/TargetRegistry.js
+++ b/browser_patches/firefox/juggler/TargetRegistry.js
@@ -159,8 +159,9 @@ class TargetRegistry {
const openerContext = tab.linkedBrowser.browsingContext.opener;
let openerTarget;
if (openerContext) {
- // Popups usually have opener context.
- openerTarget = this._browserBrowsingContextToTarget.get(openerContext);
+ // Popups usually have opener context. Get top context for the case when opener is
+ // an iframe.
+ openerTarget = this._browserBrowsingContextToTarget.get(openerContext.top);
} else if (tab.openerTab) {
// Noopener popups from the same window have opener tab instead.
openerTarget = this._browserToTarget.get(tab.openerTab.linkedBrowser);