Calling postMessage in Web Worker onmessage callback throws SYNTAX_ERR: DOM Exception 12-Collection of common programming errors
When writing the onmessage callback for a Web Worker I get an “Uncaught Error: SYNTAX_ERR: DOM Exception 12” in my console when I try to send another postMessage().
var w = new Worker(url);
w.onmessage = function(e) {
if(e.data.msg=='validate'){
if(validateWork(e.data.wrk)){
postMessage('proceed');
}
}
}