[PATCH v7 03/11] jscript: Throw when defining a PROTREF prop on a non-extensible object.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Wed Nov 24 08:10:32 CST 2021
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/jscript/dispex.c | 2 +-
dlls/mshtml/tests/es5.js | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index ad6623f..8c0d84b 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -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)))
diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js
index 81c06a4..ede9419 100644
--- a/dlls/mshtml/tests/es5.js
+++ b/dlls/mshtml/tests/es5.js
@@ -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);
--
2.31.1
More information about the wine-devel
mailing list