зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1867545 - Remove popup state propagation for link click event handler r=dom-core,edgar
Differential Revision: https://phabricator.services.mozilla.com/D203780
This commit is contained in:
Родитель
c26efe42f0
Коммит
eab0a3a5ea
|
@ -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<nsIContent> mContent;
|
||||
RefPtr<nsDocShellLoadState> mLoadState;
|
||||
nsCOMPtr<nsIPrincipal> 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) {}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[DEFAULT]
|
||||
|
||||
["test_popup_blocker_anchor_blank.html"]
|
|
@ -7,3 +7,7 @@
|
|||
MOCHITEST_MANIFESTS += [
|
||||
"mochitest.toml",
|
||||
]
|
||||
|
||||
MOCHITEST_CHROME_MANIFESTS += [
|
||||
"chrome.toml",
|
||||
]
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Popup blocker a target=_blank</title>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<button>click</button>
|
||||
<a target=_blank href="https://example.com">Link</a>
|
||||
<script>
|
||||
const {BrowserTestUtils} = ChromeUtils.importESModule(
|
||||
"resource://testing-common/BrowserTestUtils.sys.mjs"
|
||||
);
|
||||
const gBrowser = Services.wm.getMostRecentWindow("navigator:browser").gBrowser;
|
||||
|
||||
add_task(async function() {
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
let button = document.querySelector("button");
|
||||
|
||||
const promise = new Promise(resolve => {
|
||||
button.addEventListener("click", () => {
|
||||
document.querySelector("a").dispatchEvent(new MouseEvent("click", {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
view: window,
|
||||
}));
|
||||
|
||||
BrowserTestUtils.waitForNewTab(gBrowser, null, true).then(function(aNewTab) {
|
||||
ok(true, "A new tab was opened");
|
||||
BrowserTestUtils.removeTab(aNewTab);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
button.dispatchEvent(new MouseEvent("click", {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
view: window,
|
||||
}));
|
||||
|
||||
await promise;
|
||||
});
|
||||
</script>
|
||||
</body>
|
Загрузка…
Ссылка в новой задаче