Skip to content

Commit

Permalink
Always consume user activation when opending a new window
Browse files Browse the repository at this point in the history
Per whatwg/html#10547, we should always consume the
user activation even if the popup blocker is disabled or the window has
permission to open a new window.

Differential Revision: https://phabricator.services.mozilla.com/D230331

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1930458
gecko-commit: a63ca42b209f7b7eb5d84a897d4f7a6efacbf98c
gecko-reviewers: smaug
  • Loading branch information
EdgarChen authored and moz-wptsync-bot committed Dec 4, 2024
1 parent 4d21424 commit b425579
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion html/browsers/windows/consume-user-activation/window-open.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,19 @@
testWin.close();
});
assert_false(navigator.userActivation.isActive, "User activation should be consumed");
});
}, "Opening a new window should consume user activation");

promise_test(async function(t) {
await test_driver.bless("user activation");
const testWin = window.open("/resources/blank.html", "testWindow");
assert_false(navigator.userActivation.isActive, "User activation should be consumed");
t.add_cleanup(() => {
testWin.close();
});

// Open the existing window again
await test_driver.bless("user activation");
const testWin2 = window.open("/resources/blank.html", "testWindow");
assert_true(navigator.userActivation.isActive, "User activation should not be consumed");
}, "Opening an existing window should not consume user activation");
</script>

0 comments on commit b425579

Please sign in to comment.