node/test/js-native-api/test_object
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
..
binding.gyp test: cover property n-api null cases 2020-01-25 21:23:05 -08:00
test_null.c n-api: define release 6 2020-03-09 11:58:51 -07:00
test_null.h test: cover property n-api null cases 2020-01-25 21:23:05 -08:00
test_null.js test: cover property n-api null cases 2020-01-25 21:23:05 -08:00
test_object.c n-api: support type-tagging objects 2020-07-31 18:30:30 -07:00
test.js n-api: support type-tagging objects 2020-07-31 18:30:30 -07:00