Preview iframe freeze during Autoupdating execution
0 reputation · 09 May 2020, 19:35 UTC
CodePen Editor Preview Behavior
The CodePen editor provides an Autoupdating preview toggle that triggers a re-render of the sandboxed iframe after a debounce period following editor changes. When this feature is enabled, the environment executes user-defined HTML, CSS, and JavaScript in real-time.
Execution Constraints
If a script contains a runaway loop or a blocking synchronous operation, the preview iframe may become unresponsive. Because the preview is sandboxed, this state typically isolates the failure to the iframe, leaving the editor UI functional.
It is unclear how the editor handles the cancellation of a pending update if the previous execution is still blocking the main thread of the iframe or if a timeout is enforced to prevent permanent freezes.
- Does the editor implement a hard timeout for script execution within the Autoupdating preview?
- Is a pending update discarded or queued if the previous render has not yet completed or has frozen the iframe?