mshtml: Make msec argument of setTimeout optional.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2015-11-20 13:15:56 +01:00 committed by Alexandre Julliard
parent 062bbb91a7
commit fa43b8cac9
2 changed files with 29 additions and 3 deletions

View File

@ -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);
}

View File

@ -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();
}
</script>
<body onload="runTest();">