Gabriel Ivăncescu : jscript: Throw when defining a PROTREF prop on a non-extensible object.
Alexandre Julliard
julliard at winehq.org
Wed Nov 24 15:17:18 CST 2021
Module: wine
Branch: master
Commit: 3f135a0611d4fbcffc62481ae4a3695efefb0f66
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3f135a0611d4fbcffc62481ae4a3695efefb0f66
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Wed Nov 24 16:10:32 2021 +0200
jscript: Throw when defining a PROTREF prop on a non-extensible object.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 ad6623f2648..8c0d84b8023 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 81c06a4145e..ede94191ab6 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);
More information about the wine-cvs
mailing list