addmodule-window.html (784B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Worklet: Referrer</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="worklet-test-utils.js"></script> 8 </head> 9 <body> 10 <script> 11 // Calls addModule() on a given worklet type with a script url. 12 // 13 // [Message Format] 14 // - type: 'paint' (worklet types defined in get_worklet()) 15 // - script_url: 'worklet-script.js' 16 window.onmessage = e => { 17 const worklet_type = e.data.type; 18 const script_url = e.data.script_url; 19 get_worklet(worklet_type).addModule(script_url) 20 .then(() => window.opener.postMessage('RESOLVED', '*')) 21 .catch(e => window.opener.postMessage('REJECTED', '*')); 22 }; 23 24 window.opener.postMessage('LOADED', '*'); 25 </script> 26 </body> 27 </html>