-
Notifications
You must be signed in to change notification settings - Fork 204
Closed
Description
JS_IsArray currently has this prototype:
/* return -1 if exception (proxy case) or true/false */
int JS_IsArray(JSContext *ctx, JSValue val)
That's jarringly different from JS_IsObject/JS_IsPromise/etc. and returning a ternary instead of a boolean like the other functions is a bug magnet.
The reason it takes a JSContext pointer as its first argument is because it transparently handles proxies and guards against stack overflow in case the proxy's target object loops back on itself.
I don't think it should try to handle proxies because that's inconsistent. Neither JS_IsObject or JS_IsPromise do that, for example.
My proposal:
-
definitely remove proxy handling from JS_IsArray
-
optionally add a JS_IsProxy function and maybe JS_GetProxyTarget + JS_GetProxyHandler?
saghul
Metadata
Metadata
Assignees
Labels
No labels