mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-29 22:44:25 +03:00
fixed define own property with writable=false on module namespace
This commit is contained in:
10
quickjs.c
10
quickjs.c
@@ -9081,15 +9081,19 @@ int JS_DefineProperty(JSContext *ctx, JSValueConst this_obj,
|
||||
spaces. */
|
||||
if (!js_same_value(ctx, val, *pr->u.var_ref->pvalue))
|
||||
goto not_configurable;
|
||||
} else {
|
||||
/* update the reference */
|
||||
set_value(ctx, pr->u.var_ref->pvalue,
|
||||
JS_DupValue(ctx, val));
|
||||
}
|
||||
/* update the reference */
|
||||
set_value(ctx, pr->u.var_ref->pvalue,
|
||||
JS_DupValue(ctx, val));
|
||||
}
|
||||
/* if writable is set to false, no longer a
|
||||
reference (for mapped arguments) */
|
||||
if ((flags & (JS_PROP_HAS_WRITABLE | JS_PROP_WRITABLE)) == JS_PROP_HAS_WRITABLE) {
|
||||
JSValue val1;
|
||||
if (p->class_id == JS_CLASS_MODULE_NS) {
|
||||
return JS_ThrowTypeErrorOrFalse(ctx, flags, "module namespace properties have writable = false");
|
||||
}
|
||||
if (js_shape_prepare_update(ctx, p, &prs))
|
||||
return -1;
|
||||
val1 = JS_DupValue(ctx, *pr->u.var_ref->pvalue);
|
||||
|
Reference in New Issue
Block a user