Created
December 25, 2017 09:39
-
-
Save kainino0x/1d8cee669637a5601b176c23c16547dd to your computer and use it in GitHub Desktop.
OffscreenCanvas DevTools crash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/plain" id="worker"> | |
onmessage = function(e) { | |
let ctx = e.data.getContext('2d'); | |
function loop() { | |
debugger; // When you hit this breakpoint, inspect any variable. | |
ctx.commit().then(loop); | |
} | |
ctx.commit().then(loop); | |
}; | |
</script> | |
<script> | |
let canvas = document.createElement('canvas'); | |
let offscreen = canvas.transferControlToOffscreen(); | |
let workerSource = document.getElementById('worker').innerText.trim(); | |
let blob = new Blob([workerSource], {type: 'application/javascript'}) | |
let url = URL.createObjectURL(blob); | |
let worker = new Worker(url); | |
worker.postMessage(offscreen, [offscreen]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment