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

change for a deprecated method: SetNamedPropertyHandler() to SetHandler() #9062

Closed
wants to merge 1 commit into from

Conversation

AnnaMag
Copy link
Member

@AnnaMag AnnaMag commented Oct 12, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Description of change

SetNamedPropertyHandler() method replaced with SetHandler() in process_env_template

PropertyHandlerFlags::kOnlyInterceptStrings flag maintains previous behavior: only Strings as properties are intercepted. In theory, it is now possible to extend the functionality for intercepting properties using Symbols (in practice a fix is required: I will create an issue when this pull request is merged).

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Oct 12, 2016
const assert = require('assert');

// Note (@AnnaMag): test for unchanged behaviour after refactoring to SetHandler
//(see: node.cc line 3158)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the references to specific lines. They will almost certainly get stale quickly.

// Note (@AnnaMag): test for unchanged behaviour after refactoring to SetHandler
//(see: node.cc line 3158)
//
// with the kOnlyInterceptStrings flag, manipulating properties via
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you capitalize and punctuate the the comments. Also, add a space after // in some of the comments below.

assert.strictEqual('42', process.env['s']);

//check the type of sustituted properties
assert.strictEqual('string', typeof process.env['s'])
Copy link
Contributor

Choose a reason for hiding this comment

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

These assertions are already covered by the previous two assertions.

@mscdex mscdex added the process Issues and PRs related to the process subsystem. label Oct 12, 2016
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 with a suggestion.

// (node::Utf8Value key(info.GetIsolate(), property);).


var symbol = Symbol('sym');
Copy link
Member

Choose a reason for hiding this comment

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

const?

@bnoordhuis
Copy link
Member

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.

LGTM

@fhinkel
Copy link
Member

fhinkel commented Oct 13, 2016

Can you squash the commits into one?

For the comments in the tests, right now some of them document what you did in the refactoring. For somebody reading the tests in a few month, it's probably not so important that there was a refactoring, but more what the test is testing. Maybe you can rewrite the comments not so much focusing on your change, but rather what you want to test (The test is valid with or without the refactoring).

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.

LGTM, though I agree with @fhinkel about the comments. You also don't need to include your handle in the comment.

@AnnaMag
Copy link
Member Author

AnnaMag commented Oct 14, 2016

Done.

@jasnell
Copy link
Member

jasnell commented Oct 14, 2016

@AnnaMag ... can you please update the commit log to match the contribution guidelines here: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit

@AnnaMag AnnaMag force-pushed the sethandler branch 4 times, most recently from 3bc11a4 to 8b404de Compare October 14, 2016 19:27
@rvagg rvagg force-pushed the master branch 2 times, most recently from c133999 to 83c7a88 Compare October 18, 2016 17:02
@jasnell
Copy link
Member

jasnell commented Oct 19, 2016

@AnnaMag
Copy link
Member Author

AnnaMag commented Oct 26, 2016

@jasnell, the failures are timeouts, which in my understanding are not patch related. Am I right or missing sth?

@jasnell
Copy link
Member

jasnell commented Oct 26, 2016

Yep, they appear to be unrelated

@fhinkel
Copy link
Member

fhinkel commented Oct 27, 2016

Can you address Ben's comment? Then we can merge this.

The changes introdcued here replace the deprecated
v8 method SetNamedPropertyHandler() to SetHandler()
in node.cc.
Prior to refactoring, the method defined callbacks
when accessing object properties defined by Strings
and not Symbols.
test/parallel/test-v8-interceptStrings-not-Symbols.js
demonstrates that this behaviour remained unchanged
after refactoring.
@AnnaMag
Copy link
Member Author

AnnaMag commented Oct 27, 2016

Done:)

@fhinkel
Copy link
Member

fhinkel commented Nov 1, 2016

LGTM

@fhinkel
Copy link
Member

fhinkel commented Nov 1, 2016

Landed in ab19412

@fhinkel fhinkel closed this Nov 1, 2016
fhinkel pushed a commit that referenced this pull request Nov 1, 2016
The changes introdcued here replace the deprecated
v8 method SetNamedPropertyHandler() to SetHandler()
in node.cc.
Prior to refactoring, the method defined callbacks
when accessing object properties defined by Strings
and not Symbols.
test/parallel/test-v8-interceptStrings-not-Symbols.js
demonstrates that this behaviour remained unchanged
after refactoring.

PR-URL: #9062
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
evanlucas pushed a commit that referenced this pull request Nov 3, 2016
The changes introdcued here replace the deprecated
v8 method SetNamedPropertyHandler() to SetHandler()
in node.cc.
Prior to refactoring, the method defined callbacks
when accessing object properties defined by Strings
and not Symbols.
test/parallel/test-v8-interceptStrings-not-Symbols.js
demonstrates that this behaviour remained unchanged
after refactoring.

PR-URL: #9062
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@MylesBorins
Copy link
Contributor

should this be backported?

@fhinkel
Copy link
Member

fhinkel commented Nov 22, 2016

@thealphanerd Live quoting you: "If it lands cleanly, yes please". Thanks.

MylesBorins pushed a commit that referenced this pull request Nov 26, 2016
The changes introdcued here replace the deprecated
v8 method SetNamedPropertyHandler() to SetHandler()
in node.cc.
Prior to refactoring, the method defined callbacks
when accessing object properties defined by Strings
and not Symbols.
test/parallel/test-v8-interceptStrings-not-Symbols.js
demonstrates that this behaviour remained unchanged
after refactoring.

PR-URL: #9062
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@MylesBorins
Copy link
Contributor

@fhinkel landed cleanly on v6 but not v4, please feel free to manually backport

@MylesBorins MylesBorins mentioned this pull request Dec 1, 2016
@AnnaMag AnnaMag deleted the sethandler branch January 25, 2017 22:26
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++. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants