beacon-navigate.https.window.js (777B)
1 // META: timeout=long 2 // META: script=/common/utils.js 3 // META: script=/common/get-host-info.sub.js 4 // META: script=beacon-common.sub.js 5 6 'use strict'; 7 8 const {HTTP_REMOTE_ORIGIN} = get_host_info(); 9 10 for (const type of [STRING, ARRAYBUFFER, FORM, BLOB]) { 11 parallelPromiseTest(async (t) => { 12 const iframe = document.createElement('iframe'); 13 document.body.appendChild(iframe); 14 t.add_cleanup(() => iframe.remove()); 15 16 const payload = makePayload(SMALL, type); 17 const id = token(); 18 const url = `/beacon/resources/beacon.py?cmd=store&id=${id}`; 19 assert_true(iframe.contentWindow.navigator.sendBeacon(url, payload)); 20 21 iframe.src = `${HTTP_REMOTE_ORIGIN}/common/blank.html`; 22 }, `The frame navigates away after calling sendBeacon[type = ${type}].`); 23 }