Gabriel Ivăncescu : jscript: Return the correct string for Object.toString(null) in ES5+ modes.

Alexandre Julliard julliard at winehq.org
Fri Mar 18 16:39:55 CDT 2022


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

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Fri Mar 18 17:24:09 2022 +0200

jscript: Return the correct string for Object.toString(null) in ES5+ modes.

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/object.c             | 5 ++++-
 dlls/mshtml/tests/documentmode.js | 2 +-
 dlls/mshtml/tests/es5.js          | 1 -
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c
index 3b5a1f8310a..0f5f2c105e3 100644
--- a/dlls/jscript/object.c
+++ b/dlls/jscript/object.c
@@ -57,7 +57,10 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
     TRACE("\n");
 
     if(is_undefined(vthis) || is_null(vthis)) {
-        str = L"[object Object]";
+        if(ctx->version < SCRIPTLANGUAGEVERSION_ES5)
+            str = L"[object Object]";
+        else
+            str = is_null(vthis) ? L"[object Null]" : L"[object Object]";
         goto set_output;
     }
 
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index ddcb738ab26..243a8faf263 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -1243,7 +1243,7 @@ sync_test("elem_attr", function() {
     r = elem.removeAttribute("ondblclick");
     ok(r === (v < 8 ? false : (v < 9 ? true : undefined)), "ondblclick removeAttribute returned " + r);
     r = Object.prototype.toString.call(elem.ondblclick);
-    todo_wine_if(v >= 9).
+    todo_wine_if(v >= 11).
     ok(r === (v < 8 ? "[object Array]" : (v < 9 ? "[object Object]" : (v < 11 ? "[object Null]" : "[object Function]"))),
         "removed ondblclick Object.toString returned " + r);
 
diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js
index 0fa6f7fc175..98d14303d70 100644
--- a/dlls/mshtml/tests/es5.js
+++ b/dlls/mshtml/tests/es5.js
@@ -805,7 +805,6 @@ sync_test("toString", function() {
     todo_wine.
     ok(tmp === "[object Window]", "toString.call(null) = " + tmp);
     tmp = Object.prototype.toString.call(null);
-    todo_wine.
     ok(tmp === "[object Null]", "toString.call(null) = " + tmp);
     tmp = Object.prototype.toString.call(undefined);
     todo_wine.




More information about the wine-cvs mailing list