Skip to content

Commit

Permalink
Window onerror is not triggered bug fix
Browse files Browse the repository at this point in the history
As pointed out in the bug, unhandled errors on worker threads were not
properly being propagated for the parent thread to handle as the spec
requires (https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2).
This fix adds in the code to do that.

Bug: 685303
Change-Id: Ie3e7ec03153a43efdc6e70b874d6b1a1d8ac35ef
  • Loading branch information
kjd564 authored and chromium-wpt-export-bot committed Oct 24, 2018
1 parent 09a1d43 commit b937a71
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion workers/modules/resources/new-worker-window.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
window.onmessage = e => {
worker = new Worker(e.data, { type: 'module' });
worker.onmessage = msg => window.opener.postMessage(msg.data, '*');
worker.onerror = err => window.opener.postMessage(['ERROR'], '*');
worker.onerror = function(err) {
window.opener.postMessage(['ERROR'], '*');
err.preventDefault();
};
};
window.opener.postMessage('LOADED', '*');
</script>

0 comments on commit b937a71

Please sign in to comment.