terminateSyncXHR_worker.js (466B)
1 /** 2 * Any copyright is dedicated to the Public Domain. 3 * http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 onmessage = function () { 7 throw new Error("No messages should reach me!"); 8 }; 9 10 var xhr = new XMLHttpRequest(); 11 xhr.open("GET", "worker_testXHR.txt", false); 12 xhr.addEventListener("loadstart", function () { 13 // Tell the parent to terminate us. 14 postMessage("TERMINATE"); 15 // And wait for it to do so. 16 while (1) { 17 true; 18 } 19 }); 20 xhr.send(null);