D
Deno

help

console.log in a worker - capture or hide output?

Bbenjamn8/8/2023
Running under deno repl with no permissions, this prints 'yee'. In a browser's dev tools it would do the same thing, except there is a drop down to select which process's consoles to view, defaulted to showing all.
new Worker(URL.createObjectURL(new Blob(['console.log("yee")'], {type: 'text/javascript'})), {type: 'module'})
new Worker(URL.createObjectURL(new Blob(['console.log("yee")'], {type: 'text/javascript'})), {type: 'module'})
Is there a way to control what shows up on console? Is overwriting console a solid approach? Also wonder if there is anything else like this, where a worker has access to something shared with the parent not covered by the permissions. I see confirm is not defined in a worker, which is good.

Looking for more? Join the community!