Perfect your code
With built-in code review tools, GitHub makes it easy to raise the quality bar before you ship. Join the 36 million developers who've merged over 200 million pull requests.
Sign up for free See pricing for teams and enterprisesn-api: define ECMAScript-compliant accessors on napi_define_* #27851
Conversation
nodejs-github-bot
added
the
C++
label
May 24, 2019
legendecas
force-pushed the
legendecas:napi_define_properties
branch
2 times, most recently
from
1deb5fc
to
1dfa776
May 24, 2019
addaleax
added
the
n-api
label
May 26, 2019
addaleax
approved these changes
May 26, 2019
src/js_native_api_v8.cc Outdated
This comment has been minimized.
This comment has been minimized.
legendecas
force-pushed the
legendecas:napi_define_properties
branch
2 times, most recently
from
0144dfe
to
1514b11
May 27, 2019
This comment has been minimized.
This comment has been minimized.
|
Overall I think this looks good. Since it is changing behaviour and N-API modules should run across LTS versions I think I should ask how likely it is to break existing code. My assumption is extremely low as it is changing from behaviour that is unexpected and to what should be expected. Still would like @legendecas and @addaleax to weigh in on that front. |
devsnek
approved these changes
May 27, 2019
TimothyGu
reviewed
May 27, 2019
|
The existing change looks good. You should probably change Lines 804 to 838 in 1514b11 V8PropertyAttributesFromDescriptor and CreateAccessorCallbackData.
|
src/js_native_api_v8.cc Outdated
This comment has been minimized.
This comment has been minimized.
AFAIK, there would be an error on invoking A case could be got hands on:
And v8 doesn't provide an API to define ECMA compliant accessors on the |
This comment has been minimized.
This comment has been minimized.
V8 does support that, as Lines 1027 to 1040 in aa42d37 v8::Template::Set() is used. Note in particular the use of v8::Signature there, which makes things like Object.getOwnPropertyDescriptor(MyClass.prototype, 'prop').get.call(notMyClassObj) throw an error.
|
This comment has been minimized.
This comment has been minimized.
|
@TimothyGu Thank you for your detailed explanation! I'll try to fix |
mhdawson
referenced this pull request
May 28, 2019
Closed
Object.getOwnPropertyDescriptor throws on accessor properties of an ObjectWrap class' prototype object #485
legendecas
force-pushed the
legendecas:napi_define_properties
branch
2 times, most recently
from
b7f2dd7
to
5efe42c
May 29, 2019
legendecas
force-pushed the
legendecas:napi_define_properties
branch
from
5efe42c
to
0f22b86
May 29, 2019
legendecas
changed the title
n-api: define ECMAScript-compliant accessors on napi_define_properties
n-api: define ECMAScript-compliant accessors on napi_define_*
May 29, 2019
legendecas
force-pushed the
legendecas:napi_define_properties
branch
2 times, most recently
from
d1731b7
to
fdea3b6
May 29, 2019
legendecas
force-pushed the
legendecas:napi_define_properties
branch
from
fdea3b6
to
2dfecc4
May 29, 2019
This comment has been minimized.
This comment has been minimized.
|
I have updated the |
This comment has been minimized.
This comment has been minimized.
|
ping n-api team, please take a look :) |
TimothyGu
approved these changes
Jun 11, 2019
|
Looks good, thanks! |
This comment has been minimized.
This comment has been minimized.
|
Was hoping for some feedback from @legendecas and @addaleax in terms of how much risk there is in terms of breaking existing code? |
This comment has been minimized.
This comment has been minimized.
|
For For Thus there would not be noticeable breaking on existing code IMHO. |
This comment has been minimized.
This comment has been minimized.
|
@legendecas I did validate that the current patch fixes nodejs/node-addon-api#485. It does break one of the node-addon-api tests but I think its a test problem so I'll look at fixing that. |
addaleax
added
the
author ready
label
Jun 13, 2019
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Looks good but we should land nodejs/node-addon-api#495 first so that we don't break the node-addon-api tests. |
mhdawson
added
the
blocked
label
Jun 13, 2019
This comment has been minimized.
This comment has been minimized.
|
Added the blocked label until we get the node-add-api fix in. Will try to expedite that. |
mhdawson
removed
the
blocked
label
Jun 13, 2019
This comment has been minimized.
This comment has been minimized.
|
Removed blocked label as update to node-addon-api testcase is now landed. |
legendecas commentedMay 24, 2019
•
edited
Fixes: #26551
Fixes: nodejs/node-addon-api#485
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes