jscript: Throw when defining a PROTREF prop on a non-extensible object.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2021-11-24 16:10:32 +02:00 committed by Alexandre Julliard
parent 738894a47c
commit 3f135a0611
2 changed files with 7 additions and 1 deletions

View file

@ -2555,7 +2555,7 @@ HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t
if(FAILED(hres))
return hres;
if((!prop || prop->type == PROP_DELETED) && !obj->extensible)
if((!prop || prop->type == PROP_DELETED || prop->type == PROP_PROTREF) && !obj->extensible)
return throw_error(obj->ctx, JS_E_OBJECT_NONEXTENSIBLE, name);
if(!prop && !(prop = alloc_prop(obj, name, PROP_DELETED, 0)))

View file

@ -999,6 +999,12 @@ sync_test("preventExtensions", function() {
ok(o.prop === 1, "o.prop = " + o.prop);
r = Object.isExtensible(o);
ok(r === false, "isExtensible(o) returned " + r);
try {
Object.defineProperty(o, "prop", { value: true });
ok(false, "expected exception");
}catch(e) {
ok(e.name === "TypeError", "got " + e.name + " exception");
}
r = Object.isExtensible({});
ok(r === true, "isExtensible(o) returned " + r);