Repository navigation
Conversation
|
Warning Review limit reached
Next review available in: 26 minutes Limit details: You’ve used all 5 included reviews currently available under your plan. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughChangesInspector value conversion
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Source/JavaScriptCore/inspector/InjectedScriptBase.cpp`:
- Around line 69-74: Add regression tests for the non-JSON handling in
InjectedScriptBase, covering direct 1n, direct Symbol(), and nested [1n] values
with returnByValue enabled. Exercise synchronous and asynchronous
Runtime.evaluate and Runtime.callFunctionOn flows, plus
Debugger.evaluateOnCallFrame where supported, and assert the "Object couldn't be
returned by value" error while confirming execution completes without reaching
ASSERT_NOT_REACHED.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 904ce0ce-dc1a-4f63-8543-0825b32e83ff
📒 Files selected for processing (1)
Source/JavaScriptCore/inspector/InjectedScriptBase.cpp
There was a problem hiding this comment.
LGTM — small, well-scoped fix that stops the inspector from asserting on BigInt/Symbol under returnByValue and gives a clearer error string.
What was reviewed:
- Verified
JSValue::isBigInt()covers both BigInt32 and HeapBigInt, andisSymbol()guards onisCell()— safe to call at that point in the type ladder. - Placement before
isObject()is correct; these were the only primitive kinds that previously fell through toASSERT_NOT_REACHED. - Confirmed nothing else in the tree matches the old "Object has too long reference chain" string, so the message change is self-contained.
Extended reasoning...
Overview
The PR touches a single file, Source/JavaScriptCore/inspector/InjectedScriptBase.cpp, with two changes: (1) an early return nullptr in jsToInspectorValue when the value is a BigInt or Symbol, and (2) rewording the error string produced by makeCall / makeAsyncCall when toInspectorValue returns null. Net effect: an assertions build no longer aborts when Runtime.evaluate with returnByValue: true encounters a BigInt/Symbol, and release builds report a message that actually describes the failure.
Security risks
None. This is inspector-protocol serialization code that runs only when a debugger is attached. The new branch does no allocation or coercion — it just returns nullptr, which was already the release-build behavior via the ASSERT_NOT_REACHED(); return nullptr; fallthrough. The error-string change is a literal constant.
Level of scrutiny
Low. The diff is ~10 lines, mechanical, and confined to a debugging/inspector path. The release-build semantics for the BigInt/Symbol case are unchanged (still nullptr); only the debug-build assert and the user-facing error text differ. I checked JSCJSValueCell.h to confirm isBigInt() handles both the BigInt32 tag and heap BigInts and that isSymbol() is a null-safe cell-type check, so the new arm slots correctly between the existing primitive checks and the isObject() branch.
Other factors
A repo-wide grep found no other consumers of the old "Object has too long reference chain" string, so nothing depends on the exact wording. The new message matches V8's inspector wording per the PR description, which is a reasonable choice for tooling compatibility. No prior review comments or bot findings on this PR.
Preview Builds
|
…rting
Runtime.evaluate / Runtime.callFunctionOn with returnByValue:true on a
result that contains a BigInt or Symbol (for example [1n], {a:1n}, or
Symbol()) reached the ASSERT_NOT_REACHED at the end of
jsToInspectorValue, aborting an assertions build. Release builds fell
through to nullptr and the caller reported the unrelated 'Object has too
long reference chain' message.
Return nullptr explicitly for BigInt and Symbol (they have no JSON
representation), and replace the misleading depth-limit message with the
same 'Object couldn't be returned by value' wording V8's inspector uses.
toInspectorValue also returns nullptr when a getter throws during
serialization, so the new wording is accurate for every nullptr path.
0cd81ac to
739b330
Compare
There was a problem hiding this comment.
LGTM — small, defensive fix that stops the debug-build assert and gives a clearer error for unserializable inspector results.
What was reviewed:
- Verified
JSValue::isBigInt()/isSymbol()exist and that these types are cells but not objects, so they previously fell through toASSERT_NOT_REACHED. - Confirmed the new
nullptrreturn follows the same pattern as the existing depth-limit and recursive-element failure paths, and both callers already handle it. - Grepped for the old "Object has too long reference chain" string — no other consumers, so the wording change is safe;
JSON::Value::create(const String&)accepts the newString("..."_s)form.
Extended reasoning...
Overview
This PR touches a single file, Source/JavaScriptCore/inspector/InjectedScriptBase.cpp, with three small hunks:
- In
jsToInspectorValue, add anif (value.isBigInt() || value.isSymbol()) return nullptr;arm after the primitive checks and before theisObject()branch. - In
makeCall, replace the fallback error string whentoInspectorValuereturns null. - In
makeAsyncCall, make the identical string replacement in the async lambda.
The intent is to stop Runtime.evaluate / callFunctionOn with returnByValue: true from hitting ASSERT_NOT_REACHED (SIGABRT in assertions builds) when the result contains a BigInt or Symbol, and to replace the misleading "too long reference chain" message with V8-compatible wording that also covers the depth-limit case.
Security risks
None. This is inspector/devtools JSON serialization for the returnByValue protocol path. The change adds an early-out that returns nullptr for two primitive types that were already falling through to nullptr in release builds — it just makes that explicit and skips the assertion. No new data is exposed, no auth/permissions logic is touched, and the error string is a static literal.
Level of scrutiny
Low. The change is narrowly scoped to inspector error reporting, not the JS runtime or JIT tiers. In release builds the observable behavior change is only the error-message text (nullptr was already returned via the ASSERT_NOT_REACHED fallthrough); in debug builds it prevents a crash. I verified JSValue::isBigInt() and JSValue::isSymbol() are defined in JSCJSValue.h, and that BigInt (heap or BigInt32) and Symbol are non-object cells, so the placement before isObject() is correct — they never entered that branch. The recursive array/object handlers already check for a null child and propagate nullptr, so nested [1n] / {a:1n} are handled without further changes.
Other factors
- Grepped the tree for the old error string — no tests, layout tests, or other code match it, so rewording is safe.
JSON::Value::create(const String&)exists andcreate(T) = deletewould reject a bareASCIILiteral, so the explicitString("..."_s)wrapper is the right construction.- The only prior review activity is a resolved CodeRabbit nit asking for regression tests; no outstanding human-reviewer comments.
- The bug hunting system found no issues.
Runtime.evaluate (and callFunctionOn / evaluateOnCallFrame) with returnByValue:true on a result that contains a BigInt or Symbol reached ASSERT_NOT_REACHED in Inspector::jsToInspectorValue, aborting an assertions build of the debuggee. Release builds fell through to nullptr and reported the unrelated 'Object has too long reference chain' error. The fix is in oven-sh/WebKit#384: jsToInspectorValue now returns nullptr explicitly for BigInt/Symbol (they have no JSON representation), and the error surfaced to the client is 'Object couldn't be returned by value' (matching V8's inspector). Bump WEBKIT_VERSION to pick that up and add a --inspect regression test for [1n], {a:1n}, Symbol(), {b:Symbol()}.
What
Runtime.evaluate/Runtime.callFunctionOn/Debugger.evaluateOnCallFramewithreturnByValue: trueon a result that holds a BigInt or Symbol reachedASSERT_NOT_REACHEDinInspector::jsToInspectorValue, aborting an assertions build. Release builds fell through tonullptrand the caller reported the unrelated "Object has too long reference chain (must not be longer than 1000)" error.Reproduces with any of:
[1n],({a:1n}),Symbol("s"),({b:Symbol()}). A bare top-level1nis fine becauseInjectedScriptSource.jsnever stores it onRemoteObject.value.Fix
isBigInt() || isSymbol()arm tojsToInspectorValuethat returnsnullptr(unserializable) instead of falling intoASSERT_NOT_REACHED.makeCall/makeAsyncCallwith "Object couldn't be returned by value", matching V8's inspector wording and accurate for both the depth-limit and the unserializable-primitive cases.Repro
Assertions build before:
SHOULD NEVER BE REACHEDinInjectedScriptBase.cpp:96, SIGABRT.Release before:
{"error":{"code":-32000,"message":"Object has too long reference chain ..."}}.After:
{"error":{"code":-32000,"message":"Object couldn't be returned by value"}}on both, debuggee stays alive.