esm_url_worker.js (1620B)
1 /* eslint-env worker */ 2 3 onmessage = function (event) { 4 if (event.data != 0) { 5 var worker = new Worker("esm_url_worker.js"); 6 worker.onmessage = function (ev) { 7 postMessage(ev.data); 8 }; 9 10 worker.postMessage(event.data - 1); 11 return; 12 } 13 14 let status = false; 15 try { 16 if (URL instanceof Object) { 17 status = true; 18 } 19 } catch (e) {} 20 21 postMessage({ type: "status", status, msg: "URL object:" + URL }); 22 23 status = false; 24 var blob = null; 25 try { 26 blob = new Blob([]); 27 status = true; 28 } catch (e) {} 29 30 postMessage({ type: "status", status, msg: "Blob:" + blob }); 31 32 status = false; 33 var url = null; 34 try { 35 url = URL.createObjectURL(blob); 36 status = true; 37 } catch (e) {} 38 39 postMessage({ type: "status", status, msg: "Blob URL:" + url }); 40 41 status = false; 42 try { 43 URL.revokeObjectURL(url); 44 status = true; 45 } catch (e) {} 46 47 postMessage({ type: "status", status, msg: "Blob Revoke URL" }); 48 49 status = false; 50 url = null; 51 try { 52 url = URL.createObjectURL(true); 53 } catch (e) { 54 status = true; 55 } 56 57 postMessage({ 58 type: "status", 59 status, 60 msg: "CreateObjectURL should fail if the arg is not a blob", 61 }); 62 63 status = false; 64 url = null; 65 try { 66 url = URL.createObjectURL(blob); 67 status = true; 68 } catch (e) {} 69 70 postMessage({ type: "status", status, msg: "Blob URL2:" + url }); 71 72 status = false; 73 try { 74 URL.createObjectURL({}); 75 } catch (e) { 76 status = true; 77 } 78 79 postMessage({ type: "status", status, msg: "Exception wanted" }); 80 81 postMessage({ type: "url", url }); 82 83 postMessage({ type: "finish" }); 84 };