diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index d4bf1233034..9cca37670f1 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 1a16c56f956..823f4f9dc06 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 = '
'; @@ -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