diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index e257d0dd19ff..486b23bc23ef 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9622,10 +9622,7 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState, // page is allowed to open them without abuse regardless of allowed // events if (PopupBlocker::GetPopupControlState() <= PopupBlocker::openBlocked) { - nsCOMPtr loadingNode = - mScriptGlobal->AsOuter()->GetFrameElementInternal(); - popupBlocked = !PopupBlocker::TryUsePopupOpeningToken( - loadingNode ? loadingNode->NodePrincipal() : nullptr); + popupBlocked = !PopupBlocker::TryUsePopupOpeningToken(); } else if (mIsActive && PopupBlocker::ConsumeTimerTokenForExternalProtocolIframe()) { popupBlocked = false; diff --git a/dom/base/PopupBlocker.cpp b/dom/base/PopupBlocker.cpp index 2ace5e685af6..36758ef661bf 100644 --- a/dom/base/PopupBlocker.cpp +++ b/dom/base/PopupBlocker.cpp @@ -136,7 +136,7 @@ bool PopupBlocker::CanShowPopupByPermission(nsIPrincipal* aPrincipal) { } /* static */ -bool PopupBlocker::TryUsePopupOpeningToken(nsIPrincipal* aPrincipal) { +bool PopupBlocker::TryUsePopupOpeningToken() { MOZ_ASSERT(sPopupStatePusherCount); if (!sUnusedPopupToken) { @@ -144,10 +144,6 @@ bool PopupBlocker::TryUsePopupOpeningToken(nsIPrincipal* aPrincipal) { return true; } - if (aPrincipal && nsContentUtils::IsSystemPrincipal(aPrincipal)) { - return true; - } - return false; } diff --git a/dom/base/PopupBlocker.h b/dom/base/PopupBlocker.h index 964c9982fcb8..4b410a3c770e 100644 --- a/dom/base/PopupBlocker.h +++ b/dom/base/PopupBlocker.h @@ -46,9 +46,7 @@ class PopupBlocker final { // This method returns true if the caller is allowed to show a popup, and it // consumes the popup token for the current event. There is just 1 popup // allowed per event. - // This method returns true if the token has been already consumed but - // aPrincipal is the system principal. - static bool TryUsePopupOpeningToken(nsIPrincipal* aPrincipal); + static bool TryUsePopupOpeningToken(); static bool IsPopupOpeningTokenUnused(); diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index fb641e24e4ba..a8f86e987842 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -5613,7 +5613,7 @@ PopupBlocker::PopupControlState nsGlobalWindowOuter::RevisePopupAbuseLevel( if ((abuse == PopupBlocker::openAllowed || abuse == PopupBlocker::openControlled) && StaticPrefs::dom_block_multiple_popups() && !PopupWhitelisted() && - !PopupBlocker::TryUsePopupOpeningToken(mDoc->NodePrincipal())) { + !PopupBlocker::TryUsePopupOpeningToken()) { abuse = PopupBlocker::openBlocked; } diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 554e3340f497..0a6942dc096c 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -654,7 +654,7 @@ bool HTMLInputElement::IsPopupBlocked() const { // Check if page can open a popup without abuse regardless of allowed events if (PopupBlocker::GetPopupControlState() <= PopupBlocker::openBlocked) { - return !PopupBlocker::TryUsePopupOpeningToken(OwnerDoc()->NodePrincipal()); + return !PopupBlocker::TryUsePopupOpeningToken(); } return !PopupBlocker::CanShowPopupByPermission(OwnerDoc()->NodePrincipal());