0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/js-native-api
Gabriel Schulhof cc7ec889e8 n-api: support type-tagging objects
`napi_instanceof()` is insufficient for reliably establishing the data
type to which a pointer stored with `napi_wrap()` or
`napi_create_external()` inside a JavaScript object points. Thus, we
need a way to "mark" an object with a value that, when later retrieved,
can unambiguously tell us whether it is safe to cast the pointer stored
inside it to a certain structure.

Such a check must survive loading/unloading/multiple instances of an
addon, so we use UUIDs chosen *a priori*.

Fixes: https://github.com/nodejs/node/issues/28164
Co-authored-by: Anna Henningsen <github@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/28237
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
2020-07-31 18:30:30 -07:00
..
2_function_arguments
3_callbacks
4_object_factory
5_function_factory
6_object_wrap
7_factory_wrap n-api: run all finalizers via SetImmediate() 2020-07-23 23:28:09 -07:00
8_passing_wrapped n-api: run all finalizers via SetImmediate() 2020-07-23 23:28:09 -07:00
test_array
test_bigint n-api: simplify bigint-from-word creation 2020-07-31 13:45:25 -07:00
test_constructor
test_conversions test: add n-api null checks for conversions 2020-07-08 10:32:16 -07:00
test_dataview
test_date
test_error
test_exception n-api: run all finalizers via SetImmediate() 2020-07-23 23:28:09 -07:00
test_function
test_general n-api: run all finalizers via SetImmediate() 2020-07-23 23:28:09 -07:00
test_handle_scope
test_instance_data
test_new_target
test_number
test_object n-api: support type-tagging objects 2020-07-31 18:30:30 -07:00
test_promise
test_properties
test_reference n-api: run all finalizers via SetImmediate() 2020-07-23 23:28:09 -07:00
test_string
test_symbol
test_typedarray
.gitignore
common.c
common.h
entry_point.c
testcfg.py