navigate-to-sameorigin.html (1931B)
1 <!DOCTYPE html> 2 <title>User activation propagation across a same-origin navigation</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <script src="/resources/testdriver-actions.js"></script> 8 <script src="resources/utils.js"></script> 9 10 <body> 11 <p>Placeholder</p> 12 </body> 13 14 <script> 15 'use strict'; 16 17 let w; 18 document.body.onclick = () => { 19 w = window.open("resources/opened-window.html"); 20 }; 21 22 promise_test(async test => { 23 let window_opened_msg_promise = receiveMessage("window-opened"); 24 25 await test_driver.click(document.body); 26 assert_true(!!w, "A window is opened"); 27 28 { 29 let window_opened_data = await window_opened_msg_promise; 30 assert_false(window_opened_data.isActive, 31 "Transient activation after window opened"); 32 assert_false(window_opened_data.hasBeenActive, 33 "Sticky activation after window opened"); 34 } 35 36 let link_clicked_msg_promise = receiveMessage("link-clicked"); 37 let window_navigated_msg_promise = receiveMessage("window-navigated"); 38 39 const link = w.document.getElementById("link"); 40 await test_driver.click(link); 41 42 { 43 let link_clicked_data = await link_clicked_msg_promise; 44 assert_true(link_clicked_data.isActive, 45 "Transient activation after link clicked"); 46 assert_true(link_clicked_data.hasBeenActive, 47 "Sticky activation after link clicked"); 48 } 49 50 { 51 let window_navigated_data = await window_navigated_msg_promise; 52 assert_false(window_navigated_data.isActive, 53 "Transient activation after window navigated"); 54 assert_true(window_navigated_data.hasBeenActive, 55 "Sticky activation after window navigated"); 56 } 57 }, "User activation propagation across a same-origin navigation"); 58 </script>