Repository navigation
perf(core): let a scene wait when it only looks inside its own root #5726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,10 +70,10 @@ function sceneScriptSwapRefusal(script: string): string | null { | |
| return match ? `its script uses ${match[0].trim()}` : null; | ||
| } | ||
|
|
||
| // What ties a scene script to boot order: reaching outside its root, or leaving state on window for | ||
| // other scripts (the timeline registry aside). | ||
| // What ties a scene script to boot order: reaching outside its root (reading <html>'s attributes and | ||
| // marking nodes its scoped `document` found stay inside), or leaving state on window for others. | ||
| const REACHES_OUTSIDE_RE = | ||
| /\b(documentElement|getElementsBy\w+|__hf[A-Z]\w*)\b|document\s*\.\s*(head|body)\b|querySelector(All)?\(\s*["'](head|body)["']|defineProperty\s*\(\s*(window|globalThis|self|document)\b|\b(window|globalThis|self)\s*(\.\s*(?!__timelines\b)[A-Za-z_$][\w$]*|\[[^\]]*\])\s*=(?!=)/; | ||
| /\bgetElementsBy\w+\b|\bdocumentElement\b(?!\s*\.\s*(?:get|has)Attribute\s*\()|(?<!\.\s*)\b__hf[A-Z]\w*\b|\b(?:window|globalThis|self)\s*\.\s*__hf[A-Z]\w*|document\s*\.\s*(head|body)\b|querySelector(All)?\(\s*["'](head|body)["']|defineProperty\s*\(\s*(window|globalThis|self|document)\b|\b(window|globalThis|self)\s*(\.\s*(?!__timelines\b)[A-Za-z_$][\w$]*|\[[^\]]*\])\s*=(?!=)/; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Preserve ordering for mutable shared
BASE keeps both eager, so the reader captures |
||
|
|
||
| /** Why an authored scene script must run at boot rather than when the playhead nears, or null. */ | ||
| function sceneScriptEagerReason(script: string): string | null { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Keep shared-object
__hf*properties eagerThe dotted-property exception also admits
document.__hfSharedTone, although the scoped document is a Proxy over the real Document, with only the three query getters overridden and no private set trap (compositionScoping.ts:395–405). Two authoreddata-composition-srcscenes can therefore share this property. Put a preparer first in source order at start=60/duration=5 that assignsdocument.__hfSharedTone = 'ready', followed by a reader at start=30/duration=5 that snapshotsString(document.__hfSharedTone || 'unset')into its scoped.out. Each can register only its own timeline, with a 70-second root and no cross-scene registry/selector dependencies.BASE marks both eager and initial mounting runs preparer then reader, producing
ready. HEAD marks neither eager: the reader mounts at t=20 and capturesunset; the preparer only mounts at t=50.takeHeldScenesNearremoves each entry once, so later preparation does not repair the reader's visible text. The same overly broad receiver assumption admits aliases such asconst page = window; page.__hfReady = 'ready', despite the window proxy forwarding that write globally. Preserve shared-receiver eagerness or establish that the receiver is actually a scene-local node. This is a source-derived ordering witness, not a claimed executed reproduction.