mshtml: Make it possible to clear timer and interval with any of clearTimeout and clearInterval functions.

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:34 +02:00 committed by Alexandre Julliard
parent 4e77355f3a
commit 60fe748543
4 changed files with 44 additions and 5 deletions

View File

@ -584,7 +584,7 @@ static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, LONG timerID
TRACE("(%p)->(%d)\n", This, timerID);
return clear_task_timer(This->inner_window, FALSE, timerID);
return clear_task_timer(This->inner_window, timerID);
}
#define MAX_MESSAGE_LEN 2000
@ -1374,7 +1374,7 @@ static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, LONG timerI
TRACE("(%p)->(%d)\n", This, timerID);
return clear_task_timer(This->inner_window, TRUE, timerID);
return clear_task_timer(This->inner_window, timerID);
}
static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v)

View File

@ -1097,7 +1097,7 @@ void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
void flush_pending_tasks(LONG) DECLSPEC_HIDDEN;
HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;

View File

@ -218,7 +218,7 @@ HRESULT set_task_timer(HTMLInnerWindow *window, LONG msec, BOOL interval, IDispa
return S_OK;
}
HRESULT clear_task_timer(HTMLInnerWindow *window, BOOL interval, DWORD id)
HRESULT clear_task_timer(HTMLInnerWindow *window, DWORD id)
{
thread_data_t *thread_data = get_thread_data(FALSE);
task_timer_t *iter;
@ -227,7 +227,7 @@ HRESULT clear_task_timer(HTMLInnerWindow *window, BOOL interval, DWORD id)
return S_OK;
LIST_FOR_EACH_ENTRY(iter, &thread_data->timer_list, task_timer_t, entry) {
if(iter->id == id && iter->window == window && !iter->interval == !interval) {
if(iter->id == id && iter->window == window) {
release_task_timer(thread_data->thread_hwnd, iter);
return S_OK;
}

View File

@ -1442,6 +1442,34 @@ static const IDispatchExVtbl timeoutFuncVtbl = {
static IDispatchEx timeoutFunc = { &timeoutFuncVtbl };
static HRESULT WINAPI timeoutFunc2_Invoke(IDispatchEx *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
ok(0, "unexpected call\n");
return E_FAIL;
}
static const IDispatchExVtbl timeoutFunc2Vtbl = {
DispatchEx_QueryInterface,
DispatchEx_AddRef,
DispatchEx_Release,
DispatchEx_GetTypeInfoCount,
DispatchEx_GetTypeInfo,
DispatchEx_GetIDsOfNames,
timeoutFunc2_Invoke,
DispatchEx_GetDispID,
DispatchEx_InvokeEx,
DispatchEx_DeleteMemberByName,
DispatchEx_DeleteMemberByDispID,
DispatchEx_GetMemberProperties,
DispatchEx_GetMemberName,
DispatchEx_GetNextDispID,
DispatchEx_GetNameSpaceParent
};
static IDispatchEx timeoutFunc2 = { &timeoutFunc2Vtbl };
static HRESULT WINAPI div_onclick_disp_Invoke(IDispatchEx *iface, DISPID id,
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
VARIANT *pvarRes, EXCEPINFO *pei, UINT *puArgErr)
@ -2236,6 +2264,17 @@ static void test_timeout(IHTMLDocument2 *doc)
hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow3, (void**)&win3);
ok(hres == S_OK, "Could not get IHTMLWindow3 iface: %08x\n", hres);
V_VT(&expr) = VT_DISPATCH;
V_DISPATCH(&expr) = (IDispatch*)&timeoutFunc2;
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");
hres = IHTMLWindow2_clearTimeout(window, id);
ok(hres == S_OK, "clearTimeout failer: %08x\n", hres);
V_VT(&expr) = VT_DISPATCH;
V_DISPATCH(&expr) = (IDispatch*)&timeoutFunc;
V_VT(&var) = VT_EMPTY;