You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Node-API-JSC: napi_typeof reports napi_object for JSObjectMakeConstructor constructors #194
Follow-up from the native fetch() polyfill review (#188).
napi_typeof in js_native_api_javascriptcore.cc decides function-ness solely via JSObjectIsFunction, which returns false for constructors created with JSObjectMakeConstructor on some JSC builds (e.g. libjavascriptcoregtk). As a result it reports napi_object where V8 returns napi_function, so Napi IsFunction() incorrectly rejects otherwise-valid constructors (e.g. the Blob polyfill).
Both the Fetch polyfill (#188) and the File polyfill currently carry an identical IsUndefined()/IsNull() workaround to detect the constructor without IsFunction().
A fix in napi_typeof (also consulting JSObjectIsConstructor in addition to JSObjectIsFunction) would let both polyfills drop the workaround rather than spreading per-polyfill copies.
That PR changed napi_typeof in Core/Node-API/Source/js_native_api_javascriptcore.cc to consult JSObjectIsConstructor in addition to JSObjectIsFunction, so constructors created via JSObjectMakeConstructor (i.e. node-addon-api DefineClass constructors) now report napi_function on JSC builds such as libjavascriptcoregtk, matching V8.
With that in place the IsUndefined()/IsNull() workarounds carried by the Fetch (#188) and File polyfills were removed in the same PR.
Activity
Address review: fix napi_typeof for JSC constructors (BabylonJS#194) …
bkaradzic-microsoft commentedon Aug 18, 2026
Fixed by #207 (merged 2026-07-28).
That PR changed
napi_typeofinCore/Node-API/Source/js_native_api_javascriptcore.ccto consultJSObjectIsConstructorin addition toJSObjectIsFunction, so constructors created viaJSObjectMakeConstructor(i.e. node-addon-apiDefineClassconstructors) now reportnapi_functionon JSC builds such as libjavascriptcoregtk, matching V8.With that in place the
IsUndefined()/IsNull()workarounds carried by the Fetch (#188) and File polyfills were removed in the same PR.Closing as completed.