Sprint 7: Script Execution Architecture — with() + eval() statt new Function() #58
Labels
No labels
bug
docs
feature
housekeeping
html-spec
performance
react-compat
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
glow-all/true-headless-browser#58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sprint 7: Script Execution Architecture (with + eval)
Issue: #57
Epic: Phase 2 Production Engine
Aufwand: ~6h
Abhängigkeit: Sprint 6 (#56) — Module-Pfad muss vorher stabil sein
Problem
new Function("_win", varDecls + code)ist die Wurzel von 3 kritischen Bugs:[[HomeObject]]-Binding verloren gehtconst/letredeclaration weil strict mode verbietetthisnicht immer korrekt auf WindowLösung
Ersetze
new Function()durchwith(proxyWin) { eval(code) }.Vorteile:
#) bleiben intakt (kein IIFE-Scope-Break)const/letfunktionieren korrekt (sloppy mode)thisist korrektwindowvarDeclsString mehr nötigwith)Aber:
with()hat Performance-Impact → vor/nach benchmarken.Betroffene Dateien
src/js/execution-realm.tsexecute():with+evalstattnew Function()src/js/script-loader.tsexecuteRaw()Fallback-Pfadsrc/runtime-isolation.tshas-Trap prüfensrc/tolerant-proxy.tshas-Trap für alle Propertiessrc/js/unified-execution-layer.tssrc/interaction/evaluate.tssrc/js/script-loader.tsbuildVarDecls()entfernenAkzeptanzkriterien
with(proxyWin) { eval(code) }— alle Window-Properties sichtbarconst x = 1; const x = 1— kein Errorthis === proxyWindowin Scriptsdefine === undefined,module === undefinedbuildVarDecls()entfernt (nicht mehr verwendet)