fix(core,browser): Handle errors from other realms - #22926
Open
davidmurdoch wants to merge 1 commit into
Open
Conversation
Replace realm-sensitive Error constructor checks with the existing isError helper. Preserve the fetch TypeError restriction by checking the error name, and add cross-realm regression coverage. Co-Authored-By: OpenAI Codex <codex@openai.com>
davidmurdoch
marked this pull request as ready for review
July 31, 2026 20:58
davidmurdoch
requested review from
logaretm and
msonnb
and removed request for
a team
July 31, 2026 20:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Some event-processing paths failed to recognize errors created in another JavaScript realm. This preserves linked causes and AggregateError children, recognizes error-valued object properties, and applies fetch TypeError hostname enhancement across realm boundaries.
Root cause
instanceof Error,instanceof TypeError, and equivalent constructor-based checks depend on prototype identity. Errors from iframes, workers, or other realms have different intrinsic constructors even though they are genuine errors.These paths now use the SDK’s existing realm-tolerant
isErrorhelper. The fetch path additionally checkserror.name === "TypeError"to preserve its existing type restriction.Regression coverage creates errors in a separate Node VM context and exercises both core and browser event builders, aggregate and linked errors, and fetch instrumentation.
Fixes #22925