shared-worker-fetch.js.py (536B)
1 body = b''' 2 'use strict'; 3 4 onconnect = (event) => { 5 const port = event.ports[0]; 6 7 port.onmessage = (event) => { 8 fetch(event.data, { mode: 'no-cors' }) 9 .then( 10 () => port.postMessage('success'), 11 () => port.postMessage('failure') 12 ); 13 }; 14 15 port.postMessage('ready'); 16 };''' 17 18 def main(request, response): 19 headers = [(b'Content-Type', b'text/javascript')] 20 21 for value in request.GET.get_list(b'value'): 22 headers.append((b'Document-Isolation-Policy', value)) 23 24 return (200, headers, body)