-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Conversation
const assert = require('assert'); | ||
|
||
// Note (@AnnaMag): test for unchanged behaviour after refactoring to SetHandler | ||
//(see: node.cc line 3158) |
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.
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 |
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.
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']) |
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.
These assertions are already covered by the previous two assertions.
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.
LGTM with a suggestion.
// (node::Utf8Value key(info.GetIsolate(), property);). | ||
|
||
|
||
var symbol = Symbol('sym'); |
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.
const?
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.
LGTM
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). |
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.
LGTM, though I agree with @fhinkel about the comments. You also don't need to include your handle in the comment.
Done. |
@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 |
3bc11a4
to
8b404de
Compare
c133999
to
83c7a88
Compare
@jasnell, the failures are timeouts, which in my understanding are not patch related. Am I right or missing sth? |
Yep, they appear to be unrelated |
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.
Done:) |
LGTM |
Landed in ab19412 |
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
should this be backported? |
@thealphanerd Live quoting you: "If it lands cleanly, yes please". Thanks. |
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
@fhinkel landed cleanly on v6 but not v4, please feel free to manually backport |
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesDescription 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).