warning_reporter_worklet.js (506B)
1 let caught = false; 2 try { 3 // This reports: 4 // * a warning for the unreachable code 5 // * an error for a garbage after the function body 6 new Function("return 0; 1;}"); 7 } catch (e) { 8 caught = true; 9 } 10 11 class WarningWorkletProcessor extends AudioWorkletProcessor { 12 constructor(...args) { 13 super(...args); 14 this.port.postMessage({ type: "finish", caught }); 15 } 16 17 process() { 18 // Do nothing, output silence 19 return true; 20 } 21 } 22 23 registerProcessor("warning", WarningWorkletProcessor);