mshtml: Fix HTMLWindow3_setInterval behavior on 0 msec intervals.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2016-05-02 15:39:28 +02:00 committed by Alexandre Julliard
parent c766386f36
commit 4e77355f3a
3 changed files with 24 additions and 2 deletions

View File

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

View File

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

View File

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