[PATCH v3 2/3] jscript: Use default object prototype if it's null.

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Mar 11 10:01:09 CST 2021


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 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 f3eba68..a1a1af5 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 211ae2f..94c3329 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();
-- 
2.30.0




More information about the wine-devel mailing list