Gabriel Ivăncescu : jscript: Use default object prototype if it's null.

Alexandre Julliard julliard at winehq.org
Thu Mar 11 15:59:37 CST 2021


Module: wine
Branch: master
Commit: ba1f47a77043e8dd214ccdd0b0ee7c76f4ca7467
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ba1f47a77043e8dd214ccdd0b0ee7c76f4ca7467

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Thu Mar 11 18:01:09 2021 +0200

jscript: Use default object prototype if it's null.

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      | 3 +++
 dlls/jscript/tests/lang.js | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index f3eba68b9a4..a1a1af5a141 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -1855,6 +1855,9 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
 
         if(is_object_instance(val) && get_object(val))
             prot = iface_to_jsdisp(get_object(val));
+        else
+            prot = ctx->object_prototype;
+
         jsval_release(val);
     }
 
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index 211ae2f0373..94c33295abb 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -1878,6 +1878,14 @@ testNullPrototype.prototype = nullDisp;
 tmp = new testNullPrototype();
 ok(tmp.x === 13, "tmp.x !== 13");
 ok(!("y" in tmp), "tmp has 'y' property");
+ok(!tmp.hasOwnProperty("y"), "tmp has 'y' property");
+ok(!tmp.propertyIsEnumerable("y"), "tmp has 'y' property enumerable");
+ok(tmp.toString() == "[object Object]", "tmp.toString returned " + tmp.toString());
+testNullPrototype.prototype = null;
+tmp = new testNullPrototype();
+ok(!tmp.hasOwnProperty("y"), "tmp has 'y' property");
+ok(!tmp.propertyIsEnumerable("y"), "tmp has 'y' property enumerable");
+ok(tmp.toString() == "[object Object]", "tmp.toString returned " + tmp.toString());
 
 function do_test() {}
 function nosemicolon() {} nosemicolon();




More information about the wine-cvs mailing list