added more C callbacks for exotic objects (#324)

This commit is contained in:
Fabrice Bellard
2025-04-26 12:25:42 +02:00
parent 7645ce5f63
commit 1b13fa6450
2 changed files with 67 additions and 41 deletions

View File

@@ -501,6 +501,17 @@ typedef struct JSClassExoticMethods {
/* return < 0 if exception or TRUE/FALSE */
int (*set_property)(JSContext *ctx, JSValueConst obj, JSAtom atom,
JSValueConst value, JSValueConst receiver, int flags);
/* To get a consistent object behavior when get_prototype != NULL,
get_property, set_property and set_prototype must be != NULL
and the object must be created with a JS_NULL prototype. */
JSValue (*get_prototype)(JSContext *ctx, JSValueConst obj);
/* return < 0 if exception or TRUE/FALSE */
int (*set_prototype)(JSContext *ctx, JSValueConst obj, JSValueConst proto_val);
/* return < 0 if exception or TRUE/FALSE */
int (*is_extensible)(JSContext *ctx, JSValueConst obj);
/* return < 0 if exception or TRUE/FALSE */
int (*prevent_extensions)(JSContext *ctx, JSValueConst obj);
} JSClassExoticMethods;
typedef void JSClassFinalizer(JSRuntime *rt, JSValue val);