Skip to content
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

src: fix vm module for strict mode #16487

Closed
wants to merge 1 commit into from
Closed

Conversation

fhinkel
Copy link
Member

@fhinkel fhinkel commented Oct 25, 2017

This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

Fixes: #12300

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

src

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. vm Issues and PRs related to the vm subsystem. labels Oct 25, 2017
@fhinkel
Copy link
Member Author

fhinkel commented Oct 25, 2017

This fixes the issue, but it's not pretty. Not sure if we want to fix the issue like this or completely rethink our strategy for throwing in the sandboxed environment.

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Doesn't seem too terrible to me although there might be a bit of a performance hit (two lookups instead of sometimes one, sometimes two - although I expect the latter is the more common path.)

@@ -346,14 +346,21 @@ class ContextifyContext {
return;

auto attributes = PropertyAttribute::None;
bool is_declared = ctx->global_proxy()
bool is_declared_global_proxy = ctx->global_proxy()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_declared_on_global_proxy?

This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

Fixes: nodejs#12300
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(somewhat rubber-stampy lgtm)

@fhinkel
Copy link
Member Author

fhinkel commented Oct 26, 2017

@fhinkel
Copy link
Member Author

fhinkel commented Oct 27, 2017

Thanks for the reviews. Landed in 5856c83

@fhinkel fhinkel closed this Oct 27, 2017
fhinkel added a commit that referenced this pull request Oct 27, 2017
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

PR-URL: #16487
Fixes: #12300
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

PR-URL: #16487
Fixes: #12300
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

PR-URL: #16487
Fixes: #12300
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

PR-URL: #16487
Fixes: #12300
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@gibfahn gibfahn mentioned this pull request Oct 31, 2017
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

PR-URL: nodejs/node#16487
Fixes: nodejs/node#12300
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

PR-URL: nodejs/node#16487
Fixes: nodejs/node#12300
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorins
Copy link
Contributor

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.

PR-URL: nodejs/node#16487
Fixes: nodejs/node#12300
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vm: strict mode ReferenceError with assignment to context property
7 participants