iframe-topics-attribute-insecure-context.tentative.http.sub.html (1458B)
1 <!doctype html> 2 <body> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script src=/browsing-topics/resources/header-util.sub.js></script> 6 <script> 7 async_test(t => { 8 test_topics_iframe_navigation_header( 9 t, /*has_browsing_topics_attribute=*/true, /*is_same_origin=*/false, 10 expect_topics_header_unavailable); 11 }, 'test <iframe browsingtopics src=[url]></iframe> in an insecure context, where the browsingtopics attribute is set via IDL.'); 12 13 async_test(t => { 14 const same_origin_src = '/browsing-topics/resources/check-topics-request-header-notify-parent.py'; 15 const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' + 16 same_origin_src; 17 18 let frame = document.createElement('iframe'); 19 20 window.addEventListener('message', t.step_func(function handler(evt) { 21 if (evt.source === frame.contentWindow) { 22 assert_equals(evt.data.topicsHeader, 'NO_TOPICS_HEADER'); 23 24 document.body.removeChild(frame); 25 window.removeEventListener('message', handler); 26 t.done(); 27 } 28 })); 29 30 document.body.appendChild(frame); 31 32 frame.setAttribute("browsingtopics", "123"); 33 frame.src = cross_origin_src; 34 }, 'test <iframe browsingtopics src=[url]></iframe> in an insecure context, where the browsingtopics attribute is set via setAttribute().'); 35 </script> 36 </body>