Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>window.open() and consuming user activation</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
'use strict';
promise_test(async function(t) {
await test_driver.bless("user activation");
const testWin = window.open("/resources/blank.html", "_blank");
t.add_cleanup(() => {
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>