iframe.https.window.js (843B)
1 // META: script=/common/utils.js 2 // META: script=/common/get-host-info.sub.js 3 // META: script=/fetch/fetch-later/resources/fetch-later-helper.js 4 5 'use strict'; 6 7 const { 8 HTTPS_ORIGIN, 9 HTTPS_NOTSAMESITE_ORIGIN, 10 } = get_host_info(); 11 12 async function loadElement(el) { 13 const loaded = new Promise(resolve => el.onload = resolve); 14 document.body.appendChild(el); 15 await loaded; 16 } 17 18 parallelPromiseTest(async t => { 19 const uuid = token(); 20 const url = generateSetBeaconURL(uuid); 21 22 // Loads a blank iframe that fires a fetchLater request. 23 const iframe = document.createElement('iframe'); 24 iframe.addEventListener('load', () => { 25 fetchLater(url, {activateAfter: 0}); 26 }); 27 await loadElement(iframe); 28 29 // The iframe should have sent the request. 30 await expectBeacon(uuid, {count: 1}); 31 }, 'A blank iframe can trigger fetchLater.');