[PATCH v5 04/11] jscript: Use string hint when retrieving the default value primitive in IE10+.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Fri Nov 19 12:03:44 CST 2021
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/jscript/dispex.c | 2 +-
dlls/jscript/jscript.h | 3 ++-
dlls/mshtml/script.c | 5 ++++-
dlls/mshtml/tests/documentmode.js | 1 -
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index a3da9fa..7365100 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -1789,7 +1789,7 @@ HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *b
HRESULT jsdisp_builtin_get_default_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
- HRESULT hres = to_primitive(ctx, jsval_obj(jsthis), r, NO_HINT);
+ HRESULT hres = to_primitive(ctx, jsval_obj(jsthis), r, ctx->version > SCRIPTLANGUAGEVERSION_ES5 ? HINT_STRING : NO_HINT);
return hres == JS_E_TO_PRIMITIVE ? DISP_E_MEMBERNOTFOUND : hres;
}
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index d37fbd1..4d17b2f 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 954dafd..38a9545 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