sources.html (1939B)
1 <!-- Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ --> 3 <!doctype HTML> 4 <html> 5 <head> 6 <meta charset="utf-8"/> 7 </head> 8 <body> 9 <!-- introductionType=eventHandler --> 10 <div onclick="console.log('link')">link</div> 11 12 <!-- introductionType=inlineScript mapped to scriptElement --> 13 <script type="text/javascript"> 14 "use strict"; 15 /* eslint-disable */ 16 function inlineSource() {} 17 18 // introductionType=eval 19 // Assign it to a global in order to avoid it being GCed 20 eval("this.global = function evalFunction() {}"); 21 22 // introductionType=Function 23 // Also assign to a global to avoid being GCed 24 this.global2 = new Function("return 42;"); 25 26 // introductionType=injectedScript mapped to scriptElement 27 const script = document.createElement("script"); 28 script.textContent = "console.log('inline-script')"; 29 document.documentElement.appendChild(script); 30 31 // introductionType=Worker, but ends up being null on SourceActor's form 32 // Assign the worker to a global variable in order to avoid 33 // having it be GCed. 34 this.worker = new Worker("worker-sources.js"); 35 36 window.registrationPromise = navigator.serviceWorker.register("service-worker-sources.js"); 37 38 // introductionType=domTimer 39 setTimeout(`console.log("timeout")`, 0); 40 41 // introductionType=eventHandler 42 window.addEventListener("DOMContentLoaded", () => { 43 document.querySelector("div[onclick]").click(); 44 }); 45 </script> 46 <!-- introductionType=srcScript mapped to scriptElement --> 47 <script src="sources.js"></script> 48 <!-- introductionType=javascriptURL --> 49 <iframe src="javascript:'666'"></iframe> 50 <!-- srcdoc attribute on iframes --> 51 <iframe srcdoc="<script>console.log('srcdoc')</script> <script>console.log('srcdoc 2')</script>"></iframe> 52 </body> 53 </html>