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.
Follow-up from the native
fetch()polyfill review (#188).napi_typeofinjs_native_api_javascriptcore.ccdecides function-ness solely viaJSObjectIsFunction, which returnsfalsefor constructors created withJSObjectMakeConstructoron some JSC builds (e.g. libjavascriptcoregtk). As a result it reportsnapi_objectwhere V8 returnsnapi_function, so NapiIsFunction()incorrectly rejects otherwise-valid constructors (e.g. theBlobpolyfill).Both the Fetch polyfill (#188) and the File polyfill currently carry an identical
IsUndefined()/IsNull()workaround to detect the constructor withoutIsFunction().A fix in
napi_typeof(also consultingJSObjectIsConstructorin addition toJSObjectIsFunction) would let both polyfills drop the workaround rather than spreading per-polyfill copies.