Module: wine Branch: master Commit: fa43b8cac91b1399fa3216348734bcf064c784b9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fa43b8cac91b1399fa32163487...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Nov 20 13:15:56 2015 +0100
mshtml: Make msec argument of setTimeout optional.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mshtml/htmlwindow.c | 27 ++++++++++++++++++++++++++- dlls/mshtml/tests/jstest.html | 5 +++-- 2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 280a5d7..5ed22c0 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 528c2e1..f0d3e3b 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(); } </script> <body onload="runTest();">