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>
parent
212d17fa
Please register or sign in to comment