Commit a5890e2
committed
fix: prevent broken script execution during streaming in widget iframe
Three bugs in the script execution code caused interactive widgets
(BFS/DFS graphs, animations) to fail:
- btoa() output contains =, +, / which are invalid in HTML attribute
names, causing setAttribute to throw and abort the entire forEach
- Incomplete <script> tags during streaming produced broken fragments
that failed on execution
- No error isolation meant one bad script blocked all others
Fix: defer script execution until all <script> tags are fully closed,
sanitize base64 hashes for attribute names, skip empty scripts, and
wrap individual executions in try/catch.1 parent a44c0d5 commit a5890e2
1 file changed
+24
-14
lines changedLines changed: 24 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| 364 | + | |
364 | 365 | | |
365 | | - | |
| 366 | + | |
366 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
367 | 371 | | |
368 | 372 | | |
369 | 373 | | |
| |||
410 | 414 | | |
411 | 415 | | |
412 | 416 | | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
426 | 436 | | |
427 | 437 | | |
428 | 438 | | |
| |||
0 commit comments