diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 280a5d75c38..5ed22c0aea7 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -2628,10 +2628,14 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
- if(id == DISPID_IHTMLWINDOW2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT)) {
+ switch(id) {
+ case DISPID_IHTMLWINDOW2_LOCATION: {
HTMLLocation *location;
HRESULT hres;
+ if(!(wFlags & DISPATCH_PROPERTYPUT))
+ break;
+
TRACE("forwarding to location.href\n");
hres = get_location(window, &location);
@@ -2643,6 +2647,27 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
IHTMLLocation_Release(&location->IHTMLLocation_iface);
return hres;
}
+ case DISPID_IHTMLWINDOW2_SETTIMEOUT:
+ case DISPID_IHTMLWINDOW3_SETTIMEOUT: {
+ VARIANT args[2];
+ DISPPARAMS dp = {args, NULL, 2, 0};
+
+ /*
+ * setTimeout calls shoud use default value 0 for the second argument if only one is provided,
+ * but IDL file does not reflect that. We fixup arguments here instead.
+ */
+ if(!(wFlags & DISPATCH_METHOD) || pdp->cArgs != 1 || pdp->cNamedArgs)
+ break;
+
+ TRACE("Fixing args\n");
+
+ V_VT(args) = VT_I4;
+ V_I4(args) = 0;
+ args[1] = *pdp->rgvarg;
+ return IDispatchEx_InvokeEx(&window->event_target.dispex.IDispatchEx_iface, id, lcid,
+ wFlags, &dp, pvarRes, pei, pspCaller);
+ }
+ }
return IDispatchEx_InvokeEx(&window->event_target.dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
}
diff --git a/dlls/mshtml/tests/jstest.html b/dlls/mshtml/tests/jstest.html
index 528c2e10f5b..f0d3e3bf146 100644
--- a/dlls/mshtml/tests/jstest.html
+++ b/dlls/mshtml/tests/jstest.html
@@ -383,6 +383,9 @@ function runTests() {
var r = window.execScript("globalVar = true;");
ok(r === undefined, "execScript returned " + r);
ok(globalVar === true, "globalVar = " + globalVar);
+
+ /* Call setTimeout without specified time. */
+ window.setTimeout(function() { external.reportSuccess(); });
}
function runTest() {
@@ -391,8 +394,6 @@ function runTest() {
}catch(e) {
ok(false, "got exception " + e.message);
}
-
- external.reportSuccess();
}