-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix global function get polluted close #52 #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching anything semantically significant on the caller is hugely hazardous, and likely is a form of dynamic scoping, which we have taken pains to avoid in the rest of the language. Also, the stack
property of Errors is not yet standard, and is likely to change.
Please explain what concrete compatibility problems you are running into, and what you need them to do. Let's see how we can accommodate those cases, or how you can on top of the realms-shim, with minimal damage to the realms-shim itself.
Probably best would be to start an issue discussing the actual problem and constraints, and how we can bound these as narrowly as possible. Thanks. Closing this PR.
// Prevents the evaluation of source when calling constructor on the | ||
// prototype of functions. | ||
const TamedFunction = function() { | ||
throw new TypeError('Not available'); | ||
if (isRunningInRealms()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching anything semantically significant on the caller is hugely hazardous, and likely is a form of dynamic scoping, which we have taken pains to avoid in the rest of the language. Also, the stack
property of Errors is not yet standard, and is likely to change.
Please explain what concrete compatibility problems you are running into, and what you need them to do. Let's see how we can accommodate those cases, or how you can on top of the realms-shim, with minimal damage to the realms-shim itself. Thanks.
Switching anything semantically significant on the caller is hugely hazardous, and likely is a form of dynamic scoping, which we have taken pains to avoid in the rest of the language. Also, the Please explain what concrete compatibility problems you are running into, and what you need them to do. Let's see how we can accommodate those cases, or how you can on top of the realms-shim, with minimal damage to the realms-shim itself. Thanks. |
The issue is drafted in #52. Realms shim will break the global function constructor. My fix may have false positive (detect outside code as running in the realm then reject it) but no false negative (every code run in the realms must be have a eval string in it's stack. If there is no stack available, we assume it is running in the realms) |
Ah. I think I understand now. I closed this because I thought you were trying to make the Attn @jfparadis |
I just thought it is impossible to not pollute the outside function in some techincal reason so I made this pr |
And the code of make the |
this fix is split from #17
close #52