-
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
napi_define_properties should create ECMAScript-compliant accessors. #26551
Comments
3 tasks
legendecas
added a commit
to legendecas/node
that referenced
this issue
May 29, 2019
BridgeAR
pushed a commit
to BridgeAR/node
that referenced
this issue
Jun 17, 2019
PR-URL: nodejs#27851 Fixes: nodejs#26551 Fixes: nodejs/node-addon-api#485 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
BridgeAR
pushed a commit
that referenced
this issue
Jun 17, 2019
PR-URL: #27851 Fixes: #26551 Fixes: nodejs/node-addon-api#485 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
BridgeAR
pushed a commit
that referenced
this issue
Jun 17, 2019
PR-URL: #27851 Fixes: #26551 Fixes: nodejs/node-addon-api#485 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
targos
pushed a commit
that referenced
this issue
Jun 18, 2019
PR-URL: #27851 Fixes: #26551 Fixes: nodejs/node-addon-api#485 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
targos
pushed a commit
that referenced
this issue
Jun 18, 2019
PR-URL: #27851 Fixes: #26551 Fixes: nodejs/node-addon-api#485 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Append the following lines to addons-napi/test_properties test-case
and execute it. You will get the following output
You can see that
readwriteAccessor1
looks like a data property (according to its property descriptor) despite being created with setter and getter. On the other hand, it behaves like an accessor property becauseanotherObject.readwriteAccessor1 = 42
does not create a data property onanotherObject
but invokes the setter in the prototype chain (as you can see from the last two lines of the output).This strange behaviour is not possible in ECMAScript-compliant world. It is some weird legacy behaviour of
v8::Object:SetAccessor
(used in the implementation ofnapi_define_properties
) and should be avoided. It would be unfortunate to promote this off-spec behaviour in newly arising N-API.The text was updated successfully, but these errors were encountered: