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

test: added test for indexed properties #11769

Closed
wants to merge 1 commit into from

Conversation

AnnaMag
Copy link
Member

@AnnaMag AnnaMag commented Mar 9, 2017

Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().

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

test

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Mar 9, 2017
@AnnaMag
Copy link
Member Author

AnnaMag commented Mar 9, 2017

cc/ @fhinkel

@mscdex mscdex added the vm Issues and PRs related to the vm subsystem. label Mar 9, 2017
const assert = require('assert');
const vm = require('vm');

const code =
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we could just use a multi-line template string here instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure I understand. @mscdex, could you be a little more specific, please? :)

Copy link
Member

@fhinkel fhinkel Mar 9, 2017

Choose a reason for hiding this comment

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

Instead of +-ing several strings, we can use one multi-line string by using backticks.

 const code = `Object.defineProperty(this, 99, {  
      value: 20,  
      enumerable: true  
 });`; 

It's less characters total and you can copy and paste such strings into the REPL without removing all the ' + ' in between.

See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @fhinkel. The code is revised now.

const vm = require('vm');

const code =
' Object.defineProperty(this, 99 , {\n' +
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: extra space after '99'

Copy link
Member

@fhinkel fhinkel left a comment

Choose a reason for hiding this comment

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

Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().
@mscdex
Copy link
Contributor

mscdex commented Mar 9, 2017

LGTM.

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

The indentation looks off on lines 8 and 9. Other than that, LGTM.

@jasnell
Copy link
Member

jasnell commented Mar 15, 2017

jasnell pushed a commit that referenced this pull request Mar 15, 2017
Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().

PR-URL: #11769
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
@jasnell
Copy link
Member

jasnell commented Mar 15, 2017

Landed in 1a210c4

@jasnell jasnell closed this Mar 15, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Mar 20, 2017
Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().

PR-URL: nodejs#11769
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
jungx098 pushed a commit to jungx098/node that referenced this pull request Mar 21, 2017
Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().

PR-URL: nodejs#11769
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
MylesBorins pushed a commit that referenced this pull request Apr 18, 2017
Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().

PR-URL: #11769
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
MylesBorins pushed a commit that referenced this pull request Apr 19, 2017
Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().

PR-URL: #11769
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Apr 19, 2017
andrew749 pushed a commit to michielbaird/node that referenced this pull request Jul 19, 2017
Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().

PR-URL: nodejs/node#11769
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants