common.js (1496B)
1 const add_iframe_js = (iframe_origin, response_queue_uuid) => ` 2 const importScript = ${importScript}; 3 await importScript("/html/cross-origin-embedder-policy/credentialless" + 4 "/resources/common.js"); 5 await importScript("/html/anonymous-iframe/resources/common.js"); 6 await importScript("/common/utils.js"); 7 8 // dispatcher.js has already been loaded by the popup this is running in. 9 await send("${response_queue_uuid}", newIframe("${iframe_origin}")); 10 `; 11 12 async function create_test_iframes(t, response_queue_uuid) { 13 const same_site_origin = get_host_info().HTTPS_ORIGIN; 14 const cross_site_origin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN; 15 16 assert_equals("https://" + window.location.host, same_site_origin, 17 "this test assumes that the page's window.location.host corresponds to " + 18 "get_host_info().HTTPS_ORIGIN"); 19 20 // Create a same-origin iframe in a cross-site popup. 21 const not_same_site_popup_uuid = newPopup(t, cross_site_origin); 22 await send(not_same_site_popup_uuid, 23 add_iframe_js(same_site_origin, response_queue_uuid)); 24 const cross_site_iframe_uuid = await receive(response_queue_uuid); 25 26 // Create a same-origin iframe in a same-site popup. 27 const same_origin_popup_uuid = newPopup(t, same_site_origin); 28 await send(same_origin_popup_uuid, 29 add_iframe_js(same_site_origin, response_queue_uuid)); 30 const same_site_iframe_uuid = await receive(response_queue_uuid); 31 32 return [cross_site_iframe_uuid, same_site_iframe_uuid]; 33 }