1
0
Fork 0
firefox/testing/web-platform/tests/fetch/fetch-later/iframe.tentative.https.window.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

31 lines
843 B
JavaScript

// META: script=/common/utils.js
// META: script=/common/get-host-info.sub.js
// META: script=/fetch/fetch-later/resources/fetch-later-helper.js
'use strict';
const {
HTTPS_ORIGIN,
HTTPS_NOTSAMESITE_ORIGIN,
} = get_host_info();
async function loadElement(el) {
const loaded = new Promise(resolve => el.onload = resolve);
document.body.appendChild(el);
await loaded;
}
parallelPromiseTest(async t => {
const uuid = token();
const url = generateSetBeaconURL(uuid);
// Loads a blank iframe that fires a fetchLater request.
const iframe = document.createElement('iframe');
iframe.addEventListener('load', () => {
fetchLater(url, {activateAfter: 0});
});
await loadElement(iframe);
// The iframe should have sent the request.
await expectBeacon(uuid, {count: 1});
}, 'A blank iframe can trigger fetchLater.');