diff --git a/dlls/mshtml/tests/jstest.html b/dlls/mshtml/tests/jstest.html
index 3363c5ae8ca..b977ad3e29b 100644
--- a/dlls/mshtml/tests/jstest.html
+++ b/dlls/mshtml/tests/jstest.html
@@ -31,6 +31,8 @@ function test_select_index() {
ok(s[2] === null, "s[2] = " + s[2]);
}
+var globalVar = false;
+
function runTest() {
obj = new Object();
ok(obj === window.obj, "obj !== window.obj");
@@ -41,6 +43,10 @@ function runTest() {
test_removeAttribute(document.body);
test_select_index();
+ var r = window.execScript("globalVar = true;");
+ ok(r === undefined, "execScript returned " + r);
+ ok(globalVar === true, "globalVar = " + globalVar);
+
external.reportSuccess();
}
diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c
index 23f1ab861c7..4da0df7d151 100644
--- a/dlls/mshtml/tests/script.c
+++ b/dlls/mshtml/tests/script.c
@@ -113,7 +113,8 @@ DEFINE_EXPECT(SetScriptState_STARTED);
DEFINE_EXPECT(SetScriptState_CONNECTED);
DEFINE_EXPECT(SetScriptState_DISCONNECTED);
DEFINE_EXPECT(AddNamedItem);
-DEFINE_EXPECT(ParseScriptText);
+DEFINE_EXPECT(ParseScriptText_script);
+DEFINE_EXPECT(ParseScriptText_execScript);
DEFINE_EXPECT(GetScriptDispatch);
DEFINE_EXPECT(funcDisp);
DEFINE_EXPECT(script_divid_d);
@@ -423,7 +424,7 @@ static HRESULT WINAPI scriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
return E_FAIL;
}
- ok(0, "unexpected call\n");
+ ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName));
return E_NOTIMPL;
}
@@ -1732,10 +1733,7 @@ static void test_global_id(void)
VariantClear(&var);
}
-static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *iface,
- LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext,
- LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine,
- DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
+static void test_script_run(void)
{
IDispatchEx *document, *dispex;
IHTMLWindow2 *window;
@@ -1752,8 +1750,6 @@ static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *ifac
static const WCHAR testW[] = {'t','e','s','t',0};
static const WCHAR funcW[] = {'f','u','n','c',0};
- CHECK_EXPECT(ParseScriptText);
-
SET_EXPECT(GetScriptDispatch);
tmp = SysAllocString(documentW);
@@ -1943,8 +1939,38 @@ static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *ifac
test_global_id();
test_security();
+}
- return S_OK;
+static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *iface,
+ LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext,
+ LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine,
+ DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
+{
+ ok(!punkContext, "punkContext = %p\n", punkContext);
+ ok(pvarResult != NULL, "pvarResult == NULL\n");
+ ok(pexcepinfo != NULL, "pexcepinfo == NULL\n");
+
+ if(!strcmp_wa(pstrCode, "execScript call")) {
+ CHECK_EXPECT(ParseScriptText_execScript);
+ ok(!pstrItemName, "pstrItemName = %s\n", wine_dbgstr_w(pstrItemName));
+ ok(!strcmp_wa(pstrDelimiter, "\""), "pstrDelimiter = %s\n", wine_dbgstr_w(pstrDelimiter));
+ ok(dwFlags == SCRIPTTEXT_ISVISIBLE, "dwFlags = %x\n", dwFlags);
+
+ V_VT(pvarResult) = VT_I4;
+ V_I4(pvarResult) = 10;
+ return S_OK;
+ }else if(!strcmp_wa(pstrCode, "simple script")) {
+ CHECK_EXPECT(ParseScriptText_script);
+ ok(!strcmp_wa(pstrItemName, "window"), "pstrItemName = %s\n", wine_dbgstr_w(pstrItemName));
+ ok(!strcmp_wa(pstrDelimiter, ""), "pstrDelimiter = %s\n", wine_dbgstr_w(pstrDelimiter));
+ ok(dwFlags == (SCRIPTTEXT_ISVISIBLE|SCRIPTTEXT_HOSTMANAGESSOURCE), "dwFlags = %x\n", dwFlags);
+
+ test_script_run();
+ return S_OK;
+ }
+
+ ok(0, "unexpected script %s\n", wine_dbgstr_w(pstrCode));
+ return E_FAIL;
}
static const IActiveScriptParseVtbl ActiveScriptParseVtbl = {
@@ -2265,6 +2291,38 @@ static const char simple_script_str[] =
""
"