Commit 4e77355f authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

mshtml: Fix HTMLWindow3_setInterval behavior on 0 msec intervals.

parent c766386f
......@@ -1096,7 +1096,7 @@ HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
void flush_pending_tasks(LONG) DECLSPEC_HIDDEN;
HRESULT set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
......
......@@ -183,7 +183,7 @@ static BOOL queue_timer(thread_data_t *thread_data, task_timer_t *timer)
return FALSE;
}
HRESULT set_task_timer(HTMLInnerWindow *window, DWORD msec, BOOL interval, IDispatch *disp, LONG *id)
HRESULT set_task_timer(HTMLInnerWindow *window, LONG msec, BOOL interval, IDispatch *disp, LONG *id)
{
thread_data_t *thread_data;
task_timer_t *timer;
......@@ -199,6 +199,9 @@ HRESULT set_task_timer(HTMLInnerWindow *window, DWORD msec, BOOL interval, IDisp
if(!timer)
return E_OUTOFMEMORY;
if(msec < 1)
msec = 1;
timer->id = id_cnt++;
timer->window = window;
timer->time = tc + msec;
......
......@@ -2259,6 +2259,25 @@ static void test_timeout(IHTMLDocument2 *doc)
hres = IHTMLWindow2_clearTimeout(window, id);
ok(hres == S_OK, "clearTimeout failed: %08x\n", hres);
V_VT(&expr) = VT_DISPATCH;
V_DISPATCH(&expr) = (IDispatch*)&timeoutFunc;
V_VT(&var) = VT_EMPTY;
id = 0;
hres = IHTMLWindow3_setInterval(win3, &expr, 1, &var, &id);
ok(hres == S_OK, "setInterval failed: %08x\n", hres);
ok(id, "id = 0\n");
SET_EXPECT(timeout);
pump_msgs(&called_timeout);
CHECK_CALLED(timeout);
SET_EXPECT(timeout);
pump_msgs(&called_timeout);
CHECK_CALLED(timeout);
hres = IHTMLWindow2_clearInterval(window, id);
ok(hres == S_OK, "clearTimeout failer: %08x\n", hres);
IHTMLWindow3_Release(win3);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment