Jacek Caban : mshtml: Use SCRIPTLANGUAGEVERSION_5_7 for IE7 and IE5 compatibility mode.

Alexandre Julliard julliard at winehq.org
Thu Mar 1 13:34:45 CST 2018


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Mar  1 19:18:10 2018 +0100

mshtml: Use SCRIPTLANGUAGEVERSION_5_7 for IE7 and IE5 compatibility mode.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/script.c              |  7 +++++--
 dlls/mshtml/tests/documentmode.js | 20 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c
index d4bf123..9cca376 100644
--- a/dlls/mshtml/script.c
+++ b/dlls/mshtml/script.c
@@ -114,9 +114,10 @@ static void set_script_prop(ScriptHost *script_host, DWORD property, VARIANT *va
 
 static BOOL init_script_engine(ScriptHost *script_host)
 {
+    compat_mode_t compat_mode;
     IObjectSafety *safety;
     SCRIPTSTATE state;
-    DWORD supported_opts=0, enabled_opts=0;
+    DWORD supported_opts=0, enabled_opts=0, script_mode;
     VARIANT var;
     HRESULT hres;
 
@@ -149,8 +150,10 @@ static BOOL init_script_engine(ScriptHost *script_host)
     if(FAILED(hres))
         return FALSE;
 
+    compat_mode = lock_document_mode(script_host->window->doc);
+    script_mode = compat_mode < COMPAT_MODE_IE8 ? SCRIPTLANGUAGEVERSION_5_7 : SCRIPTLANGUAGEVERSION_5_8;
     V_VT(&var) = VT_I4;
-    V_I4(&var) = lock_document_mode(script_host->window->doc) == COMPAT_MODE_QUIRKS ? 1 : 2;
+    V_I4(&var) = script_mode;
     set_script_prop(script_host, SCRIPTPROP_INVOKEVERSIONING, &var);
 
     V_VT(&var) = VT_BOOL;
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 1a16c56..823f4f9 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -106,6 +106,25 @@ function test_xhr_props() {
     next_test();
 }
 
+function test_javascript() {
+    var g = window;
+
+    function test_exposed(func, obj, expect) {
+        if(expect)
+            ok(func in obj, func + " not found in " + obj);
+        else
+            ok(!(func in obj), func + " found in " + obj);
+    }
+
+    var v = document.documentMode;
+
+    test_exposed("ScriptEngineMajorVersion", g, true);
+
+    test_exposed("JSON", g, v >= 8);
+
+    next_test();
+}
+
 function test_elem_by_id() {
     document.body.innerHTML = '<form id="testid" name="testname"></form>';
 
@@ -196,6 +215,7 @@ var tests = [
     test_elem_props,
     test_doc_props,
     test_window_props,
+    test_javascript,
     test_xhr_props,
     test_elem_by_id,
     test_conditional_comments




More information about the wine-cvs mailing list