[PATCH v8 04/11] jscript: Use string hint when retrieving the default value primitive in IE10+.

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Nov 25 08:00:40 CST 2021


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/jscript/dispex.c             | 3 ++-
 dlls/jscript/jscript.h            | 3 ++-
 dlls/mshtml/script.c              | 5 ++++-
 dlls/mshtml/tests/documentmode.js | 1 -
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index 3b4e970..f9cd4ca 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -1608,7 +1608,8 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
         if(prop)
             hres = prop_get(This, prop, &r);
         else {
-            hres = to_primitive(This->ctx, jsval_obj(This), &r, NO_HINT);
+            hres = to_primitive(This->ctx, jsval_obj(This), &r,
+                                This->ctx->version > SCRIPTLANGUAGEVERSION_ES5 ? HINT_STRING : NO_HINT);
             if(hres == JS_E_TO_PRIMITIVE)
                 hres = DISP_E_MEMBERNOTFOUND;
         }
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index c192ec7..47ca3da 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -45,7 +45,8 @@
  * This is Wine jscript extension for ES5 and ES6 compatible mode. Allowed only in HTML mode.
  */
 #define SCRIPTLANGUAGEVERSION_ES5  0x102
-#define SCRIPTLANGUAGEVERSION_ES6  0x103
+#define SCRIPTLANGUAGEVERSION_ES5b 0x103
+#define SCRIPTLANGUAGEVERSION_ES6  0x104
 
 typedef struct _jsval_t jsval_t;
 typedef struct _jsstr_t jsstr_t;
diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c
index 28e07a5..cc6a25b 100644
--- a/dlls/mshtml/script.c
+++ b/dlls/mshtml/script.c
@@ -65,7 +65,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 /* See jscript.h in jscript.dll. */
 #define SCRIPTLANGUAGEVERSION_HTML 0x400
 #define SCRIPTLANGUAGEVERSION_ES5  0x102
-#define SCRIPTLANGUAGEVERSION_ES6  0x103
+#define SCRIPTLANGUAGEVERSION_ES5b 0x103
+#define SCRIPTLANGUAGEVERSION_ES6  0x104
 
 struct ScriptHost {
     IActiveScriptSite              IActiveScriptSite_iface;
@@ -156,6 +157,8 @@ static BOOL init_script_engine(ScriptHost *script_host)
     if(IsEqualGUID(&script_host->guid, &CLSID_JScript)) {
         if(compat_mode >= COMPAT_MODE_IE11)
             script_mode = SCRIPTLANGUAGEVERSION_ES6;
+        else if(compat_mode >= COMPAT_MODE_IE10)
+            script_mode = SCRIPTLANGUAGEVERSION_ES5b;
         else if(compat_mode >= COMPAT_MODE_IE9)
             script_mode = SCRIPTLANGUAGEVERSION_ES5;
         script_mode |= SCRIPTLANGUAGEVERSION_HTML;
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 08fcde4..c2fd8bd 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -1136,7 +1136,6 @@ sync_test("elem_attr", function() {
     ok(r === (v < 8 ? arr : (v < 9 ? "arrval" : null)), "testattr with custom valueOf = " + r);
     elem.setAttribute("testattr", arr);
     r = elem.getAttribute("testattr");
-    todo_wine_if(v >= 10).
     ok(r === (v < 8 ? arr : (v < 10 ? "arrval" : "42")), "testattr after setAttribute with custom valueOf = " + r);
     ok(elem.testattr === arr, "elem.testattr after setAttribute with custom valueOf = " + elem.testattr);
     r = elem.removeAttribute("testattr");
-- 
2.31.1




More information about the wine-devel mailing list