- Apr 17, 2018
-
-
Pratik Jain authored
Replaced TypeError with RegEx to match the exact error message in file test/addons-napi/test_properties/test.js. The RegEx will check the validity of the error being thrown. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14443 Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Luigi Pinca <luigipinca@gmail.com> Reviewed-By:
Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By:
Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By:
Rich Trott <rtrott@gmail.com> Reviewed-By:
Anna Henningsen <anna@addaleax.net>
-
Kyle Farnung authored
The `v8::PersistentBase<T>.Get` method didn't exist in node 4 and it's just a helper which creates a new `v8::Local` from the given object. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14211 Reviewed-By:
Timothy Gu <timothygu99@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
Anna Henningsen authored
Ref: https://github.com/nodejs/node/issues/14379 Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14393 Reviewed-By:
Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Timothy Gu <timothygu99@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
Vse Mozhet Byt authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14400 Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Luigi Pinca <luigipinca@gmail.com> Reviewed-By:
Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By:
Khaidi Chu <i@2333.moe> Reviewed-By:
James M Snell <jasnell@gmail.com>
-
Song, Bintao Garfield authored
Replace the string concat at test/addons-napi/test_reference/test.js. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14269 Reviewed-By:
Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By:
Rich Trott <rtrott@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com>
-
Kyle Farnung authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13971 Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com>
-
Michael Dawson authored
In support of the effort to add error codes to all errors generated by Node.js, add an optional code parameter to the helper functions used to throw/create errors in N-API. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13988 Fixes: https://github.com/nodejs/node/issues/13933 Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Anna Henningsen <anna@addaleax.net>
-
cjihrig authored
The N-API test testInstanceOf.js relies on several V8 test files which may not exist in downloadable archives. If the files are missing, this commit causes a warning to be emitted rather than failing the test. Refs: https://github.com/nodejs/node/issues/14113 Fixes: https://github.com/nodejs/node/issues/13344 Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14123 Reviewed-By:
Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By:
Michaël Zasso <targos@protonmail.com> Reviewed-By:
Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By:
James M Snell <jasnell@gmail.com>
-
Kyle Farnung authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14095 Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Timothy Gu <timothygu99@gmail.com> Reviewed-By:
Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By:
Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com>
-
Gabriel Schulhof authored
Use a stronger criterion to identify objects in the prototype chain that store pointers to native data that were added by previous calls to `napi_wrap()`. Whereas the old criterion for identifying `napi_wrap()`-injected prototype chain objects was to consider an object with an internal field count of 1 to be such an object, the new criterion is to consider an object with an internal field count of 2 such that the second field holds a `v8::External` which itself contains a pointer to a global static string unique to N-API to be a `napi_wrap()`-injected prototype chain object. This greatly reduces the possibility of returning a pointer that was not previously added with `napi_wrap()`, and it allows us to recognize that an object has already undergone `napi_wrap()` and we can thus prevent a chain of wrappers only the first of which is accessible from appearing in the prototype chain, as would be the result of multiple calls to `napi_wrap()` using the same object. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13872 Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By:
Timothy Gu <timothygu99@gmail.com>
-
Daniel Bevenius authored
Currently the following warning is issued when buildning: Building addon /work/nodejs/node/test/addons-napi/test_general/ CC(target) Debug/obj.target/test_general/test_general.o ../test_general.c:116:14: warning: variable 'result' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] } else if (argument_type == napi_null) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../test_general.c:119:10: note: uninitialized use occurs here return result; ^~~~~~ ../test_general.c:116:10: note: remove the 'if' if its condition is always true } else if (argument_type == napi_null) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../test_general.c:101:20: note: initialize the variable 'result' to silence this warning napi_value result; ^ = NULL This commit simply initializes result to NULL to avoid this warning. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14104 Reviewed-By:Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com>
-
cjihrig authored
Refs: https://github.com/nodejs/node/issues/13925 Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14063 Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
-
Gabriel Schulhof authored
V8 caches and does not subsequently release `ObjectTemplate` instances. Thus, we need to store the `ObjectTemplate` from which we derive object instances we use for `napi_wrap()` and function/accessor context in a persistent in the `napi_env`. https://github.com/nodejs/node-addon-api/pull/70#discussion_r124998408 Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13999 Reviewed-By:
Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.co> Reviewed-By:
Hitesh Kanwathirtha <digitalinfinity@gmail.com>
-
Michael Dawson authored
We had some, but not complete coverage indirectly through other tests. Add test to validate it specifically and covers cases that were not being covered. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13990 Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com>
-
Ben Noordhuis authored
Not an actual bug, as far as I can tell, the compiler is simply not smart enough to figure out that the offending code path isn't reached with an uninitialized value. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14053 Reviewed-By:
Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By:
Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By:
Michaël Zasso <targos@protonmail.com>
-
Ben Noordhuis authored
Fixes the following deprecation warning: ../src/node_api.cc:2020:30: warning: 'bool v8::Object::SetPrototype(v8::Local<v8::Value>)' is deprecated: Use maybe version [-Wdeprecated-declarations] wrapper->SetPrototype(proto); ../src/node_api.cc:2021:28: warning: 'bool v8::Object::SetPrototype(v8::Local<v8::Value>)' is deprecated: Use maybe version [-Wdeprecated-declarations] obj->SetPrototype(wrapper); Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14053 Reviewed-By:Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By:
Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By:
Michaël Zasso <targos@protonmail.com>
-
cjihrig authored
Fixes: https://github.com/nodejs/node/issues/13924 Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13934 Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
cjihrig authored
Refs: https://github.com/nodejs/node/issues/13924 Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13949 Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
cjihrig authored
Refs: https://github.com/nodejs/node/issues/13925 Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13961 Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Evan Lucas <evanlucas@me.com> Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com>
-
Kyle Farnung authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13972 Reviewed-By:
Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By:
Richard Lau <riclau@uk.ibm.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com>
-
Michael Dawson authored
Document the lifetime of the structure returned by napi_get_last_error_info Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13939 Fixes: https://github.com/nodejs/abi-stable-node/issues/251 Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By:
Hitesh Kanwathirtha <digitalinfinity@gmail.com>
-
Michael Dawson authored
V8 will crash if escape is called twice on the same scope. Add checks to avoid crashing if napi_escape_scope() is called to try and do this. Add test that tries to call napi_create_scope() twice. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13651 Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Ben Noordhuis <info@bnoordhuis.nl>
-
Michael Dawson authored
- Add doc for napi_create_string_latin1(). - Fix signatures where c string was specified instead of napi_value. - Fix return type of napi_callback. - Update to specify that napi_escape_handle() can only be called once for a given scope. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13650 Fixes: https://github.com/nodejs/node/issues/13555 Fixes: https://github.com/nodejs/node/issues/13556 Fixes: https://github.com/nodejs/node/issues/13562 Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
Ingvar Stepanyan <me@rreverser.com>
-
XadillaX authored
The earlier version `napi_callback` returns `void` but now is `napi_value`. The document of this section hasn't been modified. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13570 Fixes: https://github.com/nodejs/node/issues/12248 Fixes: https://github.com/nodejs/node/issues/13562 Reviewed-By:
Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
James M Snell <jasnell@gmail.com>
-
Jamen Marzonie authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13544 Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Anna M. Kedzierska <anna.m.kedzierska@gmail.com> Reviewed-By:
Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
Michael Dawson authored
We did not have test coverage for using a napi_value pointing to a string or symbol for the name when creating a property. Add that coverage. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13510 Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
Michael Dawson authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13508 Fixes: https://github.com/nodejs/node/issues/13469 Fixes: https://github.com/nodejs/node/issues/13458 Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
Jamen Marz authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13484 Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Luigi Pinca <luigipinca@gmail.com> Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com>
-
Michael Dawson authored
Since its guarded in by a command line option say that in the docs and provide the option that needs to be used to enable it. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13406 Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Tobias Nießn <tniessen@tnie.de> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
Gibson Fahnestock <gibfahn@gmail.com>
-
Jason Ginchereau authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13412 Reviewed-By:
Anna Henningsen <anna@addaleax.net>
-
Michael Dawson authored
It takes time to build each of the addons used to test n-api. Consolidate a few of the smaller ones to save build time. Get rid of one more small addon. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13380 Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com>
-
Michael Dawson authored
It takes time to build each of the addons used to test n-api. Consolidate a few of the smaller ones to save build time. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13317 Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com>
-
Jason Ginchereau authored
Previously, napi_wrap() would only work with objects created from a constructor returned by napi_define_class(). While the N-API team was aware of this limitation, it was not clearly documented and is likely to cause confusion anyway. It's much simpler if addons are allowed to use any JS object. Also, the specific behavior of the limitation is difficult to reimplement on other VMs that work differently from V8. V8 requires object internal fields to be declared on the object prototype (which napi_define_class() used to do). Since it's too late to modify the object prototype by the time napi_wrap() is called, napi_wrap() now inserts a new object (with the internal field) into the supplied object's prototype chain. Then it can be retrieved from there later by napi_unwrap(). This change also includes improvements to the documentation for napi_create_external(), partly to explain how it is different from napi_wrap(). Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13250 Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com>
-
JongChan Choi authored
Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13323 Reviewed-By:
Luigi Pinca <luigipinca@gmail.com>
-
Jason Ginchereau authored
One of the N-API weak-reference test cases already had to be made asynchronous to handle different behavior in a newer V8 version: https://github.com/nodejs/node/pull/12864 When porting N-API to Node-ChakraCore, we found more of the test cases needed similar treatment: https://github.com/nodejs/node-chakracore/issues/246 So to make thes tests more robust (and avoid having differences in the test code for Node-ChakraCore), I am refactoring the tests in this file to insert a `setImmedate()` callback before every call to `gc()` and assertions about the effects of the GC. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13121 Reviewed-By:
Michael Dawson <michael_dawson@ca.ibm.com>
-
Michael Dawson authored
Add testing for all types of typed arrays. Add testing for napi_is_arraybuffer. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13244 Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Kunal Pathak <kunal.pathak@microsoft.com> Reviewed-By:
Hitesh Kanwathirtha <digitalinfinity@gmail.com>
-
Michael Dawson authored
Add napi_get_version function so that addons can query the level of N-API supported. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13207 Fixes: https://github.com/nodejs/abi-stable-node/issues/231 Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
Michael Dawson authored
Add test to cover napi_has_named_property Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13178 Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com>
-
Daniel Bevenius authored
Really minor but I could not find an open PR for anything n-api where this could be changed, so creating this so that it is not forgotten. Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13190 Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Michael Dawson <mhdawson@ibm.com> Reviewed-By:
James M Snell <jasnell@gmail.com>
-
Michael Dawson authored
Add tests to validate that properties marked as static are available through the class as opposed to instances Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/13124 Reviewed-By:
Jason Ginchereau <jasongin@microsoft.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Anna Henningsen <anna@addaleax.net> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Hitesh Kanwathirtha <digitalinfinity@gmail.com>
-