Commit 142d0f30 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript/tests: Use proper helpers for iface calls.

parent d0b8c6bc
......@@ -30,6 +30,30 @@
#include "wine/test.h"
#ifdef _WIN64
#define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse64_Release
#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
#define IActiveScriptParseProcedure2_Release \
IActiveScriptParseProcedure2_64_Release
#define IActiveScriptParseProcedure2_ParseProcedureText \
IActiveScriptParseProcedure2_64_ParseProcedureText
#else
#define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse32_Release
#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
#define IActiveScriptParseProcedure2_Release \
IActiveScriptParseProcedure2_32_Release
#define IActiveScriptParseProcedure2_ParseProcedureText \
IActiveScriptParseProcedure2_32_ParseProcedureText
#endif
static const CLSID CLSID_JScript =
{0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
......@@ -696,7 +720,7 @@ static void _parse_script_a(unsigned line, IActiveScriptParse *parser, const cha
HRESULT hres;
str = a2bstr(script);
hres = IActiveScriptParse64_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
SysFreeString(str);
ok_(__FILE__,line)(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
}
......@@ -731,7 +755,7 @@ static IActiveScriptParse *create_script(BOOL skip_tests, BOOL use_sec_mgr)
hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parser);
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
......@@ -771,18 +795,18 @@ static IDispatchEx *parse_procedure_a(IActiveScriptParse *parser, const char *sr
BSTR str;
HRESULT hres;
hres = IUnknown_QueryInterface(parser, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc);
hres = IActiveScriptParse_QueryInterface(parser, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc);
ok(hres == S_OK, "Could not get IActiveScriptParseProcedure2: %08x\n", hres);
str = a2bstr(src);
hres = IActiveScriptParseProcedure2_64_ParseProcedureText(parse_proc, str, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, &disp);
hres = IActiveScriptParseProcedure2_ParseProcedureText(parse_proc, str, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, &disp);
SysFreeString(str);
IUnknown_Release(parse_proc);
IActiveScriptParseProcedure2_Release(parse_proc);
ok(hres == S_OK, "ParseProcedureText failed: %08x\n", hres);
ok(disp != NULL, "disp == NULL\n");
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
IDispatch_Release(dispex);
IDispatch_Release(disp);
ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
return dispex;
......@@ -848,7 +872,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(reportSuccess);
IDispatchEx_Release(proc);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
proc = parse_procedure_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();");
......@@ -870,7 +894,7 @@ static void test_ActiveXObject(void)
parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.TestABC'); }, 'Error', -2146827859);");
IDispatchEx_Release(proc);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
QS_SecMgr_hres = E_NOINTERFACE;
......@@ -879,7 +903,7 @@ static void test_ActiveXObject(void)
parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
CHECK_CALLED(Host_QS_SecMgr);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
ProcessUrlAction_hres = E_FAIL;
......@@ -890,7 +914,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(Host_QS_SecMgr);
CHECK_CALLED(ProcessUrlAction);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
ProcessUrlAction_policy = URLPOLICY_DISALLOW;
......@@ -901,7 +925,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(Host_QS_SecMgr);
CHECK_CALLED(ProcessUrlAction);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
CreateInstance_hres = E_FAIL;
......@@ -914,7 +938,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(ProcessUrlAction);
CHECK_CALLED(CreateInstance);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
QueryCustomPolicy_hres = E_FAIL;
......@@ -929,7 +953,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(CreateInstance);
CHECK_CALLED(QueryCustomPolicy);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
QueryCustomPolicy_psize = 6;
......@@ -948,7 +972,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(QI_IObjectWithSite);
CHECK_CALLED(reportSuccess);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
QueryCustomPolicy_policy = URLPOLICY_DISALLOW;
......@@ -984,7 +1008,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(CreateInstance);
CHECK_CALLED(QueryCustomPolicy);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, FALSE);
......@@ -996,7 +1020,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(QI_IObjectWithSite);
CHECK_CALLED(reportSuccess);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
object_with_site = &ObjectWithSite;
......@@ -1030,7 +1054,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(QI_IObjectWithSite);
CHECK_CALLED(SetSite);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
/* No IServiceProvider Interface */
parser = create_script(FALSE, FALSE);
......@@ -1047,7 +1071,7 @@ static void test_ActiveXObject(void)
CHECK_CALLED(reportSuccess);
CHECK_CALLED(SetSite);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE, TRUE);
object_with_site = &ObjectWithSite;
......@@ -1055,7 +1079,7 @@ static void test_ActiveXObject(void)
parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
}
static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
......@@ -1114,12 +1138,12 @@ static BOOL check_jscript(void)
return FALSE;
str = a2bstr("if(!('localeCompare' in String.prototype)) throw 1;");
hres = IActiveScriptParse64_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
SysFreeString(str);
if(hres == S_OK)
hres = IUnknown_QueryInterface(parser, &IID_IActiveScriptProperty, (void**)&script_prop);
IUnknown_Release(parser);
hres = IActiveScriptParse_QueryInterface(parser, &IID_IActiveScriptProperty, (void**)&script_prop);
IActiveScriptParse_Release(parser);
if(hres == S_OK)
IActiveScriptProperty_Release(script_prop);
......
......@@ -28,6 +28,22 @@
#include "wine/test.h"
#ifdef _WIN64
#define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse64_Release
#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
#else
#define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse32_Release
#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
#endif
static const CLSID CLSID_JScript =
{0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
......@@ -464,7 +480,7 @@ static void _parse_script_a(unsigned line, IActiveScriptParse *parser, const cha
HRESULT hres;
str = a2bstr(script);
hres = IActiveScriptParse64_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
SysFreeString(str);
ok_(__FILE__,line)(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
}
......@@ -483,7 +499,7 @@ static IActiveScriptParse *create_script(void)
hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parser);
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
......@@ -508,7 +524,7 @@ static void run_scripts(void)
parser = create_script();
hres = IActiveScriptParse64_QueryInterface(parser, &IID_IVariantChangeType, (void**)&script_change_type);
hres = IActiveScriptParse_QueryInterface(parser, &IID_IVariantChangeType, (void**)&script_change_type);
ok(hres == S_OK, "Could not get IVariantChangeType iface: %08x\n", hres);
SET_EXPECT(testArgConv);
......@@ -524,7 +540,7 @@ static void run_scripts(void)
IDispatch_Release(stored_obj);
IVariantChangeType_Release(script_change_type);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
}
static BOOL check_jscript(void)
......@@ -539,12 +555,12 @@ static BOOL check_jscript(void)
return FALSE;
str = a2bstr("if(!('localeCompare' in String.prototype)) throw 1;");
hres = IActiveScriptParse64_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
SysFreeString(str);
if(hres == S_OK)
hres = IUnknown_QueryInterface(parser, &IID_IActiveScriptProperty, (void**)&script_prop);
IUnknown_Release(parser);
hres = IActiveScriptParse_QueryInterface(parser, &IID_IActiveScriptProperty, (void**)&script_prop);
IActiveScriptParse_Release(parser);
if(hres == S_OK)
IActiveScriptProperty_Release(script_prop);
......
......@@ -27,6 +27,22 @@
#include "wine/test.h"
#ifdef _WIN64
#define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse64_Release
#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
#else
#define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse32_Release
#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
#endif
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static const CLSID CLSID_JScript =
......@@ -437,10 +453,10 @@ static void test_jscript(void)
test_safety((IUnknown*)script);
test_invoke_versioning(script);
hres = IActiveScriptParse64_InitNew(parse);
hres = IActiveScriptParse_InitNew(parse);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScriptParse64_InitNew(parse);
hres = IActiveScriptParse_InitNew(parse);
ok(hres == E_UNEXPECTED, "InitNew failed: %08x, expected E_UNEXPECTED\n", hres);
hres = IActiveScript_SetScriptSite(script, NULL);
......@@ -481,7 +497,7 @@ static void test_jscript(void)
test_script_dispatch(dispex);
IDispatchEx_Release(dispex);
IUnknown_Release(parse);
IActiveScriptParse_Release(parse);
ref = IActiveScript_Release(script);
ok(!ref, "ref = %d\n", ref);
......@@ -509,11 +525,11 @@ static void test_jscript2(void)
test_state(script, SCRIPTSTATE_UNINITIALIZED);
SET_EXPECT(OnStateChange_INITIALIZED);
hres = IActiveScriptParse64_InitNew(parse);
hres = IActiveScriptParse_InitNew(parse);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_INITIALIZED);
hres = IActiveScriptParse64_InitNew(parse);
hres = IActiveScriptParse_InitNew(parse);
ok(hres == E_UNEXPECTED, "InitNew failed: %08x, expected E_UNEXPECTED\n", hres);
SET_EXPECT(OnStateChange_CONNECTED);
......@@ -535,7 +551,7 @@ static void test_jscript2(void)
test_state(script, SCRIPTSTATE_CLOSED);
test_no_script_dispatch(script);
IUnknown_Release(parse);
IActiveScriptParse_Release(parse);
ref = IActiveScript_Release(script);
ok(!ref, "ref = %d\n", ref);
......@@ -559,7 +575,7 @@ static void test_jscript_uninitializing(void)
test_state(script, SCRIPTSTATE_UNINITIALIZED);
hres = IActiveScriptParse64_InitNew(parse);
hres = IActiveScriptParse_InitNew(parse);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
SET_EXPECT(GetLCID);
......@@ -571,7 +587,7 @@ static void test_jscript_uninitializing(void)
test_state(script, SCRIPTSTATE_INITIALIZED);
hres = IActiveScriptParse64_ParseScriptText(parse, script_textW, NULL, NULL, NULL, 0, 1, 0x42, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parse, script_textW, NULL, NULL, NULL, 0, 1, 0x42, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
......@@ -630,7 +646,7 @@ static void test_jscript_uninitializing(void)
test_state(script, SCRIPTSTATE_CLOSED);
IUnknown_Release(parse);
IActiveScriptParse_Release(parse);
ref = IActiveScript_Release(script);
ok(!ref, "ref = %d\n", ref);
......
......@@ -27,6 +27,22 @@
#include "wine/test.h"
#ifdef _WIN64
#define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse64_Release
#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
#else
#define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse32_Release
#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
#endif
static const CLSID CLSID_JScript =
{0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
static const CLSID CLSID_JScriptEncode =
......@@ -1108,7 +1124,7 @@ static HRESULT WINAPI ActiveScriptSite_OnScriptError_CheckError(IActiveScriptSit
ok(pscripterror != NULL, "ActiveScriptSite_OnScriptError -- expected pscripterror to be set, got NULL\n");
script_error = pscripterror;
IUnknown_AddRef(script_error);
IActiveScriptError_AddRef(script_error);
CHECK_EXPECT(ActiveScriptSite_OnScriptError);
......@@ -1186,7 +1202,7 @@ static HRESULT parse_script(DWORD flags, BSTR script_str)
return hres;
}
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
......@@ -1204,11 +1220,11 @@ static HRESULT parse_script(DWORD flags, BSTR script_str)
ok(script_disp != NULL, "script_disp == NULL\n");
ok(script_disp != (IDispatch*)&Global, "script_disp == Global\n");
hres = IActiveScriptParse64_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
IDispatch_Release(script_disp);
IActiveScript_Release(engine);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
return hres;
}
......@@ -1232,7 +1248,7 @@ static HRESULT parse_htmlscript(BSTR script_str)
return E_FAIL;
}
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
......@@ -1245,10 +1261,10 @@ static HRESULT parse_htmlscript(BSTR script_str)
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
hres = IActiveScriptParse64_ParseScriptText(parser, script_str, NULL, NULL, tmp, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, script_str, NULL, NULL, tmp, 0, 0, 0, NULL, NULL);
IActiveScript_Release(engine);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
SysFreeString(tmp);
return hres;
......@@ -1360,7 +1376,7 @@ static void parse_script_with_error(DWORD flags, BSTR script_str, SCODE errorcod
return;
}
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite_CheckError);
......@@ -1380,7 +1396,7 @@ static void parse_script_with_error(DWORD flags, BSTR script_str, SCODE errorcod
script_error = NULL;
SET_EXPECT(ActiveScriptSite_OnScriptError);
hres = IActiveScriptParse64_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
todo_wine ok(hres == 0x80020101, "parse_script_with_error should have returned 0x80020101, got: 0x%08x\n", hres);
todo_wine CHECK_CALLED(ActiveScriptSite_OnScriptError);
......@@ -1388,12 +1404,12 @@ static void parse_script_with_error(DWORD flags, BSTR script_str, SCODE errorcod
{
test_IActiveScriptError(script_error, errorcode, line, pos, script_source, description, line_text);
IUnknown_Release(script_error);
IActiveScriptError_Release(script_error);
}
IDispatch_Release(script_disp);
IActiveScript_Release(engine);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
}
static void parse_script_af(DWORD flags, const char *src)
......@@ -1544,7 +1560,7 @@ static void test_isvisible(BOOL global_members)
return;
}
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
......@@ -1564,16 +1580,16 @@ static void test_isvisible(BOOL global_members)
if(!global_members)
SET_EXPECT(GetItemInfo_testVal);
hres = IActiveScriptParse64_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
if(!global_members)
CHECK_CALLED(GetItemInfo_testVal);
hres = IActiveScriptParse64_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
IActiveScript_Release(engine);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
}
static BOOL run_tests(void)
......
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