From eab0a3a5ea3414f9357eebe6a5a6464aadf8db06 Mon Sep 17 00:00:00 2001 From: Oliver Medhurst Date: Wed, 29 May 2024 12:03:45 +0000 Subject: [PATCH] Bug 1867545 - Remove popup state propagation for link click event handler r=dom-core,edgar Differential Revision: https://phabricator.services.mozilla.com/D203780 --- docshell/base/nsDocShell.cpp | 4 -- dom/base/test/useractivation/chrome.toml | 3 ++ dom/base/test/useractivation/moz.build | 4 ++ .../test_popup_blocker_anchor_blank.html | 47 +++++++++++++++++++ 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 dom/base/test/useractivation/chrome.toml create mode 100644 dom/base/test/useractivation/test_popup_blocker_anchor_blank.html diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index c1719a602f1c..6c32c85d85cf 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -12683,8 +12683,6 @@ class OnLinkClickEvent : public Runnable { bool aIsTrusted, nsIPrincipal* aTriggeringPrincipal); NS_IMETHOD Run() override { - AutoPopupStatePusher popupStatePusher(mPopupState); - // We need to set up an AutoJSAPI here for the following reason: When we // do OnLinkClickSync we'll eventually end up in // nsGlobalWindow::OpenInternal which only does popup blocking if @@ -12704,7 +12702,6 @@ class OnLinkClickEvent : public Runnable { nsCOMPtr mContent; RefPtr mLoadState; nsCOMPtr mTriggeringPrincipal; - PopupBlocker::PopupControlState mPopupState; bool mNoOpenerImplied; bool mIsTrusted; }; @@ -12718,7 +12715,6 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler, nsIContent* aContent, mContent(aContent), mLoadState(aLoadState), mTriggeringPrincipal(aTriggeringPrincipal), - mPopupState(PopupBlocker::GetPopupControlState()), mNoOpenerImplied(aNoOpenerImplied), mIsTrusted(aIsTrusted) {} diff --git a/dom/base/test/useractivation/chrome.toml b/dom/base/test/useractivation/chrome.toml new file mode 100644 index 000000000000..ce27a72b655b --- /dev/null +++ b/dom/base/test/useractivation/chrome.toml @@ -0,0 +1,3 @@ +[DEFAULT] + +["test_popup_blocker_anchor_blank.html"] diff --git a/dom/base/test/useractivation/moz.build b/dom/base/test/useractivation/moz.build index 3ef5d9c8cd14..d8b7f8909498 100644 --- a/dom/base/test/useractivation/moz.build +++ b/dom/base/test/useractivation/moz.build @@ -7,3 +7,7 @@ MOCHITEST_MANIFESTS += [ "mochitest.toml", ] + +MOCHITEST_CHROME_MANIFESTS += [ + "chrome.toml", +] diff --git a/dom/base/test/useractivation/test_popup_blocker_anchor_blank.html b/dom/base/test/useractivation/test_popup_blocker_anchor_blank.html new file mode 100644 index 000000000000..f3fa63ecc041 --- /dev/null +++ b/dom/base/test/useractivation/test_popup_blocker_anchor_blank.html @@ -0,0 +1,47 @@ + + + + +Popup blocker a target=_blank + + + + + +Link + +