GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Discard a function's baseline code with events disallowed by Andarist · Pull Request #206 · replayio/node Conversation
Member
Ports replayio/chromium-v8#359. Setting a breakpoint discards the function's baseline code, which walks the heap and so enters a safepoint, whose GC tracer scope reads the clock. Whether the function has baseline code at that point can differ between recording and replaying: in a recording that set breakpoints from an attached debugger while a generator ran in Sparkplug code, the replay read the clock in Debug::DiscardBaselineCode where the recording had no such read, and mismatched against the recording's next event. Like the GC, the heap walk now runs with events disallowed. DiscardAllBaselineCode and InstallDebugBreakTrampoline also walk the heap, but they run whenever their caller is reached, not depending on which tier a function is in, so they are left as they are.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsPorts replayio/chromium-v8#359. Setting a breakpoint discards the function's baseline code, which walks the heap and so enters a safepoint, whose GC tracer scope reads the clock. Whether the function has baseline code at that point can differ between recording and replaying: in a recording that set breakpoints from an attached debugger while a generator ran in Sparkplug code, the replay read the clock in Debug::DiscardBaselineCode where the recording had no such read, and mismatched against the recording's next event. Like the GC, the heap walk now runs with events disallowed. DiscardAllBaselineCode and InstallDebugBreakTrampoline also walk the heap, but they run whenever their caller is reached, not depending on which tier a function is in, so they are left as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]> Uh oh!
There was an error while loading. Please reload this page.
Andarist
added a commit
that referenced
this pull request
* Run V8's incremental marking and memory reducer as upstream when recording/replaying Port of the GC parts of replayio/chromium-v8#354 and of replayio/chromium-v8#364, in the state they have on chromium-v8's master. * Use incremental marking when replaying too, not only when recording. * Tie the GC changes to the v8-flags-gc feature (gRecordReplayEnableGCFeatures). With it disabled, incremental marking is off when recording and replaying, and the old generation expands where incremental marking would have started, as when replaying before. * Run V8's memory reducer when recording/replaying. Whether it asks for its timer depends on the GC's history, which differs between recording and replaying, and it often asks with events disallowed. The request is remembered and the timer posted at the next point which replays, if the recording had a request and no posted timer is pending: after the timer task, after a context disposal, or at a progress interrupt, which every request triggers when recording (nodejs#364; the driver side, replayio/backend#13594, is already in REPLAY_BACKEND_REV). The timer task runs with events disallowed, only acts when the reducer is waiting, and runs a full GC instead of starting idle incremental marking, whose tasks node's platform drops. It is no longer marked non-deterministic, so the platform runs it. * Only run API interrupt callbacks at progress interrupts with the "interrupts" feature enabled, as the memory reducer triggers progress interrupts too. The Sparkplug parts of nodejs#354 were ported as #206 and #207. Concurrent and parallel GC stay disabled here: node's platform can't run the GC's jobs yet (next commit). Co-Authored-By: Claude Opus 5.5 <[email protected]> * Use concurrent and parallel GC when recording/replaying The rest of "Use concurrent, parallel and incremental GC when replaying" from replayio/chromium-v8#354. Chromium's fork had them on when recording already; node had them off in both, as its platform couldn't run the GC's jobs: the GC posts them with events disallowed, at points which don't replay, and DefaultJobState::NotifyConcurrencyIncrease dropped those. Chromium's base runs tasks posted with events disallowed on a fixed-size thread group whose threads run with events disallowed. NodePlatform gets the same when recording/replaying: an unordered WorkerThreadsTaskRunner of 4 threads, on a task queue with a plain lock, which CallOnWorkerThread uses while events are disallowed. Its threads are created at startup, where creating threads replays (creating them with events disallowed calls getrlimit with events disallowed, which fails the replay), disallow events for their whole run, and are never joined. A job created with events disallowed posts its workers with events disallowed, so they go there too. Other jobs still don't add workers with events disallowed. With v8-flags-gc disabled, the flags stay off as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Run the GC's foreground tasks at the next event loop iteration when recording/replaying V8 marks the tasks the GC posts to the isolate's thread (incremental marking, scavenge and sweeping tasks) as non-deterministic: they are posted at points which don't replay. Node's platform dropped them when recording/replaying, so incremental marking only advanced as the program allocated. One left running when a program went idle never finished, and the memory reducer's timer then couldn't start its GC either ("waiting for 8000 ms" again, with 34 MB marked on background threads): with --optimize-for-size, an idle recording's heap shrank in 3 of 4 runs. Chromium's fork runs such tasks with its next task. Node's platform now queues them and runs them with events disallowed at the next event loop iteration, from a check handle, which happens at the same point when replaying. The incremental marking and scavenge tasks are enabled again with v8-flags-gc. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
bhackett1024
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Reading a property's descriptor can run user code too: node defines its lazy globals (FormData, Headers, Request, Response, WebSocket, ...) with SetLazyDataProperty, whose replace-on-access getter loads the module, and on the global proxy the inspector does not report them as native accessors. Replay's own session describes the global object for every pause's scope chain with events disallowed, where loading undici needs recorded calls the recording does not have. Report a lazy data property that has not loaded yet as a native getter instead, as the inspector does for other native accessors; a session a user or the program attached runs with events allowed and still loads it. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Reading a property's descriptor can run user code too: node defines its lazy globals (FormData, Headers, Request, Response, WebSocket, ...) with SetLazyDataProperty, whose replace-on-access getter loads the module, and on the global proxy the inspector does not report them as native accessors. Replay's own session describes the global object for every pause's scope chain with events disallowed, where loading undici needs recorded calls the recording does not have. Report a lazy data property that has not loaded yet as a native getter instead, as the inspector does for other native accessors; a session a user or the program attached runs with events allowed and still loads it. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Reading a property's descriptor can run user code too: node defines its lazy globals (FormData, Headers, Request, Response, WebSocket, ...) with SetLazyDataProperty, whose replace-on-access getter loads the module, and on the global proxy the inspector does not report them as native accessors. Replay's own session describes the global object for every pause's scope chain with events disallowed, where loading undici needs recorded calls the recording does not have. Report a lazy data property that has not loaded yet as a native getter instead, as the inspector does for other native accessors; a session a user or the program attached runs with events allowed and still loads it. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Reading a property's descriptor can run user code too: node defines its lazy globals (FormData, Headers, Request, Response, WebSocket, ...) with SetLazyDataProperty, whose replace-on-access getter loads the module, and on the global proxy the inspector does not report them as native accessors. Replay's own session describes the global object for every pause's scope chain with events disallowed, where loading undici needs recorded calls the recording does not have. Report a lazy data property that has not loaded yet as a native getter instead, as the inspector does for other native accessors; a session a user or the program attached runs with events allowed and still loads it. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Reading a property's descriptor can run user code too: node defines its lazy globals (FormData, Headers, Request, Response, WebSocket, ...) with SetLazyDataProperty, whose replace-on-access getter loads the module, and on the global proxy the inspector does not report them as native accessors. Replay's own session describes the global object for every pause's scope chain with events disallowed, where loading undici needs recorded calls the recording does not have. Report a lazy data property that has not loaded yet as a native getter instead, as the inspector does for other native accessors; a session a user or the program attached runs with events allowed and still loads it. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
While events are disallowed (GC, compilation, driver commands) and the replay has not diverged, user JS from registered scripts must not run: it would advance the progress counter differently than when recording. That condition is v8::replayio::MustNotRunUserJS(). Its comment documents why it exists: Replay's inspector session work runs with events disallowed and console message data is gathered only when replaying, so user JS run from there would change the program's state where the recording didn't. It also describes the alternative of recording the session's work on both sides, and why recordings would then show the program as if a debugger were attached. Execution::Invoke refuses to call such functions and logs a NonDeterministicUserJSBlocked warning with the trigger, the progress, the function's location and the JS stack. Invoke and the API callback entry points (HandleApiCallHelper, InvokeApiFunction, HandleApiCallAsFunctionOrConstructor) rewind any progress (and progress assert data) made on such paths through RecordReplayScrubDivergentProgressScope, the progress runtime function warns once with the JS stack when it happens (NonDeterministicUserJSUngated), and Error.prepareStackTrace is skipped while events are disallowed. The Invoke gate doesn't catch the program's code called from a builtin or called through a bound function or a proxy, so the inspector's value descriptions gate on the same condition: describing an Error returns a placeholder instead of reading its stack and message, and Object::ConvertToString returns the default [object Object] string instead of running ToPrimitive, which this V8 reaches when it describes a logged Date. Upstream V8 made Date descriptions side-effect free (25c69ecbc14), after which the ConvertToString gate can go. Previews gate on it as well: to show a value instead of an accessor, V8 reads a getter that reports no script id, which is every callable the Invoke gate misses, so Replay's own session leaves the property an accessor for the viewer to call. V8 9.4 read it with CallFunctionOn() and throw_on_side_effect, where a getter that did anything was skipped; 10.2 replaced that with a plain Get() guarded only by a list of DOM attribute names. The Chromium fork gates the same site with an allow-list of those names (replayio/chromium-v8@91c06b051a5). Discard a function's baseline code with events disallowed: the heap walk enters a safepoint whose GC tracer scope reads the clock, and whether the function has baseline code when a breakpoint is set can differ between recording and replaying. Register as Replay sources exactly the scripts whose bytecode is instrumented, and announce them to the recorder from a separate RecordReplayAnnounceScript: queued until the first checkpoint, since the recorder only takes sources from there on, and skipped with a warning if events are disallowed, which announcing would record an event in. A script is also registered as soon as a main-thread compile finishes it (RecordReplayRegisterCompiledScript), not only when its function is instantiated. When listing a script's possible breakpoints, recompile a top-level function the GC collected, so the functions only its bytecode referenced have their breakpoints again. The baseline JIT's progress and instrumentation runtime calls take the accumulator as their last argument and return it (Runtime_RecordReplayBaselineExecutionProgress, Runtime_RecordReplayBaselineInstrumentation and its generator variant): the calling frame's baseline code can be discarded while the call is on the stack, and the frame then resumes in the interpreter with the call's result as its accumulator. Runtime_RecordReplayBaselineTargetProgressReached is called once the counter that baseline code increments inline reaches the target progress. Instrumentation sites are reported to the recorder by function index rather than by bytecode offset. Describing an Error for the inspector does not read its name either, for the same reason it does not read its message: both can run a getter the recording did not. Reading a property's descriptor can run user code too: node defines its lazy globals (FormData, Headers, Request, Response, WebSocket, ...) with SetLazyDataProperty, whose replace-on-access getter loads the module, and on the global proxy the inspector does not report them as native accessors. Replay's own session describes the global object for every pause's scope chain with events disallowed, where loading undici needs recorded calls the recording does not have. Report a lazy data property that has not loaded yet as a native getter instead, as the inspector does for other native accessors; a session a user or the program attached runs with events allowed and still loads it. Rebase note: new C++-to-JS entry points need a RecordReplayScrubDivergentProgressScope, and user callbacks invoked from V8 internals need the same MustNotRunUserJS() gating. The invariant is about the program's state, not about one entry point: anything Replay's own session can reach that would run user JS (an accessor, a toString, a Symbol.toPrimitive) has to be gated, not just the paths that go through Execution::Invoke. Upstream keeps reworking how a preview decides to read a getter; whatever that condition becomes, it has to keep the gate ahead of it, since the side-effect helper it calls can run user JS itself. From #128, #132, #159, #202, #203, #206, #207, #211, #217 and #224. Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Brian Hackett <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |