Friday, 23 April 2021

Separate event-loop for same-origin CPU intensive iframe

Let's say I have a CPU intensive iframe.
It's on the same domain as the parent page, thus cross-origin does not apply, so it shares the parent's event-loop.

Is it possible to have a separate JS context (including a separate event-loop) for the iframe, such that it doesn't block the parent's UI?

Setting the sandbox attribute for the iframe tag doesn't solve this, although the docs state that the iframe will be considered to be from a 'unique origin'.

This question is hypothetical/conceptual. I don't have a real use-case for this. Just curious.
I was wandering how sites like JSFiddle run users' code, and apparantly it runs from an iframe from a different domain (jshell.net in JSFiddle's case).



from Separate event-loop for same-origin CPU intensive iframe

No comments:

Post a Comment