2008-09-05 02:38:44 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#define CONST_VTABLE
|
|
|
|
|
|
|
|
#include <ole2.h>
|
|
|
|
#include <dispex.h>
|
|
|
|
#include <activscp.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2012-07-30 12:02:01 +02:00
|
|
|
#ifdef _WIN64
|
|
|
|
|
|
|
|
#define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
|
|
|
|
#define IActiveScriptParse_Release IActiveScriptParse64_Release
|
|
|
|
#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
|
|
|
|
#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
|
2012-10-04 14:57:46 +02:00
|
|
|
#define IActiveScriptParseProcedure2_Release IActiveScriptParseProcedure2_64_Release
|
|
|
|
#define IActiveScriptParseProcedure2_ParseProcedureText IActiveScriptParseProcedure2_64_ParseProcedureText
|
2012-07-30 12:02:01 +02:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
|
|
|
|
#define IActiveScriptParse_Release IActiveScriptParse32_Release
|
|
|
|
#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
|
|
|
|
#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
|
2012-10-04 14:57:46 +02:00
|
|
|
#define IActiveScriptParseProcedure2_Release IActiveScriptParseProcedure2_32_Release
|
|
|
|
#define IActiveScriptParseProcedure2_ParseProcedureText IActiveScriptParseProcedure2_32_ParseProcedureText
|
2012-07-30 12:02:01 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
static const CLSID CLSID_JScript =
|
|
|
|
{0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
|
2012-03-26 11:43:23 +02:00
|
|
|
static const CLSID CLSID_JScriptEncode =
|
|
|
|
{0xf414c262,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
|
2008-09-05 02:38:44 +02:00
|
|
|
|
|
|
|
#define DEFINE_EXPECT(func) \
|
|
|
|
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
|
|
|
|
|
|
|
|
#define SET_EXPECT(func) \
|
|
|
|
expect_ ## func = TRUE
|
|
|
|
|
|
|
|
#define CHECK_EXPECT2(func) \
|
|
|
|
do { \
|
|
|
|
ok(expect_ ##func, "unexpected call " #func "\n"); \
|
|
|
|
called_ ## func = TRUE; \
|
|
|
|
}while(0)
|
|
|
|
|
|
|
|
#define CHECK_EXPECT(func) \
|
|
|
|
do { \
|
|
|
|
CHECK_EXPECT2(func); \
|
|
|
|
expect_ ## func = FALSE; \
|
|
|
|
}while(0)
|
|
|
|
|
|
|
|
#define CHECK_CALLED(func) \
|
|
|
|
do { \
|
|
|
|
ok(called_ ## func, "expected " #func "\n"); \
|
|
|
|
expect_ ## func = called_ ## func = FALSE; \
|
|
|
|
}while(0)
|
|
|
|
|
2008-09-09 01:22:31 +02:00
|
|
|
DEFINE_EXPECT(global_propget_d);
|
|
|
|
DEFINE_EXPECT(global_propget_i);
|
2008-09-09 01:24:02 +02:00
|
|
|
DEFINE_EXPECT(global_propput_d);
|
|
|
|
DEFINE_EXPECT(global_propput_i);
|
2014-11-28 16:18:32 +01:00
|
|
|
DEFINE_EXPECT(global_propputref_d);
|
|
|
|
DEFINE_EXPECT(global_propputref_i);
|
2011-12-15 15:42:41 +01:00
|
|
|
DEFINE_EXPECT(global_propdelete_d);
|
2012-12-17 13:36:55 +01:00
|
|
|
DEFINE_EXPECT(global_nopropdelete_d);
|
2015-10-15 12:58:38 +02:00
|
|
|
DEFINE_EXPECT(global_propdeleteerror_d);
|
2008-09-09 01:25:05 +02:00
|
|
|
DEFINE_EXPECT(global_success_d);
|
|
|
|
DEFINE_EXPECT(global_success_i);
|
2009-08-10 12:57:42 +02:00
|
|
|
DEFINE_EXPECT(global_notexists_d);
|
2012-04-17 16:26:16 +02:00
|
|
|
DEFINE_EXPECT(global_propargput_d);
|
|
|
|
DEFINE_EXPECT(global_propargput_i);
|
2019-08-08 15:26:37 +02:00
|
|
|
DEFINE_EXPECT(global_propargputop_d);
|
|
|
|
DEFINE_EXPECT(global_propargputop_get_i);
|
|
|
|
DEFINE_EXPECT(global_propargputop_put_i);
|
2012-05-01 15:05:21 +02:00
|
|
|
DEFINE_EXPECT(global_testargtypes_i);
|
2019-05-20 21:05:25 +02:00
|
|
|
DEFINE_EXPECT(global_calleval_i);
|
2011-09-02 12:24:12 +02:00
|
|
|
DEFINE_EXPECT(puredisp_prop_d);
|
|
|
|
DEFINE_EXPECT(puredisp_noprop_d);
|
2012-12-24 11:38:28 +01:00
|
|
|
DEFINE_EXPECT(puredisp_value);
|
|
|
|
DEFINE_EXPECT(dispexfunc_value);
|
2012-12-17 13:36:44 +01:00
|
|
|
DEFINE_EXPECT(testobj_delete_test);
|
|
|
|
DEFINE_EXPECT(testobj_delete_nodelete);
|
2009-09-02 12:25:21 +02:00
|
|
|
DEFINE_EXPECT(testobj_value);
|
2014-09-16 20:42:33 +02:00
|
|
|
DEFINE_EXPECT(testobj_construct);
|
2009-09-06 19:10:06 +02:00
|
|
|
DEFINE_EXPECT(testobj_prop_d);
|
2012-09-13 14:34:25 +02:00
|
|
|
DEFINE_EXPECT(testobj_withprop_d);
|
|
|
|
DEFINE_EXPECT(testobj_withprop_i);
|
2009-09-06 19:10:06 +02:00
|
|
|
DEFINE_EXPECT(testobj_noprop_d);
|
2010-12-29 16:02:25 +01:00
|
|
|
DEFINE_EXPECT(testobj_onlydispid_d);
|
|
|
|
DEFINE_EXPECT(testobj_onlydispid_i);
|
2014-06-12 10:44:03 +02:00
|
|
|
DEFINE_EXPECT(testobj_notexists_d);
|
2019-05-17 16:39:32 +02:00
|
|
|
DEFINE_EXPECT(testobj_newenum);
|
|
|
|
DEFINE_EXPECT(enumvariant_next_0);
|
|
|
|
DEFINE_EXPECT(enumvariant_next_1);
|
|
|
|
DEFINE_EXPECT(enumvariant_reset);
|
2008-12-15 22:24:33 +01:00
|
|
|
DEFINE_EXPECT(GetItemInfo_testVal);
|
2010-10-09 16:43:48 +02:00
|
|
|
DEFINE_EXPECT(ActiveScriptSite_OnScriptError);
|
2010-10-19 23:14:35 +02:00
|
|
|
DEFINE_EXPECT(invoke_func);
|
2011-12-15 15:42:41 +01:00
|
|
|
DEFINE_EXPECT(DeleteMemberByDispID);
|
2012-12-17 13:36:55 +01:00
|
|
|
DEFINE_EXPECT(DeleteMemberByDispID_false);
|
2015-10-15 12:58:38 +02:00
|
|
|
DEFINE_EXPECT(DeleteMemberByDispID_error);
|
2015-06-02 14:45:20 +02:00
|
|
|
DEFINE_EXPECT(BindHandler);
|
2008-09-09 01:22:31 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
#define JS_E_SUBSCRIPT_OUT_OF_RANGE 0x800a0009
|
|
|
|
#define JS_E_INVALID_ACTION 0x800a01bd
|
|
|
|
#define JS_E_OBJECT_EXPECTED 0x800a138f
|
|
|
|
#define JS_E_UNDEFINED_VARIABLE 0x800a1391
|
|
|
|
#define JS_E_EXCEPTION_THROWN 0x800a139e
|
|
|
|
#define JS_E_SYNTAX 0x800a03ea
|
|
|
|
#define JS_E_MISSING_RBRACKET 0x800a03ee
|
|
|
|
#define JS_E_MISPLACED_RETURN 0x800a03fa
|
|
|
|
|
2008-09-09 01:22:31 +02:00
|
|
|
#define DISPID_GLOBAL_TESTPROPGET 0x1000
|
2008-09-09 01:24:02 +02:00
|
|
|
#define DISPID_GLOBAL_TESTPROPPUT 0x1001
|
2008-09-09 01:25:05 +02:00
|
|
|
#define DISPID_GLOBAL_REPORTSUCCESS 0x1002
|
2008-09-09 01:25:23 +02:00
|
|
|
#define DISPID_GLOBAL_TRACE 0x1003
|
|
|
|
#define DISPID_GLOBAL_OK 0x1004
|
2008-09-10 21:12:19 +02:00
|
|
|
#define DISPID_GLOBAL_GETVT 0x1005
|
2008-09-19 00:43:37 +02:00
|
|
|
#define DISPID_GLOBAL_TESTOBJ 0x1006
|
2012-03-28 15:04:28 +02:00
|
|
|
#define DISPID_GLOBAL_GETNULLBSTR 0x1007
|
2009-09-06 19:09:30 +02:00
|
|
|
#define DISPID_GLOBAL_NULL_DISP 0x1008
|
2009-09-27 20:59:28 +02:00
|
|
|
#define DISPID_GLOBAL_TESTTHIS 0x1009
|
|
|
|
#define DISPID_GLOBAL_TESTTHIS2 0x100a
|
2009-10-19 20:41:32 +02:00
|
|
|
#define DISPID_GLOBAL_INVOKEVERSION 0x100b
|
2010-10-19 23:14:35 +02:00
|
|
|
#define DISPID_GLOBAL_CREATEARRAY 0x100c
|
|
|
|
#define DISPID_GLOBAL_PROPGETFUNC 0x100d
|
|
|
|
#define DISPID_GLOBAL_OBJECT_FLAG 0x100e
|
2010-12-28 15:40:39 +01:00
|
|
|
#define DISPID_GLOBAL_ISWIN64 0x100f
|
2011-06-21 17:45:50 +02:00
|
|
|
#define DISPID_GLOBAL_PUREDISP 0x1010
|
2012-03-28 15:04:28 +02:00
|
|
|
#define DISPID_GLOBAL_ISNULLBSTR 0x1011
|
2012-04-17 16:26:16 +02:00
|
|
|
#define DISPID_GLOBAL_PROPARGPUT 0x1012
|
2012-05-01 15:05:21 +02:00
|
|
|
#define DISPID_GLOBAL_SHORTPROP 0x1013
|
|
|
|
#define DISPID_GLOBAL_GETSHORT 0x1014
|
|
|
|
#define DISPID_GLOBAL_TESTARGTYPES 0x1015
|
2012-05-04 15:59:43 +02:00
|
|
|
#define DISPID_GLOBAL_INTPROP 0x1016
|
2012-12-05 14:49:42 +01:00
|
|
|
#define DISPID_GLOBAL_DISPUNK 0x1017
|
2012-12-13 12:08:34 +01:00
|
|
|
#define DISPID_GLOBAL_TESTRES 0x1018
|
|
|
|
#define DISPID_GLOBAL_TESTNORES 0x1019
|
2012-12-24 11:38:28 +01:00
|
|
|
#define DISPID_GLOBAL_DISPEXFUNC 0x101a
|
2014-11-28 16:18:32 +01:00
|
|
|
#define DISPID_GLOBAL_TESTPROPPUTREF 0x101b
|
2015-01-13 21:46:02 +01:00
|
|
|
#define DISPID_GLOBAL_GETSCRIPTSTATE 0x101c
|
2015-06-02 14:45:20 +02:00
|
|
|
#define DISPID_GLOBAL_BINDEVENTHANDLER 0x101d
|
2019-05-17 16:39:32 +02:00
|
|
|
#define DISPID_GLOBAL_TESTENUMOBJ 0x101e
|
2019-05-20 21:05:25 +02:00
|
|
|
#define DISPID_GLOBAL_CALLEVAL 0x101f
|
2019-08-08 15:26:37 +02:00
|
|
|
#define DISPID_GLOBAL_PROPARGPUTOP 0x1020
|
2020-01-24 20:41:40 +01:00
|
|
|
#define DISPID_GLOBAL_THROWINT 0x1021
|
|
|
|
#define DISPID_GLOBAL_THROWEI 0x1022
|
2012-05-04 15:59:43 +02:00
|
|
|
|
2015-10-15 12:58:38 +02:00
|
|
|
#define DISPID_GLOBAL_TESTPROPDELETE 0x2000
|
|
|
|
#define DISPID_GLOBAL_TESTNOPROPDELETE 0x2001
|
|
|
|
#define DISPID_GLOBAL_TESTPROPDELETEERROR 0x2002
|
2008-09-09 01:22:31 +02:00
|
|
|
|
2009-09-06 19:10:06 +02:00
|
|
|
#define DISPID_TESTOBJ_PROP 0x2000
|
2010-12-29 16:02:25 +01:00
|
|
|
#define DISPID_TESTOBJ_ONLYDISPID 0x2001
|
2012-09-13 14:34:25 +02:00
|
|
|
#define DISPID_TESTOBJ_WITHPROP 0x2002
|
2009-09-06 19:10:06 +02:00
|
|
|
|
2014-10-02 08:09:10 +02:00
|
|
|
#define JS_E_OUT_OF_MEMORY 0x800a03ec
|
2012-03-26 11:43:23 +02:00
|
|
|
#define JS_E_INVALID_CHAR 0x800a03f6
|
|
|
|
|
2012-12-12 13:12:39 +01:00
|
|
|
static BOOL strict_dispid_check, testing_expr;
|
2008-09-09 01:25:23 +02:00
|
|
|
static const char *test_name = "(null)";
|
2009-09-27 20:59:28 +02:00
|
|
|
static IDispatch *script_disp;
|
2012-01-12 13:43:38 +01:00
|
|
|
static int invoke_version;
|
2010-10-09 16:43:48 +02:00
|
|
|
static IActiveScriptError *script_error;
|
2015-01-13 21:46:02 +01:00
|
|
|
static IActiveScript *script_engine;
|
2012-03-26 11:43:23 +02:00
|
|
|
static const CLSID *engine_clsid = &CLSID_JScript;
|
2008-09-09 01:25:23 +02:00
|
|
|
|
2011-09-18 19:38:18 +02:00
|
|
|
/* Returns true if the user interface is in English. Note that this does not
|
|
|
|
* presume of the formatting of dates, numbers, etc.
|
|
|
|
*/
|
|
|
|
static BOOL is_lang_english(void)
|
|
|
|
{
|
|
|
|
static HMODULE hkernel32 = NULL;
|
|
|
|
static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
|
|
|
|
static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
|
|
|
|
|
|
|
|
if (!hkernel32)
|
|
|
|
{
|
|
|
|
hkernel32 = GetModuleHandleA("kernel32.dll");
|
|
|
|
pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
|
|
|
|
pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
|
|
|
|
}
|
|
|
|
if (pGetThreadUILanguage)
|
|
|
|
return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
|
|
|
|
if (pGetUserDefaultUILanguage)
|
|
|
|
return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
|
|
|
|
|
|
|
|
return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
|
|
|
|
}
|
|
|
|
|
2009-10-19 20:41:32 +02:00
|
|
|
#define test_grfdex(a,b) _test_grfdex(__LINE__,a,b)
|
|
|
|
static void _test_grfdex(unsigned line, DWORD grfdex, DWORD expect)
|
|
|
|
{
|
|
|
|
expect |= invoke_version << 28;
|
|
|
|
ok_(__FILE__,line)(grfdex == expect, "grfdex = %x, expected %x\n", grfdex, expect);
|
|
|
|
}
|
|
|
|
|
2020-01-03 20:34:06 +01:00
|
|
|
static void close_script(IActiveScript *script)
|
|
|
|
{
|
|
|
|
HRESULT hres;
|
|
|
|
ULONG ref;
|
|
|
|
|
|
|
|
hres = IActiveScript_Close(script);
|
|
|
|
ok(hres == S_OK, "Close failed: %08x\n", hres);
|
|
|
|
|
|
|
|
ref = IActiveScript_Release(script);
|
|
|
|
ok(!ref, "ref=%u\n", ref);
|
|
|
|
}
|
|
|
|
|
2019-05-17 16:39:32 +02:00
|
|
|
static HRESULT WINAPI EnumVARIANT_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IEnumVARIANT))
|
|
|
|
*ppv = iface;
|
|
|
|
else
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumVARIANT_AddRef(IEnumVARIANT *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumVARIANT_Release(IEnumVARIANT *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int EnumVARIANT_index = 0;
|
|
|
|
static int EnumVARIANT_next_0_count = 0;
|
|
|
|
static HRESULT WINAPI EnumVARIANT_Next(
|
|
|
|
IEnumVARIANT *This,
|
|
|
|
ULONG celt,
|
|
|
|
VARIANT *rgVar,
|
|
|
|
ULONG *pCeltFetched)
|
|
|
|
{
|
|
|
|
ok(rgVar != NULL, "rgVar is NULL\n");
|
|
|
|
ok(celt == 1, "celt = %d\n", celt);
|
|
|
|
ok(pCeltFetched == NULL, "pCeltFetched is not NULL\n");
|
|
|
|
|
|
|
|
if (!rgVar)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
if (EnumVARIANT_index == 0)
|
|
|
|
{
|
|
|
|
EnumVARIANT_next_0_count--;
|
|
|
|
if (EnumVARIANT_next_0_count <= 0)
|
|
|
|
CHECK_EXPECT(enumvariant_next_0);
|
|
|
|
|
|
|
|
V_VT(rgVar) = VT_I4;
|
|
|
|
V_I4(rgVar) = 123;
|
|
|
|
|
|
|
|
if (pCeltFetched)
|
|
|
|
*pCeltFetched = 1;
|
|
|
|
EnumVARIANT_index++;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
CHECK_EXPECT(enumvariant_next_1);
|
|
|
|
|
|
|
|
if (pCeltFetched)
|
|
|
|
*pCeltFetched = 0;
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumVARIANT_Skip(
|
|
|
|
IEnumVARIANT *This,
|
|
|
|
ULONG celt)
|
|
|
|
{
|
|
|
|
ok(0, "EnumVariant_Skip: unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
static HRESULT WINAPI EnumVARIANT_Reset(
|
|
|
|
IEnumVARIANT *This)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(enumvariant_reset);
|
|
|
|
EnumVARIANT_index = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumVARIANT_Clone(
|
|
|
|
IEnumVARIANT *This,
|
|
|
|
IEnumVARIANT **ppEnum)
|
|
|
|
{
|
|
|
|
ok(0, "EnumVariant_Clone: unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static IEnumVARIANTVtbl testEnumVARIANTVtbl = {
|
|
|
|
EnumVARIANT_QueryInterface,
|
|
|
|
EnumVARIANT_AddRef,
|
|
|
|
EnumVARIANT_Release,
|
|
|
|
EnumVARIANT_Next,
|
|
|
|
EnumVARIANT_Skip,
|
|
|
|
EnumVARIANT_Reset,
|
|
|
|
EnumVARIANT_Clone
|
|
|
|
};
|
|
|
|
|
|
|
|
static IEnumVARIANT testEnumVARIANT = { &testEnumVARIANTVtbl };
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(riid, &IID_IUnknown)
|
|
|
|
|| IsEqualGUID(riid, &IID_IDispatch)
|
|
|
|
|| IsEqualGUID(riid, &IID_IDispatchEx))
|
|
|
|
*ppv = iface;
|
|
|
|
else
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_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_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2012-12-24 11:38:28 +01:00
|
|
|
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-06-02 14:45:20 +02:00
|
|
|
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *res, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
|
|
|
{
|
2009-08-19 13:36:31 +02:00
|
|
|
ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
|
2008-09-05 02:38:44 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2019-05-17 16:39:32 +02:00
|
|
|
static HRESULT WINAPI testObj_Invoke(IDispatchEx *iface, DISPID id,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
switch(id) {
|
|
|
|
case DISPID_NEWENUM:
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(pei == NULL, "pei != NULL\n");
|
|
|
|
|
|
|
|
CHECK_EXPECT(testobj_newenum);
|
|
|
|
V_VT(pvarRes) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(pvarRes) = (IDispatch*)&testEnumVARIANT;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ok(0, "unexpected call %x\n", id);
|
|
|
|
return DISP_E_MEMBERNOTFOUND;
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:10:06 +02:00
|
|
|
static HRESULT WINAPI testObj_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
2008-09-19 00:43:37 +02:00
|
|
|
{
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"prop")) {
|
2009-09-06 19:10:06 +02:00
|
|
|
CHECK_EXPECT(testobj_prop_d);
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2009-09-06 19:10:06 +02:00
|
|
|
*pid = DISPID_TESTOBJ_PROP;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"withProp")) {
|
2012-09-13 14:34:25 +02:00
|
|
|
CHECK_EXPECT(testobj_withprop_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive|fdexNameImplicit);
|
|
|
|
*pid = DISPID_TESTOBJ_WITHPROP;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"noprop")) {
|
2009-09-06 19:10:06 +02:00
|
|
|
CHECK_EXPECT(testobj_noprop_d);
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2009-09-06 19:10:06 +02:00
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"onlyDispID")) {
|
2010-12-29 16:02:25 +01:00
|
|
|
if(strict_dispid_check)
|
|
|
|
CHECK_EXPECT(testobj_onlydispid_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_TESTOBJ_ONLYDISPID;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"notExists")) {
|
2014-06-12 10:44:03 +02:00
|
|
|
CHECK_EXPECT(testobj_notexists_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
}
|
2009-09-06 19:10:06 +02:00
|
|
|
|
|
|
|
ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName));
|
2008-09-19 00:43:37 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-09-02 12:25:21 +02:00
|
|
|
static HRESULT WINAPI testObj_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
2008-09-19 00:43:37 +02:00
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
2012-03-08 14:28:16 +01:00
|
|
|
ok(pspCaller != NULL, "pspCaller = NULL\n");
|
|
|
|
|
2009-09-02 12:25:21 +02:00
|
|
|
switch(id) {
|
|
|
|
case DISPID_VALUE:
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
2010-10-19 23:14:35 +02:00
|
|
|
switch(wFlags) {
|
|
|
|
case INVOKE_PROPERTYGET:
|
|
|
|
CHECK_EXPECT(testobj_value);
|
|
|
|
ok(!pdp->rgvarg, "rgvarg != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
break;
|
|
|
|
case INVOKE_FUNC:
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
break;
|
|
|
|
case INVOKE_FUNC|INVOKE_PROPERTYGET:
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
break;
|
2014-09-16 20:42:33 +02:00
|
|
|
case DISPATCH_CONSTRUCT:
|
|
|
|
CHECK_EXPECT(testobj_construct);
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
break;
|
2010-10-19 23:14:35 +02:00
|
|
|
default:
|
|
|
|
ok(0, "invalid flag (%x)\n", wFlags);
|
|
|
|
}
|
|
|
|
|
2009-09-02 12:25:21 +02:00
|
|
|
V_VT(pvarRes) = VT_I4;
|
|
|
|
V_I4(pvarRes) = 1;
|
|
|
|
return S_OK;
|
2010-12-29 16:02:25 +01:00
|
|
|
case DISPID_TESTOBJ_ONLYDISPID:
|
|
|
|
if(strict_dispid_check)
|
|
|
|
CHECK_EXPECT(testobj_onlydispid_i);
|
|
|
|
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgvarg, "rgvarg != NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
return DISP_E_MEMBERNOTFOUND;
|
2012-09-13 14:34:25 +02:00
|
|
|
case DISPID_TESTOBJ_WITHPROP:
|
|
|
|
CHECK_EXPECT(testobj_withprop_i);
|
|
|
|
|
|
|
|
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgvarg, "rgvarg != NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_I4;
|
|
|
|
V_I4(pvarRes) = 1;
|
|
|
|
|
|
|
|
return S_OK;
|
2009-09-02 12:25:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ok(0, "unexpected call %x\n", id);
|
|
|
|
return DISP_E_MEMBERNOTFOUND;
|
2008-09-19 00:43:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI testObj_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
|
|
|
{
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"deleteTest")) {
|
2012-12-17 13:36:44 +01:00
|
|
|
CHECK_EXPECT(testobj_delete_test);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"noDeleteTest")) {
|
2012-12-17 13:36:44 +01:00
|
|
|
CHECK_EXPECT(testobj_delete_nodelete);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
2008-09-19 00:43:37 +02:00
|
|
|
|
2012-12-17 13:36:44 +01:00
|
|
|
ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName));
|
|
|
|
return E_FAIL;
|
2008-09-19 00:43:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static IDispatchExVtbl testObjVtbl = {
|
|
|
|
DispatchEx_QueryInterface,
|
|
|
|
DispatchEx_AddRef,
|
|
|
|
DispatchEx_Release,
|
|
|
|
DispatchEx_GetTypeInfoCount,
|
|
|
|
DispatchEx_GetTypeInfo,
|
|
|
|
DispatchEx_GetIDsOfNames,
|
2019-05-17 16:39:32 +02:00
|
|
|
testObj_Invoke,
|
2009-09-06 19:10:06 +02:00
|
|
|
testObj_GetDispID,
|
2009-09-02 12:25:21 +02:00
|
|
|
testObj_InvokeEx,
|
2008-09-19 00:43:37 +02:00
|
|
|
testObj_DeleteMemberByName,
|
|
|
|
DispatchEx_DeleteMemberByDispID,
|
|
|
|
DispatchEx_GetMemberProperties,
|
|
|
|
DispatchEx_GetMemberName,
|
|
|
|
DispatchEx_GetNextDispID,
|
|
|
|
DispatchEx_GetNameSpaceParent
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatchEx testObj = { &testObjVtbl };
|
|
|
|
|
2012-12-24 11:38:28 +01:00
|
|
|
static HRESULT WINAPI dispexFunc_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *res, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
ok(pspCaller != NULL, "pspCaller = NULL\n");
|
|
|
|
|
|
|
|
switch(id) {
|
|
|
|
case DISPID_VALUE:
|
|
|
|
CHECK_EXPECT(dispexfunc_value);
|
|
|
|
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(pdp->rgdispidNamedArgs != NULL, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(*pdp->rgdispidNamedArgs == DISPID_THIS, "*rgdispidNamedArgs = %d\n", *pdp->rgdispidNamedArgs);
|
|
|
|
ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(res != NULL, "res == NULL\n");
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1));
|
2016-06-15 18:37:13 +02:00
|
|
|
|
|
|
|
if(V_BOOL(pdp->rgvarg+1))
|
|
|
|
/* NOTE: If called by Function.apply(), native doesn't set DISPATCH_PROPERTYGET flag. */
|
|
|
|
todo_wine ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
|
|
|
|
else
|
|
|
|
ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", wFlags);
|
2012-12-24 11:38:28 +01:00
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
ok(V_DISPATCH(pdp->rgvarg) != NULL, "V_DISPATCH(pdp->rgvarg) == NULL\n");
|
|
|
|
|
|
|
|
if(res)
|
|
|
|
V_VT(res) = VT_NULL;
|
|
|
|
return S_OK;
|
|
|
|
default:
|
|
|
|
ok(0, "unexpected call %x\n", id);
|
|
|
|
return DISP_E_MEMBERNOTFOUND;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static IDispatchExVtbl dispexFuncVtbl = {
|
|
|
|
DispatchEx_QueryInterface,
|
|
|
|
DispatchEx_AddRef,
|
|
|
|
DispatchEx_Release,
|
|
|
|
DispatchEx_GetTypeInfoCount,
|
|
|
|
DispatchEx_GetTypeInfo,
|
|
|
|
DispatchEx_GetIDsOfNames,
|
|
|
|
DispatchEx_Invoke,
|
|
|
|
DispatchEx_GetDispID,
|
|
|
|
dispexFunc_InvokeEx,
|
|
|
|
DispatchEx_DeleteMemberByName,
|
|
|
|
DispatchEx_DeleteMemberByDispID,
|
|
|
|
DispatchEx_GetMemberProperties,
|
|
|
|
DispatchEx_GetMemberName,
|
|
|
|
DispatchEx_GetNextDispID,
|
|
|
|
DispatchEx_GetNameSpaceParent
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatchEx dispexFunc = { &dispexFuncVtbl };
|
|
|
|
|
2011-06-21 17:45:50 +02:00
|
|
|
static HRESULT WINAPI pureDisp_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDispatch)) {
|
|
|
|
*ppv = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2012-12-24 11:38:28 +01:00
|
|
|
static HRESULT WINAPI pureDisp_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
ok(IsEqualGUID(riid, &IID_NULL), "Expected IID_NULL\n");
|
|
|
|
ok(cNames==1, "cNames = %d\n", cNames);
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(*rgszNames, L"prop")) {
|
2012-12-24 11:38:28 +01:00
|
|
|
CHECK_EXPECT(puredisp_prop_d);
|
|
|
|
*rgDispId = DISPID_TESTOBJ_PROP;
|
|
|
|
return S_OK;
|
2020-01-14 15:50:30 +01:00
|
|
|
} else if(!lstrcmpW(*rgszNames, L"noprop")) {
|
2012-12-24 11:38:28 +01:00
|
|
|
CHECK_EXPECT(puredisp_noprop_d);
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI pureDisp_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
|
|
|
|
WORD wFlags, DISPPARAMS *pdp, VARIANT *res, EXCEPINFO *ei, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
ok(IsEqualGUID(&IID_NULL, riid), "unexpected riid\n");
|
|
|
|
|
|
|
|
switch(dispIdMember) {
|
|
|
|
case DISPID_VALUE:
|
|
|
|
CHECK_EXPECT(puredisp_value);
|
|
|
|
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(res != NULL, "res == NULL\n");
|
|
|
|
ok(ei != NULL, "ei == NULL\n");
|
|
|
|
ok(puArgErr != NULL, "puArgErr == NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_BOOL, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
2016-06-15 18:37:13 +02:00
|
|
|
|
|
|
|
if(V_BOOL(pdp->rgvarg))
|
|
|
|
todo_wine ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
|
|
|
|
else
|
|
|
|
ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", wFlags);
|
2012-12-24 11:38:28 +01:00
|
|
|
|
|
|
|
if(res)
|
|
|
|
V_VT(res) = VT_NULL;
|
|
|
|
return S_OK;
|
|
|
|
default:
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-21 17:45:50 +02:00
|
|
|
static IDispatchExVtbl pureDispVtbl = {
|
|
|
|
pureDisp_QueryInterface,
|
|
|
|
DispatchEx_AddRef,
|
|
|
|
DispatchEx_Release,
|
|
|
|
DispatchEx_GetTypeInfoCount,
|
|
|
|
DispatchEx_GetTypeInfo,
|
2012-12-24 11:38:28 +01:00
|
|
|
pureDisp_GetIDsOfNames,
|
|
|
|
pureDisp_Invoke
|
2011-06-21 17:45:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatchEx pureDisp = { &pureDispVtbl };
|
|
|
|
|
2015-06-02 14:45:20 +02:00
|
|
|
static HRESULT WINAPI BindEventHandler_QueryInterface(IBindEventHandler *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI BindEventHandler_AddRef(IBindEventHandler *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI BindEventHandler_Release(IBindEventHandler *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindEventHandler_BindHandler(IBindEventHandler *iface, const WCHAR *event, IDispatch *disp)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(BindHandler);
|
2020-01-14 15:50:30 +01:00
|
|
|
ok(!lstrcmpW(event, L"eventName"), "event = %s\n", wine_dbgstr_w(event));
|
2015-06-02 14:45:20 +02:00
|
|
|
ok(disp != NULL, "disp = NULL\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IBindEventHandlerVtbl BindEventHandlerVtbl = {
|
|
|
|
BindEventHandler_QueryInterface,
|
|
|
|
BindEventHandler_AddRef,
|
|
|
|
BindEventHandler_Release,
|
|
|
|
BindEventHandler_BindHandler
|
|
|
|
};
|
|
|
|
|
|
|
|
static IBindEventHandler BindEventHandler = { &BindEventHandlerVtbl };
|
|
|
|
|
|
|
|
static HRESULT WINAPI bindEventHandlerDisp_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDispatch) || IsEqualGUID(riid, &IID_IDispatchEx)) {
|
|
|
|
*ppv = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(IsEqualGUID(riid, &IID_IBindEventHandler)) {
|
|
|
|
*ppv = &BindEventHandler;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static IDispatchExVtbl bindEventHandlerDispVtbl = {
|
|
|
|
bindEventHandlerDisp_QueryInterface,
|
|
|
|
DispatchEx_AddRef,
|
|
|
|
DispatchEx_Release,
|
|
|
|
DispatchEx_GetTypeInfoCount,
|
|
|
|
DispatchEx_GetTypeInfo,
|
|
|
|
DispatchEx_GetIDsOfNames,
|
|
|
|
DispatchEx_Invoke,
|
|
|
|
DispatchEx_GetDispID,
|
|
|
|
DispatchEx_InvokeEx,
|
|
|
|
DispatchEx_DeleteMemberByName,
|
|
|
|
DispatchEx_DeleteMemberByDispID,
|
|
|
|
DispatchEx_GetMemberProperties,
|
|
|
|
DispatchEx_GetMemberName,
|
|
|
|
DispatchEx_GetNextDispID,
|
|
|
|
DispatchEx_GetNameSpaceParent
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatchEx bindEventHandlerDisp = { &bindEventHandlerDispVtbl };
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
|
|
|
{
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"ok")) {
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2008-09-09 01:25:23 +02:00
|
|
|
*pid = DISPID_GLOBAL_OK;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"trace")) {
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2008-09-09 01:25:23 +02:00
|
|
|
*pid = DISPID_GLOBAL_TRACE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"reportSuccess")) {
|
2008-09-09 01:25:05 +02:00
|
|
|
CHECK_EXPECT(global_success_d);
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2008-09-09 01:25:05 +02:00
|
|
|
*pid = DISPID_GLOBAL_REPORTSUCCESS;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testPropGet")) {
|
2008-09-09 01:22:31 +02:00
|
|
|
CHECK_EXPECT(global_propget_d);
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2008-09-09 01:22:31 +02:00
|
|
|
*pid = DISPID_GLOBAL_TESTPROPGET;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testPropPut")) {
|
2008-09-09 01:24:02 +02:00
|
|
|
CHECK_EXPECT(global_propput_d);
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2008-09-09 01:24:02 +02:00
|
|
|
*pid = DISPID_GLOBAL_TESTPROPPUT;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testPropPutRef")) {
|
2014-11-28 16:18:32 +01:00
|
|
|
CHECK_EXPECT(global_propputref_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_TESTPROPPUTREF;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testPropDelete")) {
|
2011-12-15 15:42:41 +01:00
|
|
|
CHECK_EXPECT(global_propdelete_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_TESTPROPDELETE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testNoPropDelete")) {
|
2012-12-17 13:36:55 +01:00
|
|
|
CHECK_EXPECT(global_nopropdelete_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_TESTNOPROPDELETE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testPropDeleteError")) {
|
2015-10-15 12:58:38 +02:00
|
|
|
CHECK_EXPECT(global_propdeleteerror_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_TESTPROPDELETEERROR;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"getVT")) {
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2008-09-10 21:12:19 +02:00
|
|
|
*pid = DISPID_GLOBAL_GETVT;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testObj")) {
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2008-09-19 00:43:37 +02:00
|
|
|
*pid = DISPID_GLOBAL_TESTOBJ;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"getNullBSTR")) {
|
2012-03-28 15:04:28 +02:00
|
|
|
*pid = DISPID_GLOBAL_GETNULLBSTR;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"isNullBSTR")) {
|
2012-03-28 15:04:28 +02:00
|
|
|
*pid = DISPID_GLOBAL_ISNULLBSTR;
|
2009-08-05 23:27:31 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"nullDisp")) {
|
2009-09-06 19:09:30 +02:00
|
|
|
*pid = DISPID_GLOBAL_NULL_DISP;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"notExists")) {
|
2009-08-10 12:57:42 +02:00
|
|
|
CHECK_EXPECT(global_notexists_d);
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2009-08-10 12:57:42 +02:00
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
}
|
2008-09-09 01:22:31 +02:00
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testThis")) {
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2009-09-27 20:59:28 +02:00
|
|
|
*pid = DISPID_GLOBAL_TESTTHIS;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testThis2")) {
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2009-09-27 20:59:28 +02:00
|
|
|
*pid = DISPID_GLOBAL_TESTTHIS2;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"invokeVersion")) {
|
2009-10-19 20:41:32 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_INVOKEVERSION;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"createArray")) {
|
2010-10-18 18:47:15 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
2010-10-19 23:14:35 +02:00
|
|
|
*pid = DISPID_GLOBAL_CREATEARRAY;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"propGetFunc")) {
|
2010-10-19 23:14:35 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_PROPGETFUNC;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"objectFlag")) {
|
2010-10-19 23:14:35 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_OBJECT_FLAG;
|
2010-10-18 18:47:15 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
2009-10-19 20:41:32 +02:00
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"isWin64")) {
|
2010-12-28 15:40:39 +01:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_ISWIN64;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"pureDisp")) {
|
2011-06-21 17:45:50 +02:00
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_PUREDISP;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"propArgPutG")) {
|
2012-04-17 16:26:16 +02:00
|
|
|
CHECK_EXPECT(global_propargput_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_PROPARGPUT;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"propArgPutOp")) {
|
2019-08-08 15:26:37 +02:00
|
|
|
CHECK_EXPECT(global_propargputop_d);
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_PROPARGPUTOP;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"throwInt")) {
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_THROWINT;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!lstrcmpW(bstrName, L"throwEI")) {
|
|
|
|
test_grfdex(grfdex, fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_THROWEI;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"propArgPutO")) {
|
2012-04-17 16:26:16 +02:00
|
|
|
CHECK_EXPECT(global_propargput_d);
|
|
|
|
test_grfdex(grfdex, fdexNameEnsure|fdexNameCaseSensitive);
|
|
|
|
*pid = DISPID_GLOBAL_PROPARGPUT;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"shortProp")) {
|
2012-05-01 15:05:21 +02:00
|
|
|
*pid = DISPID_GLOBAL_SHORTPROP;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"getShort")) {
|
2012-05-01 15:05:21 +02:00
|
|
|
*pid = DISPID_GLOBAL_GETSHORT;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testArgTypes")) {
|
2012-05-01 15:05:21 +02:00
|
|
|
*pid = DISPID_GLOBAL_TESTARGTYPES;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"intProp")) {
|
2012-05-04 15:59:43 +02:00
|
|
|
*pid = DISPID_GLOBAL_INTPROP;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"dispUnk")) {
|
2012-12-05 14:49:42 +01:00
|
|
|
*pid = DISPID_GLOBAL_DISPUNK;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testRes")) {
|
2012-12-13 12:08:34 +01:00
|
|
|
*pid = DISPID_GLOBAL_TESTRES;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testNoRes")) {
|
2012-12-13 12:08:34 +01:00
|
|
|
*pid = DISPID_GLOBAL_TESTNORES;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"dispexFunc")) {
|
2012-12-24 11:38:28 +01:00
|
|
|
*pid = DISPID_GLOBAL_DISPEXFUNC;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"getScriptState")) {
|
2015-01-13 21:46:02 +01:00
|
|
|
*pid = DISPID_GLOBAL_GETSCRIPTSTATE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"bindEventHandler")) {
|
2015-06-02 14:45:20 +02:00
|
|
|
*pid = DISPID_GLOBAL_BINDEVENTHANDLER;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"testEnumObj")) {
|
2019-05-17 16:39:32 +02:00
|
|
|
*pid = DISPID_GLOBAL_TESTENUMOBJ;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(!lstrcmpW(bstrName, L"callEval")) {
|
2019-05-20 21:05:25 +02:00
|
|
|
*pid = DISPID_GLOBAL_CALLEVAL;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:30 +01:00
|
|
|
if(strict_dispid_check && lstrcmpW(bstrName, L"t"))
|
2009-08-19 13:36:31 +02:00
|
|
|
ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName));
|
2008-09-05 02:38:44 +02:00
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
2012-03-08 14:28:16 +01:00
|
|
|
ok(pspCaller != NULL, "pspCaller = NULL\n");
|
|
|
|
|
2008-09-09 01:25:23 +02:00
|
|
|
switch(id) {
|
|
|
|
case DISPID_GLOBAL_OK:
|
2008-09-17 23:34:05 +02:00
|
|
|
ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
|
2008-09-09 01:25:23 +02:00
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
2008-09-17 23:34:05 +02:00
|
|
|
if(wFlags & INVOKE_PROPERTYGET)
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
else
|
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
2008-09-09 01:25:23 +02:00
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1));
|
2009-08-19 13:36:31 +02:00
|
|
|
ok(V_BOOL(pdp->rgvarg+1), "%s: %s\n", test_name, wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
|
2008-09-09 01:25:23 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
case DISPID_GLOBAL_TRACE:
|
|
|
|
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
2008-09-09 01:25:23 +02:00
|
|
|
if(V_VT(pdp->rgvarg) == VT_BSTR)
|
2009-08-19 13:36:31 +02:00
|
|
|
trace("%s: %s\n", test_name, wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
|
2008-09-09 01:25:23 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
case DISPID_GLOBAL_REPORTSUCCESS:
|
|
|
|
CHECK_EXPECT(global_success_i);
|
2008-09-09 01:25:05 +02:00
|
|
|
|
|
|
|
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 0, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
2012-12-12 13:12:39 +01:00
|
|
|
if(!testing_expr)
|
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
2008-09-09 01:25:05 +02:00
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
2008-09-09 01:22:31 +02:00
|
|
|
case DISPID_GLOBAL_TESTPROPGET:
|
|
|
|
CHECK_EXPECT(global_propget_i);
|
|
|
|
|
|
|
|
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgvarg, "rgvarg != NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_I4;
|
|
|
|
V_I4(pvarRes) = 1;
|
|
|
|
|
|
|
|
return S_OK;
|
2008-09-09 01:24:02 +02:00
|
|
|
|
|
|
|
case DISPID_GLOBAL_TESTPROPPUT:
|
|
|
|
CHECK_EXPECT(global_propput_i);
|
|
|
|
|
|
|
|
ok(wFlags == INVOKE_PROPERTYPUT, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(pdp->rgdispidNamedArgs != NULL, "rgdispidNamedArgs == NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pdp->rgdispidNamedArgs[0] == DISPID_PROPERTYPUT, "pdp->rgdispidNamedArgs[0] = %d\n", pdp->rgdispidNamedArgs[0]);
|
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_I4, "V_VT(pdp->rgvarg)=%d\n", V_VT(pdp->rgvarg));
|
|
|
|
ok(V_I4(pdp->rgvarg) == 1, "V_I4(pdp->rgvarg)=%d\n", V_I4(pdp->rgvarg));
|
|
|
|
return S_OK;
|
2008-09-10 21:12:19 +02:00
|
|
|
|
2014-11-28 16:18:32 +01:00
|
|
|
case DISPID_GLOBAL_TESTPROPPUTREF:
|
|
|
|
CHECK_EXPECT(global_propputref_i);
|
|
|
|
|
|
|
|
ok(wFlags == (INVOKE_PROPERTYPUT|INVOKE_PROPERTYPUTREF), "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(pdp->rgdispidNamedArgs != NULL, "rgdispidNamedArgs == NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pdp->rgdispidNamedArgs[0] == DISPID_PROPERTYPUT, "pdp->rgdispidNamedArgs[0] = %d\n", pdp->rgdispidNamedArgs[0]);
|
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg)=%d\n", V_VT(pdp->rgvarg));
|
|
|
|
return S_OK;
|
|
|
|
|
2008-09-10 21:12:19 +02:00
|
|
|
case DISPID_GLOBAL_GETVT:
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_BSTR;
|
|
|
|
switch(V_VT(pdp->rgvarg)) {
|
|
|
|
case VT_EMPTY:
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(pvarRes) = SysAllocString(L"VT_EMPTY");
|
2008-09-10 21:12:19 +02:00
|
|
|
break;
|
|
|
|
case VT_NULL:
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(pvarRes) = SysAllocString(L"VT_NULL");
|
2008-09-10 21:12:19 +02:00
|
|
|
break;
|
|
|
|
case VT_I4:
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(pvarRes) = SysAllocString(L"VT_I4");
|
2008-09-10 21:12:19 +02:00
|
|
|
break;
|
|
|
|
case VT_R8:
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(pvarRes) = SysAllocString(L"VT_R8");
|
2008-09-10 21:12:19 +02:00
|
|
|
break;
|
|
|
|
case VT_BSTR:
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(pvarRes) = SysAllocString(L"VT_BSTR");
|
2008-09-10 21:12:19 +02:00
|
|
|
break;
|
|
|
|
case VT_DISPATCH:
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(pvarRes) = SysAllocString(L"VT_DISPATCH");
|
2008-09-10 21:12:19 +02:00
|
|
|
break;
|
|
|
|
case VT_BOOL:
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(pvarRes) = SysAllocString(L"VT_BOOL");
|
2008-09-10 21:12:19 +02:00
|
|
|
break;
|
2010-10-19 14:00:14 +02:00
|
|
|
case VT_ARRAY|VT_VARIANT:
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(pvarRes) = SysAllocString(L"VT_ARRAY|VT_VARIANT");
|
2010-10-19 14:00:14 +02:00
|
|
|
break;
|
2008-09-10 21:12:19 +02:00
|
|
|
default:
|
|
|
|
ok(0, "unknown vt %d\n", V_VT(pdp->rgvarg));
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-09-19 00:43:37 +02:00
|
|
|
|
2012-12-13 12:08:34 +01:00
|
|
|
case DISPID_GLOBAL_TESTRES:
|
|
|
|
ok(pvarRes != NULL, "pvarRes = NULL\n");
|
2012-12-14 11:06:28 +01:00
|
|
|
if(pvarRes) {
|
|
|
|
V_VT(pvarRes) = VT_BOOL;
|
|
|
|
V_BOOL(pvarRes) = VARIANT_TRUE;
|
|
|
|
}
|
2012-12-13 12:08:34 +01:00
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
case DISPID_GLOBAL_TESTNORES:
|
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
|
|
|
if(pvarRes)
|
|
|
|
V_VT(pvarRes) = VT_NULL;
|
|
|
|
return S_OK;
|
|
|
|
|
2008-09-19 00:43:37 +02:00
|
|
|
case DISPID_GLOBAL_TESTOBJ:
|
|
|
|
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgvarg, "rgvarg != NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(pvarRes) = (IDispatch*)&testObj;
|
|
|
|
return S_OK;
|
2009-08-05 23:27:31 +02:00
|
|
|
|
2011-06-21 17:45:50 +02:00
|
|
|
case DISPID_GLOBAL_PUREDISP:
|
|
|
|
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgvarg, "rgvarg != NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(pvarRes) = (IDispatch*)&pureDisp;
|
|
|
|
return S_OK;
|
|
|
|
|
2012-12-24 11:38:28 +01:00
|
|
|
case DISPID_GLOBAL_DISPEXFUNC:
|
|
|
|
V_VT(pvarRes) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(pvarRes) = (IDispatch*)&dispexFunc;
|
|
|
|
return S_OK;
|
|
|
|
|
2012-03-28 15:04:28 +02:00
|
|
|
case DISPID_GLOBAL_GETNULLBSTR:
|
2009-08-05 23:27:31 +02:00
|
|
|
if(pvarRes) {
|
|
|
|
V_VT(pvarRes) = VT_BSTR;
|
|
|
|
V_BSTR(pvarRes) = NULL;
|
|
|
|
}
|
|
|
|
return S_OK;
|
2009-09-06 19:09:30 +02:00
|
|
|
|
2012-03-28 15:04:28 +02:00
|
|
|
case DISPID_GLOBAL_ISNULLBSTR:
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_BOOL;
|
|
|
|
V_BOOL(pvarRes) = V_BSTR(pdp->rgvarg) ? VARIANT_FALSE : VARIANT_TRUE;
|
|
|
|
return S_OK;
|
|
|
|
|
2010-12-28 15:40:39 +01:00
|
|
|
case DISPID_GLOBAL_ISWIN64:
|
|
|
|
if(pvarRes) {
|
|
|
|
V_VT(pvarRes) = VT_BOOL;
|
2011-01-02 15:06:41 +01:00
|
|
|
V_BOOL(pvarRes) = sizeof(void*) == 8 ? VARIANT_TRUE : VARIANT_FALSE;
|
2010-12-28 15:40:39 +01:00
|
|
|
}
|
|
|
|
return S_OK;
|
|
|
|
|
2009-09-06 19:09:30 +02:00
|
|
|
case DISPID_GLOBAL_NULL_DISP:
|
|
|
|
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgvarg, "rgvarg != NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(pvarRes) = NULL;
|
|
|
|
return S_OK;
|
2009-09-27 20:59:28 +02:00
|
|
|
|
|
|
|
case DISPID_GLOBAL_TESTTHIS:
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes == NULL, "pvarRes != NULL\n");
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
2009-09-27 20:59:28 +02:00
|
|
|
ok(V_DISPATCH(pdp->rgvarg) == (IDispatch*)iface, "disp != iface\n");
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
case DISPID_GLOBAL_TESTTHIS2:
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes == NULL, "pvarRes != NULL\n");
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(arg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
ok(V_DISPATCH(pdp->rgvarg) != (IDispatch*)iface, "disp == iface\n");
|
|
|
|
ok(V_DISPATCH(pdp->rgvarg) == script_disp, "disp != script_disp\n");
|
|
|
|
|
|
|
|
return S_OK;
|
2009-10-19 20:41:32 +02:00
|
|
|
|
|
|
|
case DISPID_GLOBAL_INVOKEVERSION:
|
|
|
|
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgvarg, "rgvarg != NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_I4;
|
|
|
|
V_I4(pvarRes) = invoke_version;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
2010-10-19 23:14:35 +02:00
|
|
|
case DISPID_GLOBAL_CREATEARRAY: {
|
2010-10-18 18:47:15 +02:00
|
|
|
SAFEARRAYBOUND bound[2];
|
|
|
|
VARIANT *data;
|
|
|
|
int i,j;
|
|
|
|
|
|
|
|
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
2011-12-07 11:00:20 +01:00
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
2010-10-18 18:47:15 +02:00
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
bound[0].lLbound = 0;
|
|
|
|
bound[0].cElements = 5;
|
|
|
|
bound[1].lLbound = 2;
|
|
|
|
bound[1].cElements = 2;
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_ARRAY|VT_VARIANT;
|
|
|
|
V_ARRAY(pvarRes) = SafeArrayCreate(VT_VARIANT, 2, bound);
|
|
|
|
|
|
|
|
SafeArrayAccessData(V_ARRAY(pvarRes), (void**)&data);
|
|
|
|
for(i=0; i<5; i++) {
|
|
|
|
for(j=2; j<4; j++) {
|
|
|
|
V_VT(data) = VT_I4;
|
|
|
|
V_I4(data) = i*10+j;
|
|
|
|
data++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SafeArrayUnaccessData(V_ARRAY(pvarRes));
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2010-10-19 23:14:35 +02:00
|
|
|
|
|
|
|
case DISPID_GLOBAL_PROPGETFUNC:
|
|
|
|
switch(wFlags) {
|
|
|
|
case INVOKE_FUNC:
|
|
|
|
CHECK_EXPECT(invoke_func);
|
|
|
|
break;
|
|
|
|
case INVOKE_FUNC|INVOKE_PROPERTYGET:
|
|
|
|
ok(pdp->cArgs != 0, "pdp->cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(pvarRes != NULL, "pdp->pvarRes == NULL\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(0, "invalid flag (%x)\n", wFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
if(pvarRes) {
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
V_VT(pvarRes) = VT_I4;
|
|
|
|
V_I4(pvarRes) = pdp->cArgs;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
2015-01-13 21:46:02 +01:00
|
|
|
case DISPID_GLOBAL_GETSCRIPTSTATE: {
|
|
|
|
SCRIPTSTATE state;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IActiveScript_GetScriptState(script_engine, &state);
|
|
|
|
ok(hres == S_OK, "GetScriptState failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_I4;
|
|
|
|
V_I4(pvarRes) = state;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2015-06-02 14:45:20 +02:00
|
|
|
case DISPID_GLOBAL_BINDEVENTHANDLER:
|
|
|
|
V_VT(pvarRes) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(pvarRes) = (IDispatch*)&bindEventHandlerDisp;
|
|
|
|
return S_OK;
|
|
|
|
|
2012-04-17 16:26:16 +02:00
|
|
|
case DISPID_GLOBAL_PROPARGPUT:
|
|
|
|
CHECK_EXPECT(global_propargput_i);
|
|
|
|
ok(wFlags == INVOKE_PROPERTYPUT, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg != NULL\n");
|
|
|
|
ok(pdp->rgdispidNamedArgs != NULL, "rgdispidNamedArgs == NULL\n");
|
|
|
|
ok(pdp->cArgs == 3, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pdp->rgdispidNamedArgs[0] == DISPID_PROPERTYPUT, "pdp->rgdispidNamedArgs[0] = %d\n", pdp->rgdispidNamedArgs[0]);
|
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg) == VT_I4, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
ok(V_I4(pdp->rgvarg) == 2, "V_I4(pdp->rgvarg) = %d\n", V_I4(pdp->rgvarg));
|
2012-04-17 16:26:16 +02:00
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg+1) == VT_I4, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1));
|
|
|
|
ok(V_I4(pdp->rgvarg+1) == 1, "V_I4(pdp->rgvarg+1) = %d\n", V_I4(pdp->rgvarg+1));
|
2012-04-17 16:26:16 +02:00
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg+2) == VT_I4, "V_VT(pdp->rgvarg+2) = %d\n", V_VT(pdp->rgvarg+2));
|
|
|
|
ok(V_I4(pdp->rgvarg+2) == 0, "V_I4(pdp->rgvarg+2) = %d\n", V_I4(pdp->rgvarg+2));
|
2012-04-17 16:26:16 +02:00
|
|
|
return S_OK;
|
|
|
|
|
2019-08-08 15:26:37 +02:00
|
|
|
case DISPID_GLOBAL_PROPARGPUTOP:
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg != NULL\n");
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
switch(wFlags) {
|
|
|
|
case INVOKE_PROPERTYGET | INVOKE_FUNC:
|
|
|
|
CHECK_EXPECT(global_propargputop_get_i);
|
|
|
|
|
|
|
|
ok(pdp->cNamedArgs == 0, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(pdp->cNamedArgs == 0, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes != NULL, "pvarRes = NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_I4, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
ok(V_I4(pdp->rgvarg) == 1, "V_I4(pdp->rgvarg) = %d\n", V_I4(pdp->rgvarg));
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg+1) == VT_I4, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1));
|
|
|
|
ok(V_I4(pdp->rgvarg+1) == 0, "V_I4(pdp->rgvarg+1) = %d\n", V_I4(pdp->rgvarg+1));
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_I4;
|
|
|
|
V_I4(pvarRes) = 6;
|
|
|
|
break;
|
|
|
|
case INVOKE_PROPERTYPUT:
|
|
|
|
CHECK_EXPECT(global_propargputop_put_i);
|
|
|
|
|
|
|
|
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pdp->rgdispidNamedArgs[0] == DISPID_PROPERTYPUT, "pdp->rgdispidNamedArgs[0] = %d\n", pdp->rgdispidNamedArgs[0]);
|
|
|
|
ok(pdp->rgdispidNamedArgs != NULL, "rgdispidNamedArgs == NULL\n");
|
|
|
|
ok(pdp->cArgs == 3, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_I4, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
ok(V_I4(pdp->rgvarg) == 8, "V_I4(pdp->rgvarg) = %d\n", V_I4(pdp->rgvarg));
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg+1) == VT_I4, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1));
|
|
|
|
ok(V_I4(pdp->rgvarg+1) == 1, "V_I4(pdp->rgvarg+1) = %d\n", V_I4(pdp->rgvarg+1));
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg+2) == VT_I4, "V_VT(pdp->rgvarg+2) = %d\n", V_VT(pdp->rgvarg+2));
|
|
|
|
ok(V_I4(pdp->rgvarg+2) == 0, "V_I4(pdp->rgvarg+2) = %d\n", V_I4(pdp->rgvarg+2));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(0, "wFlags = %x\n", wFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
2010-10-19 23:14:35 +02:00
|
|
|
case DISPID_GLOBAL_OBJECT_FLAG: {
|
|
|
|
IDispatchEx *dispex;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IDispatch_QueryInterface(script_disp, &IID_IDispatchEx, (void**)&dispex);
|
|
|
|
ok(hres == S_OK, "hres = %x\n", hres);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"Object");
|
2010-10-19 23:14:35 +02:00
|
|
|
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseSensitive, &id);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "hres = %x\n", hres);
|
|
|
|
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, id, lcid, DISPATCH_METHOD, pdp, NULL, pei, pspCaller);
|
|
|
|
ok(hres == S_OK, "hres = %x\n", hres);
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_EMPTY;
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, id, lcid, DISPATCH_METHOD, pdp, pvarRes, pei, pspCaller);
|
|
|
|
ok(hres == S_OK, "hres = %x\n", hres);
|
|
|
|
ok(V_VT(pvarRes) == VT_DISPATCH, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
VariantClear(pvarRes);
|
|
|
|
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, id, lcid, DISPATCH_METHOD|DISPATCH_PROPERTYGET, pdp, NULL, pei, pspCaller);
|
|
|
|
ok(hres == S_OK, "hres = %x\n", hres);
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_EMPTY;
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, id, lcid, DISPATCH_CONSTRUCT, pdp, pvarRes, pei, pspCaller);
|
|
|
|
ok(hres == S_OK, "hres = %x\n", hres);
|
|
|
|
ok(V_VT(pvarRes) == VT_DISPATCH, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
VariantClear(pvarRes);
|
|
|
|
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, id, lcid, DISPATCH_CONSTRUCT, pdp, NULL, pei, pspCaller);
|
|
|
|
ok(hres == S_OK, "hres = %x\n", hres);
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_EMPTY;
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, id, lcid, DISPATCH_CONSTRUCT|DISPATCH_PROPERTYGET, pdp, pvarRes, pei, pspCaller);
|
|
|
|
ok(hres == E_INVALIDARG, "hres = %x\n", hres);
|
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_EMPTY;
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
|
|
|
ok(hres == S_OK, "hres = %x\n", hres);
|
|
|
|
ok(V_VT(pvarRes) == VT_DISPATCH, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
IDispatchEx_Release(dispex);
|
|
|
|
return S_OK;
|
|
|
|
}
|
2012-05-01 15:05:21 +02:00
|
|
|
case DISPID_GLOBAL_SHORTPROP:
|
|
|
|
case DISPID_GLOBAL_GETSHORT:
|
|
|
|
V_VT(pvarRes) = VT_I2;
|
|
|
|
V_I2(pvarRes) = 10;
|
|
|
|
return S_OK;
|
|
|
|
|
2012-05-04 15:59:43 +02:00
|
|
|
case DISPID_GLOBAL_INTPROP:
|
|
|
|
V_VT(pvarRes) = VT_INT;
|
|
|
|
V_INT(pvarRes) = 22;
|
|
|
|
return S_OK;
|
|
|
|
|
2012-12-05 14:49:42 +01:00
|
|
|
case DISPID_GLOBAL_DISPUNK:
|
|
|
|
V_VT(pvarRes) = VT_UNKNOWN;
|
|
|
|
V_UNKNOWN(pvarRes) = (IUnknown*)&testObj;
|
|
|
|
return S_OK;
|
|
|
|
|
2012-05-01 15:05:21 +02:00
|
|
|
case DISPID_GLOBAL_TESTARGTYPES: {
|
2019-08-08 15:25:56 +02:00
|
|
|
VARIANT args[10], v;
|
2018-06-05 20:09:44 +02:00
|
|
|
DISPPARAMS dp = {args, NULL, ARRAY_SIZE(args), 0};
|
2012-05-01 15:05:21 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
CHECK_EXPECT(global_testargtypes_i);
|
|
|
|
ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg != NULL\n");
|
2012-12-05 14:49:42 +01:00
|
|
|
ok(pdp->cArgs == 6, "cArgs = %d\n", pdp->cArgs);
|
2012-05-01 15:05:21 +02:00
|
|
|
ok(!pvarRes, "pvarRes != NULL\n");
|
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg+1) == VT_I4, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1));
|
|
|
|
ok(V_I4(pdp->rgvarg+1) == 10, "V_I4(pdp->rgvarg+1) = %d\n", V_I4(pdp->rgvarg+1));
|
2012-05-01 15:05:21 +02:00
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg+2) == VT_I4, "V_VT(pdp->rgvarg+2) = %d\n", V_VT(pdp->rgvarg+2));
|
|
|
|
ok(V_I4(pdp->rgvarg+2) == 10, "V_I4(pdp->rgvarg+2) = %d\n", V_I4(pdp->rgvarg+2));
|
2012-05-01 15:05:21 +02:00
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg+3) == VT_I4, "V_VT(pdp->rgvarg+3) = %d\n", V_VT(pdp->rgvarg+3));
|
|
|
|
ok(V_I4(pdp->rgvarg+3) == 22, "V_I4(pdp->rgvarg+3) = %d\n", V_I4(pdp->rgvarg+3));
|
2012-05-04 15:59:43 +02:00
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg+4) == VT_I4, "V_VT(pdp->rgvarg+4) = %d\n", V_VT(pdp->rgvarg+4));
|
|
|
|
ok(V_I4(pdp->rgvarg+4) == 22, "V_I4(pdp->rgvarg+4) = %d\n", V_I4(pdp->rgvarg+4));
|
2012-05-04 15:59:43 +02:00
|
|
|
|
2012-12-05 14:49:42 +01:00
|
|
|
ok(V_VT(pdp->rgvarg+5) == VT_DISPATCH, "V_VT(pdp->rgvarg+5) = %d\n", V_VT(pdp->rgvarg+5));
|
|
|
|
ok(V_DISPATCH(pdp->rgvarg+5) == (IDispatch*)&testObj, "V_DISPATCH(pdp->rgvarg+5) != testObj\n");
|
|
|
|
|
2012-06-15 23:23:55 +02:00
|
|
|
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
2012-05-01 15:05:21 +02:00
|
|
|
|
|
|
|
V_VT(args) = VT_I2;
|
|
|
|
V_I2(args) = 2;
|
2012-05-04 15:59:43 +02:00
|
|
|
V_VT(args+1) = VT_INT;
|
|
|
|
V_INT(args+1) = 22;
|
2012-12-05 14:49:42 +01:00
|
|
|
V_VT(args+2) = VT_UNKNOWN;
|
|
|
|
V_UNKNOWN(args+2) = (IUnknown*)&testObj;
|
2014-03-19 13:15:14 +01:00
|
|
|
V_VT(args+3) = VT_UNKNOWN;
|
|
|
|
V_UNKNOWN(args+3) = NULL;
|
2015-02-03 19:37:07 +01:00
|
|
|
V_VT(args+4) = VT_UI4;
|
|
|
|
V_UI4(args+4) = 0xffffffff;
|
2015-02-06 12:10:00 +01:00
|
|
|
V_VT(args+5) = VT_BYREF|VT_VARIANT;
|
|
|
|
V_VARIANTREF(args+5) = &v;
|
2017-08-21 21:34:39 +02:00
|
|
|
V_VT(args+6) = VT_R4;
|
|
|
|
V_R4(args+6) = 0.5;
|
2017-11-01 16:43:37 +01:00
|
|
|
V_VT(args+7) = VT_UI2;
|
2019-08-08 15:25:56 +02:00
|
|
|
V_UI2(args+7) = 3;
|
|
|
|
V_VT(args+8) = VT_UI1;
|
|
|
|
V_UI1(args+8) = 4;
|
|
|
|
V_VT(args+9) = VT_I1;
|
|
|
|
V_I1(args+9) = 5;
|
2015-02-06 12:10:00 +01:00
|
|
|
V_VT(&v) = VT_I4;
|
|
|
|
V_I4(&v) = 2;
|
2012-05-01 15:05:21 +02:00
|
|
|
hres = IDispatch_Invoke(V_DISPATCH(pdp->rgvarg), DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "Invoke failed: %08x\n", hres);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2019-05-20 21:05:25 +02:00
|
|
|
|
|
|
|
case DISPID_GLOBAL_CALLEVAL: {
|
|
|
|
IDispatchEx *eval_func;
|
|
|
|
DISPPARAMS params;
|
|
|
|
VARIANT arg, res;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
CHECK_EXPECT(global_calleval_i);
|
|
|
|
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pvarRes == NULL, "pvarRes != NULL\n");
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(arg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
hres = IDispatch_QueryInterface(V_DISPATCH(pdp->rgvarg), &IID_IDispatchEx, (void**)&eval_func);
|
|
|
|
ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
|
|
|
|
|
|
|
|
params.rgvarg = &arg;
|
|
|
|
params.rgdispidNamedArgs = NULL;
|
|
|
|
params.cArgs = 1;
|
|
|
|
params.cNamedArgs = 0;
|
|
|
|
V_VT(&arg) = VT_BSTR;
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(&arg) = SysAllocString(L"var x = 5; v");
|
2019-05-20 21:05:25 +02:00
|
|
|
V_VT(&res) = VT_ERROR;
|
|
|
|
hres = IDispatchEx_InvokeEx(eval_func, DISPID_VALUE, 0, DISPATCH_METHOD, ¶ms, &res, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&res) == VT_I4, "eval returned type %u\n", V_VT(&res));
|
|
|
|
ok(V_I4(&res) == 2, "eval returned %d\n", V_I4(&res));
|
|
|
|
SysFreeString(V_BSTR(&arg));
|
|
|
|
IDispatchEx_Release(eval_func);
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-01-24 20:41:40 +01:00
|
|
|
case DISPID_GLOBAL_THROWINT: {
|
|
|
|
VARIANT *v = pdp->rgvarg;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
if(pvarRes) {
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
V_VT(pvarRes) = VT_BOOL;
|
|
|
|
V_BOOL(pvarRes) = VARIANT_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(V_VT(v)) {
|
|
|
|
case VT_I4:
|
|
|
|
hres = V_I4(v);
|
|
|
|
break;
|
|
|
|
case VT_R8:
|
|
|
|
hres = (HRESULT)V_R8(v);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(0, "unexpected vt %d\n", V_VT(v));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
case DISPID_GLOBAL_THROWEI: {
|
|
|
|
VARIANT *v = pdp->rgvarg + pdp->cArgs - 1;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pdp == NULL\n");
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
|
|
|
ok(pdp->cArgs == 1 || pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(pei != NULL, "pei == NULL\n");
|
|
|
|
if(pvarRes) {
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
V_VT(pvarRes) = VT_BOOL;
|
|
|
|
V_BOOL(pvarRes) = VARIANT_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(V_VT(v)) {
|
|
|
|
case VT_I4:
|
|
|
|
hres = V_I4(v);
|
|
|
|
break;
|
|
|
|
case VT_R8:
|
|
|
|
hres = (HRESULT)V_R8(v);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(0, "unexpected vt %d\n", V_VT(v));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
pei->scode = hres;
|
|
|
|
if(pdp->cArgs == 1) {
|
|
|
|
pei->bstrSource = SysAllocString(L"test source");
|
|
|
|
pei->bstrDescription = SysAllocString(L"test description");
|
|
|
|
}
|
|
|
|
return DISP_E_EXCEPTION;
|
|
|
|
}
|
2008-09-19 00:43:37 +02:00
|
|
|
}
|
2008-09-09 01:22:31 +02:00
|
|
|
|
2008-09-09 01:25:23 +02:00
|
|
|
ok(0, "unexpected call %x\n", id);
|
2008-09-05 02:38:44 +02:00
|
|
|
return DISP_E_MEMBERNOTFOUND;
|
|
|
|
}
|
|
|
|
|
2011-12-15 15:42:41 +01:00
|
|
|
static HRESULT WINAPI Global_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
|
|
|
|
{
|
2012-12-17 13:36:55 +01:00
|
|
|
switch(id) {
|
|
|
|
case DISPID_GLOBAL_TESTPROPDELETE:
|
|
|
|
CHECK_EXPECT(DeleteMemberByDispID);
|
|
|
|
return S_OK;
|
|
|
|
case DISPID_GLOBAL_TESTNOPROPDELETE:
|
|
|
|
CHECK_EXPECT(DeleteMemberByDispID_false);
|
|
|
|
return S_FALSE;
|
2015-10-15 12:58:38 +02:00
|
|
|
case DISPID_GLOBAL_TESTPROPDELETEERROR:
|
|
|
|
CHECK_EXPECT(DeleteMemberByDispID_error);
|
|
|
|
return E_FAIL;
|
2012-12-17 13:36:55 +01:00
|
|
|
default:
|
|
|
|
ok(0, "id = %d\n", id);
|
|
|
|
}
|
|
|
|
|
|
|
|
return E_FAIL;
|
2011-12-15 15:42:41 +01:00
|
|
|
}
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
static IDispatchExVtbl GlobalVtbl = {
|
|
|
|
DispatchEx_QueryInterface,
|
|
|
|
DispatchEx_AddRef,
|
|
|
|
DispatchEx_Release,
|
|
|
|
DispatchEx_GetTypeInfoCount,
|
|
|
|
DispatchEx_GetTypeInfo,
|
|
|
|
DispatchEx_GetIDsOfNames,
|
|
|
|
DispatchEx_Invoke,
|
|
|
|
Global_GetDispID,
|
|
|
|
Global_InvokeEx,
|
|
|
|
DispatchEx_DeleteMemberByName,
|
2011-12-15 15:42:41 +01:00
|
|
|
Global_DeleteMemberByDispID,
|
2008-09-05 02:38:44 +02:00
|
|
|
DispatchEx_GetMemberProperties,
|
|
|
|
DispatchEx_GetMemberName,
|
|
|
|
DispatchEx_GetNextDispID,
|
|
|
|
DispatchEx_GetNameSpaceParent
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatchEx Global = { &GlobalVtbl };
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid))
|
|
|
|
*ppv = iface;
|
|
|
|
else if(IsEqualGUID(&IID_IActiveScriptSite, riid))
|
|
|
|
*ppv = iface;
|
|
|
|
else
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *plcid)
|
|
|
|
{
|
|
|
|
*plcid = GetUserDefaultLCID();
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName,
|
|
|
|
DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti)
|
|
|
|
{
|
|
|
|
ok(dwReturnMask == SCRIPTINFO_IUNKNOWN, "unexpected dwReturnMask %x\n", dwReturnMask);
|
|
|
|
ok(!ppti, "ppti != NULL\n");
|
|
|
|
|
2020-01-14 15:50:36 +01:00
|
|
|
if(!lstrcmpW(pstrName, L"testVal"))
|
2008-12-15 22:24:33 +01:00
|
|
|
CHECK_EXPECT(GetItemInfo_testVal);
|
2020-01-14 15:50:36 +01:00
|
|
|
else if(lstrcmpW(pstrName, L"test"))
|
2009-08-19 13:36:31 +02:00
|
|
|
ok(0, "unexpected pstrName %s\n", wine_dbgstr_w(pstrName));
|
2008-12-15 22:24:33 +01:00
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
*ppiunkItem = (IUnknown*)&Global;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *pbstrVersion)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface,
|
|
|
|
const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl = {
|
|
|
|
ActiveScriptSite_QueryInterface,
|
|
|
|
ActiveScriptSite_AddRef,
|
|
|
|
ActiveScriptSite_Release,
|
|
|
|
ActiveScriptSite_GetLCID,
|
|
|
|
ActiveScriptSite_GetItemInfo,
|
|
|
|
ActiveScriptSite_GetDocVersionString,
|
|
|
|
ActiveScriptSite_OnScriptTerminate,
|
|
|
|
ActiveScriptSite_OnStateChange,
|
|
|
|
ActiveScriptSite_OnScriptError,
|
|
|
|
ActiveScriptSite_OnEnterScript,
|
|
|
|
ActiveScriptSite_OnLeaveScript
|
|
|
|
};
|
|
|
|
|
|
|
|
static IActiveScriptSite ActiveScriptSite = { &ActiveScriptSiteVtbl };
|
|
|
|
|
2010-10-09 16:43:48 +02:00
|
|
|
static HRESULT WINAPI ActiveScriptSite_OnScriptError_CheckError(IActiveScriptSite *iface, IActiveScriptError *pscripterror)
|
|
|
|
{
|
|
|
|
ok(pscripterror != NULL, "ActiveScriptSite_OnScriptError -- expected pscripterror to be set, got NULL\n");
|
|
|
|
|
|
|
|
script_error = pscripterror;
|
2012-07-30 12:02:01 +02:00
|
|
|
IActiveScriptError_AddRef(script_error);
|
2010-10-09 16:43:48 +02:00
|
|
|
|
|
|
|
CHECK_EXPECT(ActiveScriptSite_OnScriptError);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IActiveScriptSiteVtbl ActiveScriptSite_CheckErrorVtbl = {
|
|
|
|
ActiveScriptSite_QueryInterface,
|
|
|
|
ActiveScriptSite_AddRef,
|
|
|
|
ActiveScriptSite_Release,
|
|
|
|
ActiveScriptSite_GetLCID,
|
|
|
|
ActiveScriptSite_GetItemInfo,
|
|
|
|
ActiveScriptSite_GetDocVersionString,
|
|
|
|
ActiveScriptSite_OnScriptTerminate,
|
|
|
|
ActiveScriptSite_OnStateChange,
|
|
|
|
ActiveScriptSite_OnScriptError_CheckError,
|
|
|
|
ActiveScriptSite_OnEnterScript,
|
|
|
|
ActiveScriptSite_OnLeaveScript
|
|
|
|
};
|
|
|
|
|
|
|
|
static IActiveScriptSite ActiveScriptSite_CheckError = { &ActiveScriptSite_CheckErrorVtbl };
|
|
|
|
|
2009-10-19 20:41:32 +02:00
|
|
|
static HRESULT set_script_prop(IActiveScript *engine, DWORD property, VARIANT *val)
|
|
|
|
{
|
|
|
|
IActiveScriptProperty *script_prop;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptProperty,
|
|
|
|
(void**)&script_prop);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptProperty iface: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScriptProperty_SetProperty(script_prop, property, NULL, val);
|
|
|
|
IActiveScriptProperty_Release(script_prop);
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
static IActiveScript *create_script(void)
|
|
|
|
{
|
|
|
|
IActiveScript *script;
|
2009-10-19 20:41:32 +02:00
|
|
|
VARIANT v;
|
2008-09-05 02:38:44 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2012-03-26 11:43:23 +02:00
|
|
|
hres = CoCreateInstance(engine_clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
2008-09-05 02:38:44 +02:00
|
|
|
&IID_IActiveScript, (void**)&script);
|
|
|
|
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
|
|
|
|
|
2009-10-19 20:41:32 +02:00
|
|
|
V_VT(&v) = VT_I4;
|
|
|
|
V_I4(&v) = invoke_version;
|
|
|
|
hres = set_script_prop(script, SCRIPTPROP_INVOKEVERSIONING, &v);
|
|
|
|
ok(hres == S_OK || broken(hres == E_NOTIMPL), "SetProperty(SCRIPTPROP_INVOKEVERSIONING) failed: %08x\n", hres);
|
|
|
|
if(invoke_version && FAILED(hres)) {
|
|
|
|
IActiveScript_Release(script);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
return script;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
static HRESULT parse_script(DWORD flags, const WCHAR *script_str)
|
2008-09-05 02:38:44 +02:00
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
engine = create_script();
|
|
|
|
if(!engine)
|
2010-01-23 23:58:23 +01:00
|
|
|
return S_OK;
|
2008-09-05 02:38:44 +02:00
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
2009-01-05 15:50:36 +01:00
|
|
|
if (FAILED(hres))
|
|
|
|
{
|
|
|
|
IActiveScript_Release(engine);
|
2010-01-23 23:58:23 +01:00
|
|
|
return hres;
|
2009-01-05 15:50:36 +01:00
|
|
|
}
|
2008-09-05 02:38:44 +02:00
|
|
|
|
2012-07-30 12:02:01 +02:00
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
2008-09-05 02:38:44 +02:00
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"test",
|
2009-09-27 20:59:28 +02:00
|
|
|
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|flags);
|
2008-09-05 02:38:44 +02:00
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
2008-10-02 16:24:02 +02:00
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
2008-09-05 02:38:44 +02:00
|
|
|
|
2009-09-27 20:59:28 +02:00
|
|
|
hres = IActiveScript_GetScriptDispatch(engine, NULL, &script_disp);
|
|
|
|
ok(hres == S_OK, "GetScriptDispatch failed: %08x\n", hres);
|
|
|
|
ok(script_disp != NULL, "script_disp == NULL\n");
|
|
|
|
ok(script_disp != (IDispatch*)&Global, "script_disp == Global\n");
|
|
|
|
|
2012-07-30 12:02:01 +02:00
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
2008-09-05 02:38:44 +02:00
|
|
|
|
2009-09-27 20:59:28 +02:00
|
|
|
IDispatch_Release(script_disp);
|
2008-09-05 02:38:44 +02:00
|
|
|
IActiveScript_Release(engine);
|
2012-07-30 12:02:01 +02:00
|
|
|
IActiveScriptParse_Release(parser);
|
2010-01-23 23:58:23 +01:00
|
|
|
|
|
|
|
return hres;
|
2008-09-05 02:38:44 +02:00
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
static HRESULT invoke_procedure(const WCHAR *args, const WCHAR *source, DISPPARAMS *dp)
|
2012-10-04 14:57:46 +02:00
|
|
|
{
|
|
|
|
IActiveScriptParseProcedure2 *parse_proc;
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
IDispatchEx *dispex;
|
|
|
|
EXCEPINFO ei = {0};
|
|
|
|
IDispatch *disp;
|
|
|
|
VARIANT res;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
engine = create_script();
|
|
|
|
if(!engine)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScriptParseProcedure2_ParseProcedureText(parse_proc, source, args, L"", NULL, NULL, NULL, 0, 0,
|
2012-10-04 14:57:46 +02:00
|
|
|
SCRIPTPROC_HOSTMANAGESSOURCE|SCRIPTPROC_IMPLICIT_THIS|SCRIPTPROC_IMPLICIT_PARENTS, &disp);
|
|
|
|
ok(hres == S_OK, "ParseProcedureText failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
|
|
|
|
ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
|
|
|
|
IDispatch_Release(disp);
|
|
|
|
|
|
|
|
V_VT(&res) = VT_EMPTY;
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, DISPID_VALUE, 0, DISPATCH_METHOD, dp, &res, &ei, NULL);
|
|
|
|
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&res) == VT_BOOL && V_BOOL(&res), "InvokeEx returned vt %d (%x)\n", V_VT(&res), V_I4(&res));
|
|
|
|
IDispatchEx_Release(dispex);
|
|
|
|
|
|
|
|
IActiveScriptParseProcedure2_Release(parse_proc);
|
|
|
|
IActiveScript_Release(engine);
|
|
|
|
IActiveScriptParse_Release(parser);
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:08 +01:00
|
|
|
static HRESULT parse_htmlscript(const WCHAR *script_str)
|
2009-04-09 23:34:56 +02:00
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
engine = create_script();
|
|
|
|
if(!engine)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
if (FAILED(hres))
|
|
|
|
{
|
|
|
|
IActiveScript_Release(engine);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-07-30 12:02:01 +02:00
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
2009-04-09 23:34:56 +02:00
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"test",
|
2009-04-09 23:34:56 +02:00
|
|
|
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
|
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, script_str, NULL, NULL, L"</SCRIPT>", 0, 0, 0, NULL, NULL);
|
2009-04-09 23:34:56 +02:00
|
|
|
|
|
|
|
IActiveScript_Release(engine);
|
2012-07-30 12:02:01 +02:00
|
|
|
IActiveScriptParse_Release(parser);
|
2009-04-09 23:34:56 +02:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
#define ERROR_TODO_PARSE 0x0001
|
|
|
|
#define ERROR_TODO_SCODE 0x0002
|
|
|
|
#define ERROR_TODO_DESCRIPTION 0x0004
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
static void test_error_reports(void)
|
2010-10-09 16:43:48 +02:00
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
2020-01-24 20:41:40 +01:00
|
|
|
unsigned i;
|
2010-10-09 16:43:48 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
static const struct {
|
|
|
|
const WCHAR *script;
|
|
|
|
HRESULT error;
|
|
|
|
unsigned line;
|
|
|
|
unsigned character;
|
|
|
|
const WCHAR *error_source;
|
|
|
|
const WCHAR *description;
|
|
|
|
const WCHAR *line_text;
|
|
|
|
BOOL todo_flags;
|
|
|
|
BOOL reserved_lcid;
|
|
|
|
} tests[] = {
|
|
|
|
{
|
|
|
|
L"?",
|
|
|
|
JS_E_SYNTAX, 0, 0,
|
|
|
|
L"Microsoft JScript compilation error",
|
|
|
|
L"Syntax error",
|
|
|
|
L"?"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var a=1;\nif(a\n-->0) a=5;\n",
|
|
|
|
JS_E_MISSING_RBRACKET, 2, 0,
|
|
|
|
L"Microsoft JScript compilation error",
|
|
|
|
L"Expected ')'",
|
|
|
|
L"-->0) a=5;",
|
|
|
|
ERROR_TODO_PARSE
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"new 3;",
|
|
|
|
JS_E_INVALID_ACTION, 0, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object doesn't support this action"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"new null;",
|
|
|
|
JS_E_OBJECT_EXPECTED, 0, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var a;\nnew null;",
|
|
|
|
JS_E_OBJECT_EXPECTED, 1, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var a; new null;",
|
|
|
|
JS_E_OBJECT_EXPECTED, 0, 7,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var a;\na=\n new null;",
|
|
|
|
JS_E_OBJECT_EXPECTED, 1, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var a;\nif(na=\n new null) {}",
|
|
|
|
JS_E_OBJECT_EXPECTED, 1, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"not_existing_variable.something();",
|
|
|
|
JS_E_UNDEFINED_VARIABLE, 0, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"'not_existing_variable' is undefined"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L" throw 1;",
|
|
|
|
JS_E_EXCEPTION_THROWN, 0, 1,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Exception thrown and not caught"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var f = function() { throw 1; };\n"
|
|
|
|
L"f();\n",
|
|
|
|
JS_E_EXCEPTION_THROWN, 0, 21,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Exception thrown and not caught"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var f = function() { throw 1; };\n"
|
|
|
|
L"try { f(); } finally { 2; }\n",
|
|
|
|
JS_E_EXCEPTION_THROWN, 1, 21,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Exception thrown and not caught"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L" throwInt(-2146827270);",
|
|
|
|
JS_E_MISPLACED_RETURN, 0, 1,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"'return' statement outside of function"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L" throwEI(-2146827270);",
|
|
|
|
JS_E_MISPLACED_RETURN, 0, 1,
|
|
|
|
L"test source",
|
|
|
|
L"test description"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L" throwEI(-2146827270, false);",
|
|
|
|
JS_E_MISPLACED_RETURN, 0, 1,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"'return' statement outside of function"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L" throwEI(-2147467259 /* E_FAIL */, false);",
|
|
|
|
E_FAIL, 0, 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L" throwInt(-2147467259 /* E_FAIL */);",
|
|
|
|
E_FAIL, 0, 1,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
0x409
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L" throwEI(-2147467259 /* E_FAIL */);",
|
|
|
|
E_FAIL, 0, 1,
|
|
|
|
L"test source",
|
|
|
|
L"test description"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"switch(2) {\n"
|
|
|
|
L" case 1: break;\n"
|
|
|
|
L" case 0: break;\n"
|
|
|
|
L" case new null: break;\n"
|
|
|
|
L" default: throw 1;\n"
|
|
|
|
L"}\n",
|
|
|
|
JS_E_OBJECT_EXPECTED, 3, 4,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"do {\n"
|
|
|
|
L" 1;\n"
|
|
|
|
L"} while ( new null );\n",
|
|
|
|
JS_E_OBJECT_EXPECTED, 2, 2,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"for (var i = 0; i < 100; new null) { i++ }",
|
|
|
|
JS_E_OBJECT_EXPECTED, 0, 25,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"for (var i = 0; new null; i++) { i++ }",
|
|
|
|
JS_E_OBJECT_EXPECTED, 0, 16,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"for (new null; i < 100; i++) { i++ }",
|
|
|
|
JS_E_OBJECT_EXPECTED, 0, 5,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Object expected"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var e = new Error();\n"
|
|
|
|
L"e.number = -2146828279;\n"
|
|
|
|
L"e.description = 'test';\n"
|
|
|
|
L"throw e;",
|
|
|
|
JS_E_SUBSCRIPT_OUT_OF_RANGE, 3, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"test",
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
TRUE
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var e = new Error();\n"
|
|
|
|
L"e.number = -2146828279;\n"
|
|
|
|
L"e.message = 'test';\n"
|
|
|
|
L"throw e;",
|
|
|
|
JS_E_SUBSCRIPT_OUT_OF_RANGE, 3, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"",
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
TRUE
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var e = new Error();\n"
|
|
|
|
L"throw e;",
|
|
|
|
E_FAIL, 1, 0,
|
|
|
|
NULL,
|
|
|
|
L"",
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
TRUE
|
|
|
|
},
|
|
|
|
{
|
|
|
|
L"var e = new Object();\n"
|
|
|
|
L"e.number = -2146828279;\n"
|
|
|
|
L"e.description = 'test';\n"
|
|
|
|
L"throw e;",
|
|
|
|
JS_E_EXCEPTION_THROWN, 3, 0,
|
|
|
|
L"Microsoft JScript runtime error",
|
|
|
|
L"Exception thrown and not caught",
|
|
|
|
NULL,
|
|
|
|
ERROR_TODO_SCODE | ERROR_TODO_DESCRIPTION
|
|
|
|
},
|
2020-02-04 20:28:38 +01:00
|
|
|
{
|
|
|
|
L"f(1\n,\n2,\n ,,3\n);\n",
|
|
|
|
JS_E_SYNTAX, 3, 1,
|
|
|
|
L"Microsoft JScript compilation error",
|
|
|
|
L"Syntax error",
|
|
|
|
L" ,,3"
|
|
|
|
},
|
2020-01-24 20:41:40 +01:00
|
|
|
};
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
if (!is_lang_english())
|
|
|
|
skip("Non-english UI (test with hardcoded strings)\n");
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
2010-10-09 16:43:48 +02:00
|
|
|
{
|
2020-01-24 20:41:40 +01:00
|
|
|
engine = create_script();
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite_CheckError);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"test",
|
|
|
|
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
|
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
hres = IActiveScript_GetScriptDispatch(engine, NULL, &script_disp);
|
|
|
|
ok(hres == S_OK, "GetScriptDispatch failed: %08x\n", hres);
|
|
|
|
ok(script_disp != NULL, "script_disp == NULL\n");
|
|
|
|
ok(script_disp != (IDispatch*)&Global, "script_disp == Global\n");
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
script_error = NULL;
|
|
|
|
SET_EXPECT(ActiveScriptSite_OnScriptError);
|
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, tests[i].script, NULL, NULL, NULL, 10, 0, 0, NULL, NULL);
|
2020-01-30 15:50:47 +01:00
|
|
|
todo_wine_if(tests[i].todo_flags & ERROR_TODO_PARSE)
|
|
|
|
ok(hres == SCRIPT_E_REPORTED || (tests[i].error == JS_E_EXCEPTION_THROWN && hres == SCRIPT_E_PROPAGATE),
|
|
|
|
"[%u] got: 0x%08x for %s\n", i, hres, wine_dbgstr_w(tests[i].script));
|
|
|
|
todo_wine_if(tests[i].todo_flags & ERROR_TODO_PARSE)
|
2020-01-24 20:41:40 +01:00
|
|
|
CHECK_CALLED(ActiveScriptSite_OnScriptError);
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
if (script_error)
|
|
|
|
{
|
|
|
|
DWORD source_context;
|
|
|
|
ULONG line_number;
|
|
|
|
LONG character;
|
|
|
|
BSTR line_text;
|
|
|
|
EXCEPINFO ei;
|
|
|
|
|
|
|
|
hres = IActiveScriptError_GetSourcePosition(script_error, NULL, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "GetSourcePosition failed %08x\n", hres);
|
|
|
|
|
|
|
|
source_context = 0xdeadbeef;
|
|
|
|
hres = IActiveScriptError_GetSourcePosition(script_error, &source_context, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "GetSourcePosition failed0x%08x\n", hres);
|
|
|
|
ok(source_context == 10, "source_context = %x\n", source_context);
|
|
|
|
|
|
|
|
line_number = 0xdeadbeef;
|
|
|
|
hres = IActiveScriptError_GetSourcePosition(script_error, NULL, &line_number, NULL);
|
|
|
|
ok(hres == S_OK, "GetSourcePosition failed%08x\n", hres);
|
|
|
|
ok(line_number == tests[i].line, "[%u] line = %u expected %u\n", i, line_number, tests[i].line);
|
|
|
|
|
|
|
|
character = 0xdeadbeef;
|
|
|
|
hres = IActiveScriptError_GetSourcePosition(script_error, NULL, NULL, &character);
|
|
|
|
ok(hres == S_OK, "GetSourcePosition failed: %08x\n", hres);
|
|
|
|
ok(character == tests[i].character, "[%u] character = %u expected %u\n", i, character, tests[i].character);
|
|
|
|
|
|
|
|
hres = IActiveScriptError_GetSourceLineText(script_error, NULL);
|
|
|
|
ok(hres == E_POINTER, "GetSourceLineText returned %08x\n", hres);
|
|
|
|
|
|
|
|
line_text = (BSTR)0xdeadbeef;
|
|
|
|
hres = IActiveScriptError_GetSourceLineText(script_error, &line_text);
|
|
|
|
if (tests[i].line_text)
|
|
|
|
{
|
|
|
|
ok(hres == S_OK, "GetSourceLineText failed: %08x\n", hres);
|
|
|
|
ok(line_text != NULL && !lstrcmpW(line_text, tests[i].line_text), "[%u] GetSourceLineText returned %s expected %s\n",
|
|
|
|
i, wine_dbgstr_w(line_text), wine_dbgstr_w(tests[i].line_text));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok(hres == E_FAIL, "GetSourceLineText failed: %08x\n", hres);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hres))
|
|
|
|
SysFreeString(line_text);
|
|
|
|
|
|
|
|
hres = IActiveScriptError_GetExceptionInfo(script_error, NULL);
|
|
|
|
ok(hres == E_POINTER, "GetExceptionInfo failed: %08x\n", hres);
|
|
|
|
|
|
|
|
ei.wCode = 0xdead;
|
|
|
|
ei.wReserved = 0xdead;
|
|
|
|
ei.bstrSource = (BSTR)0xdeadbeef;
|
|
|
|
ei.bstrDescription = (BSTR)0xdeadbeef;
|
|
|
|
ei.bstrHelpFile = (BSTR)0xdeadbeef;
|
|
|
|
ei.dwHelpContext = 0xdeadbeef;
|
|
|
|
ei.pvReserved = (void *)0xdeadbeef;
|
|
|
|
ei.pfnDeferredFillIn = (void *)0xdeadbeef;
|
|
|
|
ei.scode = 0xdeadbeef;
|
|
|
|
|
|
|
|
hres = IActiveScriptError_GetExceptionInfo(script_error, &ei);
|
|
|
|
ok(hres == S_OK, "GetExceptionInfo failed: %08x\n", hres);
|
|
|
|
|
|
|
|
todo_wine_if(tests[i].todo_flags & ERROR_TODO_SCODE)
|
|
|
|
ok(ei.scode == tests[i].error, "[%u] scode = %08x, expected %08x\n", i, ei.scode, tests[i].error);
|
|
|
|
ok(ei.wCode == 0, "wCode = %x\n", ei.wCode);
|
|
|
|
todo_wine_if(tests[i].reserved_lcid)
|
|
|
|
ok(ei.wReserved == (tests[i].reserved_lcid ? GetUserDefaultLCID() : 0), "[%u] wReserved = %x expected %x\n",
|
|
|
|
i, ei.wReserved, (tests[i].reserved_lcid ? GetUserDefaultLCID() : 0));
|
|
|
|
if (is_lang_english())
|
|
|
|
{
|
|
|
|
if(tests[i].error_source)
|
|
|
|
ok(ei.bstrSource && !lstrcmpW(ei.bstrSource, tests[i].error_source), "[%u] bstrSource = %s expected %s\n",
|
|
|
|
i, wine_dbgstr_w(ei.bstrSource), wine_dbgstr_w(tests[i].error_source));
|
|
|
|
else
|
|
|
|
ok(!ei.bstrSource, "[%u] bstrSource = %s expected NULL\n", i, wine_dbgstr_w(ei.bstrSource));
|
|
|
|
if(tests[i].description)
|
2020-02-03 14:47:59 +01:00
|
|
|
todo_wine_if(tests[i].todo_flags & ERROR_TODO_DESCRIPTION)
|
2020-01-24 20:41:40 +01:00
|
|
|
ok(ei.bstrDescription && !lstrcmpW(ei.bstrDescription, tests[i].description),
|
|
|
|
"[%u] bstrDescription = %s expected %s\n", i, wine_dbgstr_w(ei.bstrDescription), wine_dbgstr_w(tests[i].description));
|
|
|
|
else
|
|
|
|
ok(!ei.bstrDescription, "[%u] bstrDescription = %s expected NULL\n", i, wine_dbgstr_w(ei.bstrDescription));
|
|
|
|
}
|
|
|
|
ok(!ei.bstrHelpFile, "bstrHelpFile = %s\n", wine_dbgstr_w(ei.bstrHelpFile));
|
|
|
|
ok(!ei.dwHelpContext, "dwHelpContext = %d\n", ei.dwHelpContext);
|
|
|
|
ok(!ei.pvReserved, "pvReserved = %p\n", ei.pvReserved);
|
|
|
|
ok(!ei.pfnDeferredFillIn, "pfnDeferredFillIn = %p\n", ei.pfnDeferredFillIn);
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2020-01-24 20:41:40 +01:00
|
|
|
SysFreeString(ei.bstrSource);
|
|
|
|
SysFreeString(ei.bstrDescription);
|
|
|
|
SysFreeString(ei.bstrHelpFile);
|
|
|
|
|
|
|
|
IActiveScriptError_Release(script_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
IDispatch_Release(script_disp);
|
|
|
|
IActiveScript_Release(engine);
|
|
|
|
IActiveScriptParse_Release(parser);
|
|
|
|
}
|
2010-10-09 16:43:48 +02:00
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
#define run_script(a) _run_script(__LINE__,a)
|
|
|
|
static void _run_script(unsigned line, const WCHAR *src)
|
2008-09-05 02:38:44 +02:00
|
|
|
{
|
2010-01-23 23:58:23 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, src);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "script %s failed: %08x\n", wine_dbgstr_w(src), hres);
|
2015-10-15 12:58:38 +02:00
|
|
|
}
|
|
|
|
|
2008-10-02 16:24:02 +02:00
|
|
|
static BSTR get_script_from_file(const char *filename)
|
|
|
|
{
|
|
|
|
DWORD size, len;
|
|
|
|
HANDLE file, map;
|
|
|
|
const char *file_map;
|
|
|
|
BSTR ret;
|
|
|
|
|
|
|
|
file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
|
|
|
|
if(file == INVALID_HANDLE_VALUE) {
|
|
|
|
trace("Could not open file: %u\n", GetLastError());
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
size = GetFileSize(file, NULL);
|
|
|
|
|
2013-10-14 16:05:34 +02:00
|
|
|
map = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
|
2008-10-02 16:24:02 +02:00
|
|
|
CloseHandle(file);
|
|
|
|
if(map == INVALID_HANDLE_VALUE) {
|
|
|
|
trace("Could not create file mapping: %u\n", GetLastError());
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
file_map = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
|
|
|
|
CloseHandle(map);
|
|
|
|
if(!file_map) {
|
|
|
|
trace("MapViewOfFile failed: %u\n", GetLastError());
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, file_map, size, NULL, 0);
|
|
|
|
ret = SysAllocStringLen(NULL, len);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, file_map, size, ret, len);
|
|
|
|
|
|
|
|
UnmapViewOfFile(file_map);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void run_from_file(const char *filename)
|
|
|
|
{
|
2010-01-23 23:58:23 +01:00
|
|
|
BSTR script_str;
|
|
|
|
HRESULT hres;
|
2008-10-02 16:24:02 +02:00
|
|
|
|
2010-01-23 23:58:23 +01:00
|
|
|
script_str = get_script_from_file(filename);
|
|
|
|
if(!script_str)
|
|
|
|
return;
|
2008-10-02 16:24:02 +02:00
|
|
|
|
2010-01-23 23:58:23 +01:00
|
|
|
strict_dispid_check = FALSE;
|
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, script_str);
|
2008-10-02 16:24:02 +02:00
|
|
|
SysFreeString(script_str);
|
2010-01-23 23:58:23 +01:00
|
|
|
ok(hres == S_OK, "parse_script failed: %08x\n", hres);
|
2008-10-02 16:24:02 +02:00
|
|
|
}
|
|
|
|
|
2013-04-23 15:03:35 +02:00
|
|
|
static BSTR load_res(const char *name)
|
2008-09-09 01:25:23 +02:00
|
|
|
{
|
|
|
|
const char *data;
|
|
|
|
DWORD size, len;
|
|
|
|
BSTR str;
|
|
|
|
HRSRC src;
|
|
|
|
|
|
|
|
strict_dispid_check = FALSE;
|
|
|
|
test_name = name;
|
|
|
|
|
|
|
|
src = FindResourceA(NULL, name, (LPCSTR)40);
|
|
|
|
ok(src != NULL, "Could not find resource %s\n", name);
|
|
|
|
|
|
|
|
size = SizeofResource(NULL, src);
|
|
|
|
data = LoadResource(NULL, src);
|
|
|
|
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, data, size, NULL, 0);
|
2008-09-17 03:05:38 +02:00
|
|
|
str = SysAllocStringLen(NULL, len);
|
2011-02-17 03:43:24 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, data, size, str, len);
|
2008-09-09 01:25:23 +02:00
|
|
|
|
2013-04-23 15:03:35 +02:00
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void run_from_res(const char *name)
|
|
|
|
{
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
str = load_res(name);
|
|
|
|
|
2008-09-09 01:25:23 +02:00
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
2010-01-23 23:58:23 +01:00
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, str);
|
2008-09-09 01:25:23 +02:00
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
2010-01-23 23:58:23 +01:00
|
|
|
ok(hres == S_OK, "parse_script failed: %08x\n", hres);
|
2008-09-09 01:25:23 +02:00
|
|
|
SysFreeString(str);
|
|
|
|
}
|
|
|
|
|
2008-12-15 22:24:33 +01:00
|
|
|
static void test_isvisible(BOOL global_members)
|
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const WCHAR script_textW[] =
|
|
|
|
{'v','a','r',' ','v',' ','=',' ','t','e','s','t','V','a','l',';',0};
|
|
|
|
|
|
|
|
engine = create_script();
|
|
|
|
if(!engine)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
2009-01-05 15:50:36 +01:00
|
|
|
if (FAILED(hres))
|
|
|
|
{
|
|
|
|
IActiveScript_Release(engine);
|
|
|
|
return;
|
|
|
|
}
|
2008-12-15 22:24:33 +01:00
|
|
|
|
2012-07-30 12:02:01 +02:00
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
2008-12-15 22:24:33 +01:00
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
|
|
|
if(global_members)
|
|
|
|
SET_EXPECT(GetItemInfo_testVal);
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"testVal",
|
2008-12-15 22:24:33 +01:00
|
|
|
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|
|
|
|
|
(global_members ? SCRIPTITEM_GLOBALMEMBERS : 0));
|
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
if(global_members)
|
|
|
|
CHECK_CALLED(GetItemInfo_testVal);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
|
|
|
|
if(!global_members)
|
|
|
|
SET_EXPECT(GetItemInfo_testVal);
|
2012-07-30 12:02:01 +02:00
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
2008-12-15 22:24:33 +01:00
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
|
|
|
if(!global_members)
|
|
|
|
CHECK_CALLED(GetItemInfo_testVal);
|
|
|
|
|
2012-07-30 12:02:01 +02:00
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
2008-12-15 22:24:33 +01:00
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
|
|
|
|
|
|
|
IActiveScript_Release(engine);
|
2012-07-30 12:02:01 +02:00
|
|
|
IActiveScriptParse_Release(parser);
|
2008-12-15 22:24:33 +01:00
|
|
|
}
|
|
|
|
|
2015-01-13 21:46:02 +01:00
|
|
|
static void test_start(void)
|
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
script_engine = engine = create_script();
|
|
|
|
if(!engine)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"test", SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
|
2015-01-13 21:46:02 +01:00
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"ok(getScriptState() === 5, \"getScriptState = \" + getScriptState());\n"
|
|
|
|
L"reportSuccess();");
|
2015-01-13 21:46:02 +01:00
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
|
|
|
IActiveScript_Release(engine);
|
|
|
|
IActiveScriptParse_Release(parser);
|
|
|
|
script_engine = NULL;
|
|
|
|
}
|
|
|
|
|
2015-06-02 14:45:20 +02:00
|
|
|
static void test_automagic(void)
|
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
script_engine = engine = create_script();
|
|
|
|
if(!engine)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"test", SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
|
2015-06-02 14:45:20 +02:00
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"function bindEventHandler::eventName() {}\n"
|
|
|
|
L"reportSuccess();");
|
2015-06-02 14:45:20 +02:00
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
SET_EXPECT(BindHandler);
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(BindHandler);
|
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
|
|
|
IActiveScript_Release(engine);
|
|
|
|
IActiveScriptParse_Release(parser);
|
|
|
|
script_engine = NULL;
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
static HRESULT parse_script_expr(const WCHAR *expr, VARIANT *res, IActiveScript **engine_ret)
|
2012-12-12 13:12:39 +01:00
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
engine = create_script();
|
2018-01-08 15:57:22 +01:00
|
|
|
if(!engine)
|
|
|
|
return E_FAIL;
|
2012-12-12 13:12:39 +01:00
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
|
|
|
SET_EXPECT(GetItemInfo_testVal);
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"testVal",
|
2012-12-12 13:12:39 +01:00
|
|
|
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
|
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(GetItemInfo_testVal);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, expr, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, res, NULL);
|
2012-12-12 13:12:39 +01:00
|
|
|
IActiveScriptParse_Release(parser);
|
|
|
|
|
2020-01-03 20:34:06 +01:00
|
|
|
if(engine_ret)
|
2015-01-13 21:45:56 +01:00
|
|
|
*engine_ret = engine;
|
2020-01-03 20:34:06 +01:00
|
|
|
else
|
|
|
|
close_script(engine);
|
|
|
|
|
2012-12-12 13:12:39 +01:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2015-05-29 18:07:37 +02:00
|
|
|
static void test_retval(void)
|
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
SCRIPTSTATE state;
|
|
|
|
VARIANT res;
|
|
|
|
HRESULT hres;
|
2020-01-03 20:34:06 +01:00
|
|
|
BSTR str;
|
2015-05-29 18:07:37 +02:00
|
|
|
|
|
|
|
engine = create_script();
|
2018-01-08 15:57:22 +01:00
|
|
|
if(!engine)
|
|
|
|
return;
|
2015-05-29 18:07:37 +02:00
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
|
|
|
SET_EXPECT(GetItemInfo_testVal);
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"testVal",
|
2015-05-29 18:07:37 +02:00
|
|
|
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
|
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(GetItemInfo_testVal);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"reportSuccess(), true");
|
2015-05-29 18:07:37 +02:00
|
|
|
V_VT(&res) = VT_NULL;
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, &res, NULL);
|
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&res) == VT_EMPTY, "V_VT(&res) = %d\n", V_VT(&res));
|
2020-01-03 20:34:06 +01:00
|
|
|
SysFreeString(str);
|
2015-05-29 18:07:37 +02:00
|
|
|
|
|
|
|
hres = IActiveScript_GetScriptState(engine, &state);
|
|
|
|
ok(hres == S_OK, "GetScriptState failed: %08x\n", hres);
|
|
|
|
ok(state == SCRIPTSTATE_INITIALIZED, "state = %d\n", state);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
|
|
|
|
IActiveScriptParse_Release(parser);
|
2020-01-03 20:34:06 +01:00
|
|
|
|
|
|
|
close_script(engine);
|
2015-05-29 18:07:37 +02:00
|
|
|
}
|
|
|
|
|
2014-12-13 01:47:52 +01:00
|
|
|
static void test_default_value(void)
|
|
|
|
{
|
|
|
|
DISPPARAMS dp = {0};
|
|
|
|
IDispatch *disp;
|
|
|
|
VARIANT v;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"new Date()", &v, NULL);
|
2014-12-13 01:47:52 +01:00
|
|
|
ok(hres == S_OK, "parse_script_expr failed: %08x\n", hres);
|
2015-01-05 19:26:02 +01:00
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(v) = %d\n", V_VT(&v));
|
2014-12-13 01:47:52 +01:00
|
|
|
disp = V_DISPATCH(&v);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &v, NULL, NULL);
|
|
|
|
ok(hres == S_OK || broken(hres == 0x8000ffff), "Invoke failed: %08x\n", hres);
|
|
|
|
if(hres == S_OK)
|
|
|
|
{
|
|
|
|
ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
}
|
|
|
|
|
|
|
|
VariantClear(&v);
|
|
|
|
IDispatch_Release(disp);
|
|
|
|
}
|
|
|
|
|
2012-12-12 13:12:39 +01:00
|
|
|
static void test_script_exprs(void)
|
|
|
|
{
|
|
|
|
VARIANT v;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
testing_expr = TRUE;
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"true", &v, NULL);
|
2012-12-12 13:12:39 +01:00
|
|
|
ok(hres == S_OK, "parse_script_expr failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_BOOL, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
ok(V_BOOL(&v) == VARIANT_TRUE, "V_BOOL(v) = %x\n", V_BOOL(&v));
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"false, true", &v, NULL);
|
2012-12-12 13:12:39 +01:00
|
|
|
ok(hres == S_OK, "parse_script_expr failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_BOOL, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
ok(V_BOOL(&v) == VARIANT_TRUE, "V_BOOL(v) = %x\n", V_BOOL(&v));
|
|
|
|
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"reportSuccess(); true", &v, NULL);
|
2012-12-12 13:12:39 +01:00
|
|
|
ok(hres == S_OK, "parse_script_expr failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_BOOL, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
ok(V_BOOL(&v) == VARIANT_TRUE, "V_BOOL(v) = %x\n", V_BOOL(&v));
|
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"if(false) true", &v, NULL);
|
2012-12-12 13:12:39 +01:00
|
|
|
ok(hres == S_OK, "parse_script_expr failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_EMPTY, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"return testPropGet", &v, NULL);
|
2012-12-12 13:12:39 +01:00
|
|
|
ok(hres == 0x800a03fa, "parse_script_expr failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"reportSuccess(); return true", &v, NULL);
|
2012-12-12 13:12:39 +01:00
|
|
|
ok(hres == 0x800a03fa, "parse_script_expr failed: %08x\n", hres);
|
|
|
|
|
2014-06-09 14:02:35 +02:00
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"reportSuccess(); true", NULL, NULL);
|
2014-06-09 14:02:35 +02:00
|
|
|
ok(hres == S_OK, "parse_script_expr failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
2014-12-13 01:47:52 +01:00
|
|
|
test_default_value();
|
2015-05-29 18:07:37 +02:00
|
|
|
test_retval();
|
2014-12-13 01:47:52 +01:00
|
|
|
|
2012-12-12 13:12:39 +01:00
|
|
|
testing_expr = FALSE;
|
|
|
|
}
|
|
|
|
|
2015-01-13 21:45:56 +01:00
|
|
|
static void test_invokeex(void)
|
|
|
|
{
|
|
|
|
DISPID func_id, prop_id;
|
|
|
|
DISPPARAMS dp = {NULL};
|
|
|
|
IActiveScript *script;
|
|
|
|
IDispatchEx *dispex;
|
|
|
|
VARIANT v;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = parse_script_expr(L"var o = {func: function() {return 3;}, prop: 6}; o", &v, &script);
|
2015-01-13 21:45:56 +01:00
|
|
|
ok(hres == S_OK, "parse_script_expr failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
|
|
|
|
hres = IDispatch_QueryInterface(V_DISPATCH(&v), &IID_IDispatchEx, (void**)&dispex);
|
|
|
|
ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"func");
|
2015-01-13 21:45:56 +01:00
|
|
|
hres = IDispatchEx_GetDispID(dispex, str, 0, &func_id);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"prop");
|
2015-01-13 21:45:56 +01:00
|
|
|
hres = IDispatchEx_GetDispID(dispex, str, 0, &prop_id);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, func_id, 0, DISPATCH_METHOD, &dp, &v, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
ok(V_I4(&v) == 3, "V_I4(v) = %d\n", V_I4(&v));
|
|
|
|
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, prop_id, 0, DISPATCH_PROPERTYGET, &dp, &v, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
ok(V_I4(&v) == 6, "V_I4(v) = %d\n", V_I4(&v));
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_UNINITIALIZED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"func");
|
2015-01-13 21:45:56 +01:00
|
|
|
hres = IDispatchEx_GetDispID(dispex, str, 0, &func_id);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, func_id, 0, DISPATCH_METHOD, &dp, &v, NULL, NULL);
|
|
|
|
ok(hres == E_UNEXPECTED || broken(hres == 0x800a1393), "InvokeEx failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IDispatchEx_InvokeEx(dispex, prop_id, 0, DISPATCH_PROPERTYGET, &dp, &v, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
|
|
|
|
ok(V_I4(&v) == 6, "V_I4(v) = %d\n", V_I4(&v));
|
|
|
|
|
|
|
|
IDispatchEx_Release(dispex);
|
|
|
|
IActiveScript_Release(script);
|
|
|
|
}
|
|
|
|
|
2019-05-20 21:05:25 +02:00
|
|
|
static void test_eval(void)
|
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IDispatchEx *script_dispex;
|
|
|
|
IDispatch *script_disp;
|
|
|
|
IActiveScript *engine;
|
|
|
|
VARIANT arg, res;
|
|
|
|
DISPPARAMS params;
|
|
|
|
DISPID id, v_id;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
engine = create_script();
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
|
|
|
SET_EXPECT(GetItemInfo_testVal);
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"testVal",
|
2019-05-20 21:05:25 +02:00
|
|
|
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
|
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(GetItemInfo_testVal);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_GetScriptDispatch(engine, NULL, &script_disp);
|
|
|
|
ok(hres == S_OK, "GetScriptDispatch failed: %08x\n", hres);
|
|
|
|
ok(script_disp != NULL, "script_disp == NULL\n");
|
|
|
|
|
|
|
|
hres = IDispatch_QueryInterface(script_disp, &IID_IDispatchEx, (void**)&script_dispex);
|
2019-08-08 15:18:23 +02:00
|
|
|
ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
|
2019-05-20 21:05:25 +02:00
|
|
|
IDispatch_Release(script_disp);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"eval");
|
2019-05-20 21:05:25 +02:00
|
|
|
hres = IDispatchEx_GetDispID(script_dispex, str, 0, &id);
|
|
|
|
ok(hres == S_OK, "Could not get eval dispid: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
params.rgvarg = &arg;
|
|
|
|
params.rgdispidNamedArgs = NULL;
|
|
|
|
params.cArgs = 1;
|
|
|
|
params.cNamedArgs = 0;
|
|
|
|
V_VT(&arg) = VT_BSTR;
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(&arg) = SysAllocString(L"var v = 1;");
|
2019-05-20 21:05:25 +02:00
|
|
|
V_VT(&res) = VT_ERROR;
|
|
|
|
hres = IDispatchEx_InvokeEx(script_dispex, id, 0, DISPATCH_METHOD, ¶ms, &res, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&res) == VT_EMPTY, "eval returned type %u\n", V_VT(&res));
|
|
|
|
SysFreeString(V_BSTR(&arg));
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
V_BSTR(&arg) = SysAllocString(L"v");
|
2019-05-20 21:05:25 +02:00
|
|
|
V_VT(&res) = VT_ERROR;
|
|
|
|
hres = IDispatchEx_InvokeEx(script_dispex, id, 0, DISPATCH_METHOD, ¶ms, &res, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&res) == VT_I4, "eval returned type %u\n", V_VT(&res));
|
|
|
|
ok(V_I4(&res) == 1, "eval returned %d\n", V_I4(&res));
|
|
|
|
SysFreeString(V_BSTR(&arg));
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"v");
|
2019-05-20 21:05:25 +02:00
|
|
|
hres = IDispatchEx_GetDispID(script_dispex, str, 0, &v_id);
|
|
|
|
ok(hres == S_OK, "Could not get v dispid: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
params.rgvarg = NULL;
|
|
|
|
params.cArgs = 0;
|
|
|
|
V_VT(&res) = VT_ERROR;
|
|
|
|
hres = IDispatchEx_InvokeEx(script_dispex, v_id, 0, DISPATCH_PROPERTYGET, ¶ms, &res, NULL, NULL);
|
|
|
|
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&res) == VT_I4, "eval returned type %u\n", V_VT(&res));
|
|
|
|
ok(V_I4(&res) == 1, "eval returned %d\n", V_I4(&res));
|
|
|
|
|
|
|
|
SET_EXPECT(global_calleval_i);
|
2020-01-14 15:50:23 +01:00
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser,
|
|
|
|
L"(function(){"
|
|
|
|
L" var v = 2;"
|
|
|
|
L" callEval(eval);"
|
|
|
|
L" ok(x === 5, 'x = ' + x);"
|
|
|
|
L"})();",
|
|
|
|
NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
2019-05-20 21:05:25 +02:00
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(global_calleval_i);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
str = SysAllocString(L"x");
|
2019-05-20 21:05:25 +02:00
|
|
|
hres = IDispatchEx_GetDispID(script_dispex, str, 0, &id);
|
|
|
|
ok(hres == DISP_E_UNKNOWNNAME, "GetDispID(x) returned %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
IDispatchEx_Release(script_dispex);
|
|
|
|
IActiveScriptParse_Release(parser);
|
2020-01-03 20:34:06 +01:00
|
|
|
close_script(engine);
|
2019-05-20 21:05:25 +02:00
|
|
|
}
|
|
|
|
|
2014-10-02 08:09:10 +02:00
|
|
|
struct bom_test
|
|
|
|
{
|
|
|
|
WCHAR str[1024];
|
|
|
|
HRESULT hres;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void run_bom_tests(void)
|
|
|
|
{
|
|
|
|
BSTR src;
|
|
|
|
int i;
|
|
|
|
HRESULT hres;
|
|
|
|
struct bom_test bom_tests[] = {
|
|
|
|
{{'v','a','r',' ','a',' ','=',' ','1',';',' ','r','e','p','o','r','t','S','u','c','c','e','s','s','(',')',';','\0'}, S_OK},
|
|
|
|
{{0xFEFF,'v','a','r',' ','a',' ','=',' ','1',';',' ','r','e','p','o','r','t','S','u','c','c','e','s','s','(',')',';','\0'}, S_OK},
|
|
|
|
{{'v',0xFEFF,'a','r',' ','a',' ','=',' ','1',';',' ','r','e','p','o','r','t','S','u','c','c','e','s','s','(',')',';','\0'}, JS_E_OUT_OF_MEMORY},
|
|
|
|
{{'v','a','r',0xFEFF,' ','a',' ','=',' ','1',';',' ','r','e','p','o','r','t','S','u','c','c','e','s','s','(',')',';','\0'}, S_OK},
|
|
|
|
{{'v','a','r',' ','a',' ','=',' ','1',';',' ',0xFEFF,'r','e','p','o','r','t','S','u','c','c','e','s','s','(',')',';','\0'}, S_OK},
|
|
|
|
{{'v','a','r',' ','a',' ','=',' ','1',';',' ','r','e','p','o','r','t',0xFEFF,'S','u','c','c','e','s','s','(',')',';','\0'}, JS_E_OUT_OF_MEMORY},
|
|
|
|
{{'v','a','r',' ','a',' ','=',' ','1',';',' ','r','e','p','o','r','t','S','u','c','c','e','s','s',0xFEFF,'(',')',';','\0'}, S_OK},
|
|
|
|
{{'v','a','r',' ','a',' ','=',' ','1',';',' ','r','e','p','o','r','t','S','u','c','c','e','s','s','(',0xFEFF,')',';','\0'}, S_OK},
|
|
|
|
{{'v','a','r',' ','a',' ','=',0xFEFF,' ','1',';',' ','r','e','p','o','r','t','S','u','c','c','e','s','s','(',0xFEFF,')',';','\0'}, S_OK},
|
|
|
|
{{0xFEFF,'v','a','r',' ','a',' ','=',0xFEFF,0xFEFF,' ','1',';',' ','r','e','p','o','r','t','S','u','c','c','e','s','s','(',0xFEFF,')',';','\0'}, S_OK},
|
|
|
|
{{0}}
|
|
|
|
};
|
|
|
|
|
|
|
|
engine_clsid = &CLSID_JScript;
|
|
|
|
|
|
|
|
for (i = 0; bom_tests[i].str[0]; i++)
|
|
|
|
{
|
|
|
|
if(bom_tests[i].hres == S_OK)
|
|
|
|
{
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
|
|
|
src = SysAllocString(bom_tests[i].str);
|
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, src);
|
|
|
|
ok(hres == S_OK, "test %s failed with %08x\n", wine_dbgstr_w(src), hres);
|
|
|
|
SysFreeString(src);
|
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
src = SysAllocString(bom_tests[i].str);
|
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, src);
|
|
|
|
todo_wine ok(hres == bom_tests[i].hres, "test %s returned with %08x\n", wine_dbgstr_w(src), hres);
|
|
|
|
SysFreeString(src);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-26 11:43:23 +02:00
|
|
|
static BOOL run_tests(void)
|
2008-09-05 02:38:44 +02:00
|
|
|
{
|
2009-04-09 23:34:56 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2009-10-19 20:41:32 +02:00
|
|
|
if(invoke_version) {
|
|
|
|
IActiveScript *script;
|
|
|
|
|
|
|
|
script = create_script();
|
|
|
|
if(!script) {
|
|
|
|
win_skip("Could not create script\n");
|
2012-03-26 11:43:23 +02:00
|
|
|
return FALSE;
|
2009-10-19 20:41:32 +02:00
|
|
|
}
|
|
|
|
IActiveScript_Release(script);
|
|
|
|
}
|
|
|
|
|
2008-09-09 01:25:23 +02:00
|
|
|
strict_dispid_check = TRUE;
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"");
|
|
|
|
run_script(L"/* empty */ ;");
|
2008-09-09 01:22:31 +02:00
|
|
|
|
|
|
|
SET_EXPECT(global_propget_d);
|
|
|
|
SET_EXPECT(global_propget_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"testPropGet;");
|
2008-09-09 01:22:31 +02:00
|
|
|
CHECK_CALLED(global_propget_d);
|
|
|
|
CHECK_CALLED(global_propget_i);
|
2008-09-09 01:24:02 +02:00
|
|
|
|
|
|
|
SET_EXPECT(global_propput_d);
|
|
|
|
SET_EXPECT(global_propput_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"testPropPut = 1;");
|
2008-09-09 01:24:02 +02:00
|
|
|
CHECK_CALLED(global_propput_d);
|
|
|
|
CHECK_CALLED(global_propput_i);
|
2008-09-09 01:25:05 +02:00
|
|
|
|
2014-11-28 16:18:32 +01:00
|
|
|
SET_EXPECT(global_propputref_d);
|
|
|
|
SET_EXPECT(global_propputref_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"testPropPutRef = new Object();");
|
2014-11-28 16:18:32 +01:00
|
|
|
CHECK_CALLED(global_propputref_d);
|
|
|
|
CHECK_CALLED(global_propputref_i);
|
|
|
|
|
|
|
|
SET_EXPECT(global_propputref_d);
|
|
|
|
SET_EXPECT(global_propputref_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"testPropPutRef = testObj;");
|
2014-11-28 16:18:32 +01:00
|
|
|
CHECK_CALLED(global_propputref_d);
|
|
|
|
CHECK_CALLED(global_propputref_i);
|
|
|
|
|
2008-09-09 01:25:05 +02:00
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"reportSuccess();");
|
2008-09-09 01:25:05 +02:00
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
2008-09-09 01:25:23 +02:00
|
|
|
|
2012-12-17 13:36:44 +01:00
|
|
|
SET_EXPECT(testobj_delete_test);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok((delete testObj.deleteTest) === true, 'delete testObj.deleteTest did not return true');");
|
2012-12-17 13:36:44 +01:00
|
|
|
CHECK_CALLED(testobj_delete_test);
|
|
|
|
|
|
|
|
SET_EXPECT(testobj_delete_nodelete);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok((delete testObj.noDeleteTest) === false, 'delete testObj.noDeleteTest did not return false');");
|
2012-12-17 13:36:44 +01:00
|
|
|
CHECK_CALLED(testobj_delete_nodelete);
|
2008-09-19 00:43:37 +02:00
|
|
|
|
2011-12-15 15:42:41 +01:00
|
|
|
SET_EXPECT(global_propdelete_d);
|
|
|
|
SET_EXPECT(DeleteMemberByDispID);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok((delete testPropDelete) === true, 'delete testPropDelete did not return true');");
|
2011-12-15 15:42:41 +01:00
|
|
|
CHECK_CALLED(global_propdelete_d);
|
|
|
|
CHECK_CALLED(DeleteMemberByDispID);
|
|
|
|
|
2012-12-17 13:36:55 +01:00
|
|
|
SET_EXPECT(global_nopropdelete_d);
|
|
|
|
SET_EXPECT(DeleteMemberByDispID_false);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok((delete testNoPropDelete) === false, 'delete testPropDelete did not return false');");
|
2012-12-17 13:36:55 +01:00
|
|
|
CHECK_CALLED(global_nopropdelete_d);
|
|
|
|
CHECK_CALLED(DeleteMemberByDispID_false);
|
|
|
|
|
2015-10-15 12:58:38 +02:00
|
|
|
SET_EXPECT(global_propdeleteerror_d);
|
|
|
|
SET_EXPECT(DeleteMemberByDispID_error);
|
2020-01-14 15:50:13 +01:00
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, L"delete testPropDeleteError;");
|
|
|
|
ok(hres == E_FAIL, "unexpected result %08x\n", hres);
|
2015-10-15 12:58:38 +02:00
|
|
|
CHECK_CALLED(global_propdeleteerror_d);
|
|
|
|
CHECK_CALLED(DeleteMemberByDispID_error);
|
|
|
|
|
2012-12-17 13:36:31 +01:00
|
|
|
SET_EXPECT(puredisp_prop_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok((delete pureDisp.prop) === false, 'delete pureDisp.prop did not return true');");
|
2012-12-17 13:36:31 +01:00
|
|
|
CHECK_CALLED(puredisp_prop_d);
|
|
|
|
|
|
|
|
SET_EXPECT(puredisp_noprop_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok((delete pureDisp.noprop) === true, 'delete pureDisp.noprop did not return false');");
|
2012-12-17 13:36:31 +01:00
|
|
|
CHECK_CALLED(puredisp_noprop_d);
|
|
|
|
|
2012-12-24 11:38:28 +01:00
|
|
|
SET_EXPECT(puredisp_value);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t=pureDisp; t=t(false);");
|
2012-12-24 11:38:28 +01:00
|
|
|
CHECK_CALLED(puredisp_value);
|
|
|
|
|
|
|
|
SET_EXPECT(puredisp_value);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t = {func: pureDisp}; t = t.func(false);");
|
2012-12-24 11:38:28 +01:00
|
|
|
CHECK_CALLED(puredisp_value);
|
|
|
|
|
|
|
|
SET_EXPECT(dispexfunc_value);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t = dispexFunc; t = t(false);");
|
2012-12-24 11:38:28 +01:00
|
|
|
CHECK_CALLED(dispexfunc_value);
|
|
|
|
|
|
|
|
SET_EXPECT(dispexfunc_value);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t = {func: dispexFunc}; t = t.func(false);");
|
2012-12-24 11:38:28 +01:00
|
|
|
CHECK_CALLED(dispexfunc_value);
|
|
|
|
|
2016-06-15 18:37:13 +02:00
|
|
|
SET_EXPECT(dispexfunc_value);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"Function.prototype.apply.call(dispexFunc, testObj, [true]);");
|
2016-06-15 18:37:13 +02:00
|
|
|
CHECK_CALLED(dispexfunc_value);
|
|
|
|
|
|
|
|
SET_EXPECT(puredisp_value);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"Function.prototype.apply.call(pureDisp, testObj, [true]);");
|
2016-06-15 18:37:13 +02:00
|
|
|
CHECK_CALLED(puredisp_value);
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"(function reportSuccess() {})()");
|
2011-12-16 11:42:57 +01:00
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(typeof(test) === 'object', \"typeof(test) != 'object'\");");
|
2008-11-05 01:03:38 +01:00
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"function reportSuccess() {}; reportSuccess();");
|
2009-08-10 12:57:23 +02:00
|
|
|
|
2009-08-10 12:57:42 +02:00
|
|
|
SET_EXPECT(global_propget_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var testPropGet");
|
2009-08-10 12:57:42 +02:00
|
|
|
CHECK_CALLED(global_propget_d);
|
|
|
|
|
2010-10-14 15:21:13 +02:00
|
|
|
SET_EXPECT(global_propget_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"eval('var testPropGet;');");
|
2010-10-14 15:21:13 +02:00
|
|
|
CHECK_CALLED(global_propget_d);
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var testPropGet; function testPropGet() {}");
|
2016-08-04 13:39:46 +02:00
|
|
|
|
2009-08-10 12:57:42 +02:00
|
|
|
SET_EXPECT(global_notexists_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var notExists; notExists = 1;");
|
2009-08-10 12:57:42 +02:00
|
|
|
CHECK_CALLED(global_notexists_d);
|
|
|
|
|
2014-06-12 10:44:03 +02:00
|
|
|
SET_EXPECT(testobj_notexists_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"testObj.notExists;");
|
2014-06-12 10:44:03 +02:00
|
|
|
CHECK_CALLED(testobj_notexists_d);
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"function f() { var testPropGet; }");
|
|
|
|
run_script(L"(function () { var testPropGet; })();");
|
|
|
|
run_script(L"(function () { eval('var testPropGet;'); })();");
|
2009-08-10 12:57:42 +02:00
|
|
|
|
2010-10-19 23:14:35 +02:00
|
|
|
SET_EXPECT(invoke_func);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(propGetFunc() == 0, \"Incorrect propGetFunc value\");");
|
2010-10-19 23:14:35 +02:00
|
|
|
CHECK_CALLED(invoke_func);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(propGetFunc(1) == 1, \"Incorrect propGetFunc value\");");
|
|
|
|
run_script(L"ok(propGetFunc(1, 2) == 2, \"Incorrect propGetFunc value\");");
|
2010-10-19 23:14:35 +02:00
|
|
|
SET_EXPECT(invoke_func);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(propGetFunc().toString() == 0, \"Incorrect propGetFunc value\");");
|
2010-10-19 23:14:35 +02:00
|
|
|
CHECK_CALLED(invoke_func);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(propGetFunc(1).toString() == 1, \"Incorrect propGetFunc value\");");
|
2010-10-19 23:14:35 +02:00
|
|
|
SET_EXPECT(invoke_func);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"propGetFunc(1);");
|
2010-10-19 23:14:35 +02:00
|
|
|
CHECK_CALLED(invoke_func);
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"objectFlag(1).toString();");
|
2010-10-19 23:14:35 +02:00
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"(function() { var tmp = (function () { return testObj; })()(1);})();");
|
|
|
|
run_script(L"(function() { var tmp = (function () { return testObj; })()();})();");
|
2010-10-19 23:14:35 +02:00
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok((testObj instanceof Object) === false, 'testObj is instance of Object');");
|
2009-08-29 00:01:25 +02:00
|
|
|
|
2009-09-06 19:10:06 +02:00
|
|
|
SET_EXPECT(testobj_prop_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(('prop' in testObj) === true, 'prop is not in testObj');");
|
2009-09-06 19:10:06 +02:00
|
|
|
CHECK_CALLED(testobj_prop_d);
|
|
|
|
|
|
|
|
SET_EXPECT(testobj_noprop_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(('noprop' in testObj) === false, 'noprop is in testObj');");
|
2009-09-06 19:10:06 +02:00
|
|
|
CHECK_CALLED(testobj_noprop_d);
|
|
|
|
|
2011-09-02 12:24:12 +02:00
|
|
|
SET_EXPECT(testobj_prop_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(Object.prototype.hasOwnProperty.call(testObj, 'prop') === true, 'hasOwnProperty(\\\"prop\\\") returned false');");
|
2011-09-02 12:24:12 +02:00
|
|
|
CHECK_CALLED(testobj_prop_d);
|
|
|
|
|
|
|
|
SET_EXPECT(testobj_noprop_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(Object.prototype.hasOwnProperty.call(testObj, 'noprop') === false, 'hasOwnProperty(\\\"noprop\\\") returned true');");
|
2011-09-02 12:24:12 +02:00
|
|
|
CHECK_CALLED(testobj_noprop_d);
|
|
|
|
|
|
|
|
SET_EXPECT(puredisp_prop_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(Object.prototype.hasOwnProperty.call(pureDisp, 'prop') === true, 'hasOwnProperty(\\\"noprop\\\") returned false');");
|
2011-09-02 12:24:12 +02:00
|
|
|
CHECK_CALLED(puredisp_prop_d);
|
|
|
|
|
|
|
|
SET_EXPECT(puredisp_noprop_d);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(Object.prototype.hasOwnProperty.call(pureDisp, 'noprop') === false, 'hasOwnProperty(\\\"noprop\\\") returned true');");
|
2011-09-02 12:24:12 +02:00
|
|
|
CHECK_CALLED(puredisp_noprop_d);
|
|
|
|
|
2009-09-02 12:25:21 +02:00
|
|
|
SET_EXPECT(testobj_value);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(String(testObj) === '1', 'wrong testObj value');");
|
2009-09-02 12:25:21 +02:00
|
|
|
CHECK_CALLED(testobj_value);
|
|
|
|
|
2009-09-23 16:19:29 +02:00
|
|
|
SET_EXPECT(testobj_value);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(String.prototype.concat.call(testObj, ' OK') === '1 OK', 'wrong concat result');");
|
2009-09-23 16:19:29 +02:00
|
|
|
CHECK_CALLED(testobj_value);
|
|
|
|
|
2014-09-16 20:42:33 +02:00
|
|
|
SET_EXPECT(testobj_construct);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t = new testObj(1);");
|
2014-09-16 20:42:33 +02:00
|
|
|
CHECK_CALLED(testobj_construct);
|
|
|
|
|
2009-09-27 20:59:28 +02:00
|
|
|
SET_EXPECT(global_propget_d);
|
|
|
|
SET_EXPECT(global_propget_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"this.testPropGet;");
|
2009-09-27 20:59:28 +02:00
|
|
|
CHECK_CALLED(global_propget_d);
|
|
|
|
CHECK_CALLED(global_propget_i);
|
|
|
|
|
2014-11-28 16:18:32 +01:00
|
|
|
SET_EXPECT(global_propputref_d);
|
|
|
|
SET_EXPECT(global_propputref_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"testPropPutRef = nullDisp;");
|
2014-11-28 16:18:32 +01:00
|
|
|
CHECK_CALLED(global_propputref_d);
|
|
|
|
CHECK_CALLED(global_propputref_i);
|
|
|
|
|
2009-09-27 20:59:28 +02:00
|
|
|
SET_EXPECT(global_propget_d);
|
|
|
|
SET_EXPECT(global_propget_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"(function () { this.testPropGet; })();");
|
2009-09-27 20:59:28 +02:00
|
|
|
CHECK_CALLED(global_propget_d);
|
|
|
|
CHECK_CALLED(global_propget_i);
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"testThis(this);");
|
|
|
|
run_script(L"(function () { testThis(this); })();");
|
|
|
|
run_script(L"function x() { testThis(this); }; x();");
|
|
|
|
run_script(L"var t = {func: function () { ok(this === t, 'this !== t'); }}; with(t) { func(); }");
|
|
|
|
run_script(L"function x() { testThis(this); }; with({y: 1}) { x(); }");
|
|
|
|
run_script(L"(function () { function x() { testThis(this);} x(); })();");
|
2009-09-27 20:59:28 +02:00
|
|
|
|
2010-12-29 16:02:25 +01:00
|
|
|
SET_EXPECT(testobj_onlydispid_d);
|
|
|
|
SET_EXPECT(testobj_onlydispid_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"ok(typeof(testObj.onlyDispID) === 'unknown', 'unexpected typeof(testObj.onlyDispID)');");
|
2010-12-29 16:02:25 +01:00
|
|
|
CHECK_CALLED(testobj_onlydispid_d);
|
|
|
|
CHECK_CALLED(testobj_onlydispid_i);
|
|
|
|
|
2012-04-17 16:26:16 +02:00
|
|
|
SET_EXPECT(global_propargput_d);
|
|
|
|
SET_EXPECT(global_propargput_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t=0; propArgPutG(t++, t++) = t++;");
|
2012-04-17 16:26:16 +02:00
|
|
|
CHECK_CALLED(global_propargput_d);
|
|
|
|
CHECK_CALLED(global_propargput_i);
|
|
|
|
|
|
|
|
SET_EXPECT(global_propargput_d);
|
|
|
|
SET_EXPECT(global_propargput_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t=0; test.propArgPutO(t++, t++) = t++;");
|
2012-04-17 16:26:16 +02:00
|
|
|
CHECK_CALLED(global_propargput_d);
|
|
|
|
CHECK_CALLED(global_propargput_i);
|
|
|
|
|
2019-08-08 15:26:37 +02:00
|
|
|
SET_EXPECT(global_propargputop_d);
|
|
|
|
SET_EXPECT(global_propargputop_get_i);
|
|
|
|
SET_EXPECT(global_propargputop_put_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t=0; propArgPutOp(t++, t++) += t++;");
|
2019-08-08 15:26:37 +02:00
|
|
|
CHECK_CALLED(global_propargputop_d);
|
|
|
|
CHECK_CALLED(global_propargputop_get_i);
|
|
|
|
CHECK_CALLED(global_propargputop_put_i);
|
|
|
|
|
|
|
|
SET_EXPECT(global_propargputop_d);
|
|
|
|
SET_EXPECT(global_propargputop_get_i);
|
|
|
|
SET_EXPECT(global_propargputop_put_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t=0; propArgPutOp(t++, t++) ^= 14;");
|
2019-08-08 15:26:37 +02:00
|
|
|
CHECK_CALLED(global_propargputop_d);
|
|
|
|
CHECK_CALLED(global_propargputop_get_i);
|
|
|
|
CHECK_CALLED(global_propargputop_put_i);
|
|
|
|
|
2012-05-01 15:05:21 +02:00
|
|
|
SET_EXPECT(global_testargtypes_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp,"
|
|
|
|
L"function(i1,ui1,ui2,r4,i4ref,ui4,nullunk,d,i,s) {"
|
|
|
|
L" ok(getVT(i) === 'VT_I4', 'getVT(i) = ' + getVT(i));"
|
|
|
|
L" ok(getVT(s) === 'VT_I4', 'getVT(s) = ' + getVT(s));"
|
|
|
|
L" ok(getVT(d) === 'VT_DISPATCH', 'getVT(d) = ' + getVT(d));"
|
|
|
|
L" ok(getVT(nullunk) === 'VT_DISPATCH', 'getVT(nullunk) = ' + getVT(nullunk));"
|
|
|
|
L" ok(nullunk === null, 'nullunk !== null');"
|
|
|
|
L" ok(getVT(ui4) === 'VT_R8', 'getVT(ui4) = ' + getVT(ui4));"
|
|
|
|
L" ok(ui4 > 0, 'ui4 = ' + ui4);"
|
|
|
|
L" ok(getVT(i4ref) === 'VT_I4', 'getVT(i4ref) = ' + getVT(i4ref));"
|
|
|
|
L" ok(i4ref === 2, 'i4ref = ' + i4ref);"
|
|
|
|
L" ok(r4 === 0.5, 'r4 = ' + r4);"
|
|
|
|
L" ok(getVT(r4) === 'VT_R8', 'getVT(r4) = ' + getVT(r4));"
|
|
|
|
L" ok(getVT(ui2) === 'VT_I4', 'getVT(ui2) = ' + getVT(ui2));"
|
|
|
|
L" ok(getVT(ui1) === 'VT_I4', 'getVT(ui1) = ' + getVT(ui1));"
|
|
|
|
L" ok(ui1 === 4, 'ui1 = ' + ui1);"
|
|
|
|
L" ok(getVT(i1) === 'VT_I4', 'getVT(i1) = ' + getVT(i1));"
|
|
|
|
L" ok(i1 === 5, 'i1 = ' + i1);"
|
|
|
|
L"});");
|
2012-05-01 15:05:21 +02:00
|
|
|
CHECK_CALLED(global_testargtypes_i);
|
|
|
|
|
2012-09-13 14:34:25 +02:00
|
|
|
SET_EXPECT(testobj_withprop_d);
|
|
|
|
SET_EXPECT(testobj_withprop_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"var t = (function () { with(testObj) { return withProp; }})(); ok(t === 1, 't = ' + t);");
|
2012-09-13 14:34:25 +02:00
|
|
|
CHECK_CALLED(testobj_withprop_d);
|
|
|
|
CHECK_CALLED(testobj_withprop_i);
|
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"@set @t=2\nok(@t === 2, '@t = ' + @t);");
|
2014-10-01 10:45:30 +02:00
|
|
|
|
2014-10-01 10:45:37 +02:00
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"@if(true)\nif(@_jscript) reportSuccess();\n@end");
|
2014-10-01 10:45:37 +02:00
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
2019-05-17 16:39:32 +02:00
|
|
|
EnumVARIANT_index = 0;
|
|
|
|
EnumVARIANT_next_0_count = 1;
|
|
|
|
SET_EXPECT(testobj_newenum);
|
|
|
|
SET_EXPECT(enumvariant_next_0);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"new Enumerator(testObj);");
|
2019-05-17 16:39:32 +02:00
|
|
|
CHECK_CALLED(testobj_newenum);
|
|
|
|
CHECK_CALLED(enumvariant_next_0);
|
|
|
|
|
|
|
|
EnumVARIANT_index = 0;
|
|
|
|
EnumVARIANT_next_0_count = 2;
|
|
|
|
SET_EXPECT(testobj_newenum);
|
|
|
|
SET_EXPECT(enumvariant_next_0);
|
|
|
|
SET_EXPECT(enumvariant_reset);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"(function () {"
|
|
|
|
L" var testEnumObj = new Enumerator(testObj);"
|
|
|
|
L" var tmp = testEnumObj.moveFirst();"
|
|
|
|
L" ok(tmp == undefined, \"testEnumObj.moveFirst() = \" + tmp);"
|
|
|
|
L"})()");
|
2019-05-17 16:39:32 +02:00
|
|
|
CHECK_CALLED(testobj_newenum);
|
|
|
|
CHECK_CALLED(enumvariant_next_0);
|
|
|
|
CHECK_CALLED(enumvariant_reset);
|
|
|
|
|
|
|
|
EnumVARIANT_index = 0;
|
|
|
|
EnumVARIANT_next_0_count = 1;
|
|
|
|
SET_EXPECT(testobj_newenum);
|
|
|
|
SET_EXPECT(enumvariant_next_0);
|
|
|
|
SET_EXPECT(enumvariant_next_1);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"(function () {"
|
|
|
|
L" var testEnumObj = new Enumerator(testObj);"
|
|
|
|
L" while (!testEnumObj.atEnd())"
|
|
|
|
L" {"
|
|
|
|
L" ok(testEnumObj.item() == 123, "
|
|
|
|
L" \"testEnumObj.item() = \"+testEnumObj.item());"
|
|
|
|
L" testEnumObj.moveNext();"
|
|
|
|
L" }"
|
|
|
|
L"})()");
|
2019-05-17 16:39:32 +02:00
|
|
|
CHECK_CALLED(testobj_newenum);
|
|
|
|
CHECK_CALLED(enumvariant_next_0);
|
|
|
|
CHECK_CALLED(enumvariant_next_1);
|
|
|
|
|
2008-09-09 01:25:23 +02:00
|
|
|
run_from_res("lang.js");
|
2008-09-15 20:37:10 +02:00
|
|
|
run_from_res("api.js");
|
2008-09-15 20:41:23 +02:00
|
|
|
run_from_res("regexp.js");
|
2010-12-28 15:40:39 +01:00
|
|
|
run_from_res("cc.js");
|
2008-12-15 22:24:33 +01:00
|
|
|
|
|
|
|
test_isvisible(FALSE);
|
|
|
|
test_isvisible(TRUE);
|
2015-01-13 21:46:02 +01:00
|
|
|
test_start();
|
2015-06-02 14:45:20 +02:00
|
|
|
test_automagic();
|
2009-04-09 23:34:56 +02:00
|
|
|
|
2020-01-14 15:50:13 +01:00
|
|
|
hres = parse_script(0, L"test.testThis2(this);");
|
|
|
|
ok(hres == S_OK, "unexpected result %08x\n", hres);
|
|
|
|
hres = parse_script(0, L"(function () { test.testThis2(this); })();");
|
|
|
|
ok(hres == S_OK, "unexpected result %08x\n", hres);
|
2009-09-27 20:59:28 +02:00
|
|
|
|
2020-01-14 15:50:08 +01:00
|
|
|
hres = parse_htmlscript(L"<!--");
|
2009-04-09 23:34:56 +02:00
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
2020-01-14 15:50:08 +01:00
|
|
|
hres = parse_htmlscript(L"-->");
|
2009-04-09 23:34:56 +02:00
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
2020-01-14 15:50:08 +01:00
|
|
|
hres = parse_htmlscript(L"<!--\nvar a=1;\n-->\n");
|
2009-04-09 23:34:56 +02:00
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
2020-01-14 15:50:08 +01:00
|
|
|
hres = parse_htmlscript(L"<!--\n<!-- ignore this\n-->\n");
|
2009-04-09 23:34:56 +02:00
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
2020-01-14 15:50:08 +01:00
|
|
|
hres = parse_htmlscript(L"var a=1;\nif(a-->0) a=5;\n");
|
2009-04-09 23:34:56 +02:00
|
|
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
2020-01-14 15:50:08 +01:00
|
|
|
hres = parse_htmlscript(L"var a=1;\nif(a\n-->0) a=5;\n");
|
2009-04-09 23:34:56 +02:00
|
|
|
ok(hres != S_OK, "ParseScriptText have not failed\n");
|
2010-10-09 16:43:48 +02:00
|
|
|
|
2012-12-12 13:12:39 +01:00
|
|
|
test_script_exprs();
|
2015-01-13 21:45:56 +01:00
|
|
|
test_invokeex();
|
2019-05-20 21:05:25 +02:00
|
|
|
test_eval();
|
2020-01-24 20:41:40 +01:00
|
|
|
test_error_reports();
|
2012-03-26 11:43:23 +02:00
|
|
|
|
2014-10-02 08:09:10 +02:00
|
|
|
run_bom_tests();
|
|
|
|
|
2012-03-26 11:43:23 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-10-04 14:57:46 +02:00
|
|
|
static void test_parse_proc(void)
|
|
|
|
{
|
|
|
|
VARIANT args[2];
|
|
|
|
DISPPARAMS dp = {args};
|
|
|
|
|
|
|
|
dp.cArgs = 0;
|
2020-01-14 15:50:23 +01:00
|
|
|
invoke_procedure(NULL, L"return true;", &dp);
|
2012-10-04 14:57:46 +02:00
|
|
|
|
|
|
|
dp.cArgs = 1;
|
|
|
|
V_VT(args) = VT_EMPTY;
|
2020-01-14 15:50:23 +01:00
|
|
|
invoke_procedure(NULL, L"return arguments.length == 1;", &dp);
|
2012-10-04 14:58:05 +02:00
|
|
|
|
|
|
|
V_VT(args) = VT_BOOL;
|
|
|
|
V_BOOL(args) = VARIANT_TRUE;
|
2020-01-14 15:50:23 +01:00
|
|
|
invoke_procedure(L" x ", L"return x;", &dp);
|
2012-10-04 14:58:05 +02:00
|
|
|
|
|
|
|
dp.cArgs = 2;
|
|
|
|
V_VT(args) = VT_I4;
|
|
|
|
V_I4(args) = 2;
|
|
|
|
V_VT(args+1) = VT_I4;
|
|
|
|
V_I4(args+1) = 1;
|
2020-01-14 15:50:23 +01:00
|
|
|
invoke_procedure(L" _x1 , y_2", L"return _x1 === 1 && y_2 === 2;", &dp);
|
2012-10-04 14:57:46 +02:00
|
|
|
}
|
|
|
|
|
2012-03-26 11:43:23 +02:00
|
|
|
static void run_encoded_tests(void)
|
|
|
|
{
|
|
|
|
BSTR src;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
engine_clsid = &CLSID_JScriptEncode;
|
|
|
|
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
|
|
|
/* |reportSuccess(); | */
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"#@~^EAAAAA==.\x7fwGMYUEm1+kd`*iAQYAAA==^#~@");
|
2012-03-26 11:43:23 +02:00
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"reportSuccess();");
|
2012-03-26 11:43:23 +02:00
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
|
|
|
/* |Success | */
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"report#@~^BwAAAA==j!m^\x7f/k2QIAAA==^#~@();");
|
2012-03-26 11:43:23 +02:00
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
|
|
|
SET_EXPECT(global_success_d);
|
|
|
|
SET_EXPECT(global_success_i);
|
|
|
|
/* |\r\n\treportSuccess();\r\n | */
|
2020-01-14 15:50:13 +01:00
|
|
|
run_script(L"#@~^GQAAAA==@#@&d.\x7fwKDYUE1^+k/c#p@#@&OAYAAA==^#~@");
|
2012-03-26 11:43:23 +02:00
|
|
|
CHECK_CALLED(global_success_d);
|
|
|
|
CHECK_CALLED(global_success_i);
|
|
|
|
|
|
|
|
/* v */
|
2020-01-14 15:50:23 +01:00
|
|
|
src = SysAllocString(L"#@~^EAA*AA==.\x7fwGMYUEm1+kd`*iAQYAAA==^#~@");
|
2012-03-26 11:43:23 +02:00
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, src);
|
|
|
|
SysFreeString(src);
|
|
|
|
ok(hres == JS_E_INVALID_CHAR, "parse_script failed %08x\n", hres);
|
|
|
|
|
|
|
|
/* vv */
|
2020-01-14 15:50:23 +01:00
|
|
|
src = SysAllocString(L"#@~^EAAAAAAA==.\x7fwGMYUEm1+kd`*iAQYAAA==^#~@");
|
2012-03-26 11:43:23 +02:00
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, src);
|
|
|
|
SysFreeString(src);
|
|
|
|
ok(hres == JS_E_INVALID_CHAR, "parse_script failed %08x\n", hres);
|
|
|
|
|
|
|
|
/* v */
|
2020-01-14 15:50:23 +01:00
|
|
|
src = SysAllocString(L"#@~^EAAAAA^=.\x7fwGMYUEm1+kd`*iAQYAAA==^#~@");
|
2012-03-26 11:43:23 +02:00
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, src);
|
|
|
|
SysFreeString(src);
|
|
|
|
ok(hres == JS_E_INVALID_CHAR, "parse_script failed %08x\n", hres);
|
|
|
|
|
|
|
|
/* v */
|
2020-01-14 15:50:23 +01:00
|
|
|
src = SysAllocString(L"#@~^EAAAAA==.\x7fwGMYUEm1ekd`*iAQYAAA==^#~@");
|
2012-03-26 11:43:23 +02:00
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, src);
|
|
|
|
SysFreeString(src);
|
|
|
|
ok(hres == JS_E_INVALID_CHAR, "parse_script failed %08x\n", hres);
|
|
|
|
|
|
|
|
/* vv */
|
2020-01-14 15:50:23 +01:00
|
|
|
src = SysAllocString(L"#@~^EAAAAA==.\x7fwGMYUEm1+kd`*iAQYAAA==^~#@");
|
2012-03-26 11:43:23 +02:00
|
|
|
hres = parse_script(SCRIPTITEM_GLOBALMEMBERS, src);
|
|
|
|
SysFreeString(src);
|
|
|
|
ok(hres == JS_E_INVALID_CHAR, "parse_script failed %08x\n", hres);
|
2008-09-05 02:38:44 +02:00
|
|
|
}
|
|
|
|
|
2013-04-23 15:03:35 +02:00
|
|
|
static void run_benchmark(const char *script_name)
|
|
|
|
{
|
|
|
|
IActiveScriptParse *parser;
|
|
|
|
IActiveScript *engine;
|
|
|
|
ULONG start, end;
|
|
|
|
BSTR src;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
engine = create_script();
|
|
|
|
if(!engine)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
|
|
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
|
|
|
if (FAILED(hres)) {
|
|
|
|
IActiveScript_Release(engine);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IActiveScriptParse_InitNew(parser);
|
|
|
|
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
|
|
|
|
ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
|
|
|
|
|
2020-01-14 15:50:36 +01:00
|
|
|
hres = IActiveScript_AddNamedItem(engine, L"test",
|
2013-04-23 15:03:35 +02:00
|
|
|
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE);
|
|
|
|
ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
|
|
|
|
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
|
|
|
|
|
|
|
|
src = load_res(script_name);
|
|
|
|
|
|
|
|
start = GetTickCount();
|
|
|
|
hres = IActiveScriptParse_ParseScriptText(parser, src, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
|
|
|
end = GetTickCount();
|
|
|
|
ok(hres == S_OK, "%s: ParseScriptText failed: %08x\n", script_name, hres);
|
|
|
|
|
|
|
|
trace("%s ran in %u ms\n", script_name, end-start);
|
|
|
|
|
|
|
|
IActiveScript_Release(engine);
|
|
|
|
IActiveScriptParse_Release(parser);
|
|
|
|
SysFreeString(src);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void run_benchmarks(void)
|
|
|
|
{
|
|
|
|
trace("Running benchmarks...\n");
|
|
|
|
|
|
|
|
run_benchmark("dna.js");
|
|
|
|
run_benchmark("base64.js");
|
|
|
|
run_benchmark("validateinput.js");
|
|
|
|
}
|
|
|
|
|
2010-01-23 23:58:23 +01:00
|
|
|
static BOOL check_jscript(void)
|
|
|
|
{
|
2010-09-21 15:58:48 +02:00
|
|
|
IActiveScriptProperty *script_prop;
|
2010-01-23 23:58:23 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
2010-09-21 15:58:48 +02:00
|
|
|
hres = CoCreateInstance(&CLSID_JScript, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
|
|
|
&IID_IActiveScriptProperty, (void**)&script_prop);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return FALSE;
|
|
|
|
IActiveScriptProperty_Release(script_prop);
|
|
|
|
|
2020-01-14 15:50:23 +01:00
|
|
|
return parse_script(0, L"if(!('localeCompare' in String.prototype)) throw 1;") == S_OK;
|
2010-01-23 23:58:23 +01:00
|
|
|
}
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
START_TEST(run)
|
|
|
|
{
|
2008-10-02 16:24:02 +02:00
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
|
|
|
|
argc = winetest_get_mainargs(&argv);
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
CoInitialize(NULL);
|
|
|
|
|
2010-01-23 23:58:23 +01:00
|
|
|
if(!check_jscript()) {
|
|
|
|
win_skip("Broken engine, probably too old\n");
|
|
|
|
}else if(argc > 2) {
|
2012-01-12 13:43:38 +01:00
|
|
|
invoke_version = 2;
|
2008-10-02 16:24:02 +02:00
|
|
|
run_from_file(argv[2]);
|
2009-10-19 20:41:32 +02:00
|
|
|
}else {
|
|
|
|
trace("invoke version 0\n");
|
|
|
|
invoke_version = 0;
|
2008-10-02 16:24:02 +02:00
|
|
|
run_tests();
|
2008-09-05 02:38:44 +02:00
|
|
|
|
2009-10-19 20:41:32 +02:00
|
|
|
trace("invoke version 2\n");
|
|
|
|
invoke_version = 2;
|
2012-03-26 11:43:23 +02:00
|
|
|
if(run_tests()) {
|
|
|
|
trace("JSctipt.Encode tests...\n");
|
|
|
|
run_encoded_tests();
|
2012-10-04 14:57:46 +02:00
|
|
|
trace("ParseProcedureText tests...\n");
|
|
|
|
test_parse_proc();
|
2012-03-26 11:43:23 +02:00
|
|
|
}
|
2013-04-23 15:03:35 +02:00
|
|
|
|
|
|
|
if(winetest_interactive)
|
|
|
|
run_benchmarks();
|
2009-10-19 20:41:32 +02:00
|
|
|
}
|
|
|
|
|
2008-09-05 02:38:44 +02:00
|
|
|
CoUninitialize();
|
|
|
|
}
|