fix(core): Avoid crash when Function.prototype is frozen#7899
Merged
mydea merged 4 commits intogetsentry:developfrom Apr 20, 2023
Jack-Works:patch-1
Merged
fix(core): Avoid crash when Function.prototype is frozen#7899mydea merged 4 commits intogetsentry:developfrom Jack-Works:patch-1
mydea merged 4 commits intogetsentry:developfrom
Jack-Works:patch-1
Conversation
mydea
reviewed
Apr 19, 2023
| const context = getOriginalFunction(this) || this; | ||
| return originalFunctionToString.apply(context, args); | ||
| }; | ||
| try { |
Member
There was a problem hiding this comment.
Could you add a comment here for why this try-catch exists? For future reference :) Would also be nice to have an example when/why this may be frozen.
Contributor
Author
There was a problem hiding this comment.
for example:
pwsh> node --frozen-intrinsics
(node:26089) ExperimentalWarning: The --frozen-intrinsics flag is experimental
(Use `node --trace-warnings ...` to show where the warning was created)
Welcome to Node.js v19.9.0.
Type ".help" for more information.
> 'use strict'; Function.prototype.toString = function () { return '' }
Uncaught:
TypeError <Object <Object <[Object: null prototype] {}>>>: Cannot assign to read only property 'toString' of object 'function () { [native code] }'
at Function.setter (node:internal/freeze_intrinsics:499:17)
mydea
reviewed
Apr 19, 2023
Co-authored-by: Francesco Novy <francesconovy@gmail.com>
Member
|
Hi @Jack-Works , this has been released in v7.50.0! |
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.

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).