'Limit memory of Webworker?
I couldn't find much on this so here I am;
I have a webworker inside an iframe, and while this provides me with a somewhat safe place to run untrusted scripts; A script could still be sucking up memory and cause the whole page to run out of memory.
The ideal solution would be to tell an iframe "You can't use more than x memory", but as far as I can tell, that just doesn't exist.
So I started thinking about the webworker and how one could limit the memory of a webworker.
I'm aware the NodeJS Worker API has options to limit the maximum memory a Worker can use. https://nodejs.org/api/worker_threads.html#worker_threads_new_worker_filename_options (resourceLimits)
And it seems that such options don't exist on the Web Worker for browsers.
So my question is: How could one achieve something similar? Is there a trick?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
