Opening this issue to keep track of possible solutions. Currently there is a problem that if a template contains javascript that blocks infinitely the whole application will freeze and needs a restart. Examples would be:
<script>
while(true) {}
// or
for (let i = 0; true; i++) { }
// or
for (let i = 0; i < 100; i) { }
// and so on...
</script>
Rendered templates will be previewed in iframes and because this iframe is from the same origin it will be run in the same thread as the rest of the applications. That results in the problem when the iframe content blocks the whole application blocks.
Solution 1
Force iframe to be on separate thread. This doesn't seem to work at the moment, as I need the iframe to have the allow-same-origin option which seems to prevent iframes from running in their own thread even if the sandbox option is used.
Solution 2
I tried to switch to the webview tag. This also doesn't seem to be working. In theory the webview sounds perfect, but there is a issue that makes it apparently impossible to directly load arbitrary HTML into it and have the contained scripts run. The HTML will show fine but no scripts are working.
Opening this issue to keep track of possible solutions. Currently there is a problem that if a template contains javascript that blocks infinitely the whole application will freeze and needs a restart. Examples would be:
Rendered templates will be previewed in iframes and because this iframe is from the same origin it will be run in the same thread as the rest of the applications. That results in the problem when the iframe content blocks the whole application blocks.
Solution 1
Force iframe to be on separate thread. This doesn't seem to work at the moment, as I need the iframe to have the
allow-same-origin
option which seems to prevent iframes from running in their own thread even if thesandbox
option is used.Solution 2
I tried to switch to the webview tag. This also doesn't seem to be working. In theory the webview sounds perfect, but there is a issue that makes it apparently impossible to directly load arbitrary HTML into it and have the contained scripts run. The HTML will show fine but no scripts are working.