mshtml: Fixed script tests on IE8.

This commit is contained in:
Jacek Caban 2009-08-31 02:15:09 +02:00 committed by Alexandre Julliard
parent 13b6a43d73
commit ccc5a575d2
2 changed files with 67 additions and 23 deletions

View File

@ -67,12 +67,30 @@ typedef struct {
#define ACTSCPWIN(x) (&(x)->lpIActiveScriptSiteWindowVtbl)
#define ACTSCPDBG32(x) (&(x)->lpIActiveScriptSiteDebug32Vtbl)
static void set_script_prop(ScriptHost *script_host, DWORD property, VARIANT *val)
{
IActiveScriptProperty *script_prop;
HRESULT hres;
hres = IActiveScript_QueryInterface(script_host->script, &IID_IActiveScriptProperty,
(void**)&script_prop);
if(FAILED(hres)) {
WARN("Could not get IActiveScriptProperty iface: %08x\n", hres);
return;
}
hres = IActiveScriptProperty_SetProperty(script_prop, property, NULL, val);
IActiveScriptProperty_Release(script_prop);
if(FAILED(hres))
WARN("SetProperty(%x) failed: %08x\n", property, hres);
}
static BOOL init_script_engine(ScriptHost *script_host)
{
IActiveScriptProperty *property;
IObjectSafety *safety;
SCRIPTSTATE state;
DWORD supported_opts=0, enabled_opts=0;
VARIANT var;
HRESULT hres;
hres = IActiveScript_QueryInterface(script_host->script, &IID_IActiveScriptParse, (void**)&script_host->parse);
@ -104,20 +122,13 @@ static BOOL init_script_engine(ScriptHost *script_host)
if(FAILED(hres))
return FALSE;
hres = IActiveScript_QueryInterface(script_host->script, &IID_IActiveScriptProperty, (void**)&property);
if(SUCCEEDED(hres)) {
VARIANT var;
V_VT(&var) = VT_I4;
V_I4(&var) = 1;
set_script_prop(script_host, SCRIPTPROP_INVOKEVERSIONING, &var);
V_VT(&var) = VT_BOOL;
V_BOOL(&var) = VARIANT_TRUE;
hres = IActiveScriptProperty_SetProperty(property, SCRIPTPROP_HACK_TRIDENTEVENTSINK, NULL, &var);
if(FAILED(hres))
WARN("SetProperty failed: %08x\n", hres);
IActiveScriptProperty_Release(property);
}else {
WARN("Could not get IActiveScriptProperty: %08x\n", hres);
}
V_VT(&var) = VT_BOOL;
V_BOOL(&var) = VARIANT_TRUE;
set_script_prop(script_host, SCRIPTPROP_HACK_TRIDENTEVENTSINK, &var);
hres = IActiveScriptParse64_InitNew(script_host->parse);
if(FAILED(hres)) {
@ -146,8 +157,13 @@ static BOOL init_script_engine(ScriptHost *script_host)
hres = IActiveScript_AddNamedItem(script_host->script, windowW,
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
if(FAILED(hres))
if(SUCCEEDED(hres)) {
V_VT(&var) = VT_BOOL;
V_BOOL(&var) = VARIANT_TRUE;
set_script_prop(script_host, SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION, &var);
}else {
WARN("AddNamedItem failed: %08x\n", hres);
}
hres = IActiveScript_QueryInterface(script_host->script, &IID_IActiveScriptParseProcedure2,
(void**)&script_host->parse_proc);

View File

@ -74,6 +74,12 @@ DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define CHECK_CALLED_BROKEN(func) \
do { \
ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define CHECK_NOT_CALLED(func) \
do { \
ok(!called_ ## func, "unexpected " #func "\n"); \
@ -89,7 +95,9 @@ DEFINE_EXPECT(GetInterfaceSafetyOptions);
DEFINE_EXPECT(SetInterfaceSafetyOptions);
DEFINE_EXPECT(InitNew);
DEFINE_EXPECT(Close);
DEFINE_EXPECT(SetProperty);
DEFINE_EXPECT(SetProperty_HACK_TRIDENTEVENTSINK);
DEFINE_EXPECT(SetProperty_INVOKEVERSIONING);
DEFINE_EXPECT(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION);
DEFINE_EXPECT(SetScriptSite);
DEFINE_EXPECT(GetScriptState);
DEFINE_EXPECT(SetScriptState_STARTED);
@ -504,15 +512,31 @@ static HRESULT WINAPI ActiveScriptProperty_GetProperty(IActiveScriptProperty *if
static HRESULT WINAPI ActiveScriptProperty_SetProperty(IActiveScriptProperty *iface, DWORD dwProperty,
VARIANT *pvarIndex, VARIANT *pvarValue)
{
CHECK_EXPECT(SetProperty);
switch(dwProperty) {
case SCRIPTPROP_HACK_TRIDENTEVENTSINK:
CHECK_EXPECT(SetProperty_HACK_TRIDENTEVENTSINK);
ok(V_VT(pvarValue) == VT_BOOL, "V_VT(pvarValue)=%d\n", V_VT(pvarValue));
ok(V_BOOL(pvarValue) == VARIANT_TRUE, "V_BOOL(pvarValue)=%x\n", V_BOOL(pvarValue));
break;
case SCRIPTPROP_INVOKEVERSIONING:
CHECK_EXPECT(SetProperty_INVOKEVERSIONING);
ok(V_VT(pvarValue) == VT_I4, "V_VT(pvarValue)=%d\n", V_VT(pvarValue));
ok(V_I4(pvarValue) == 1, "V_I4(pvarValue)=%d\n", V_I4(pvarValue));
break;
case SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION:
CHECK_EXPECT(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION);
ok(V_VT(pvarValue) == VT_BOOL, "V_VT(pvarValue)=%d\n", V_VT(pvarValue));
ok(V_BOOL(pvarValue) == VARIANT_TRUE, "V_BOOL(pvarValue)=%x\n", V_BOOL(pvarValue));
break;
default:
ok(0, "unexpected property %x\n", dwProperty);
return E_NOTIMPL;
}
ok(dwProperty == SCRIPTPROP_HACK_TRIDENTEVENTSINK, "unexpected property %d\n", dwProperty);
ok(!pvarIndex, "pvarIndex != NULL\n");
ok(pvarValue != NULL, "pvarValue == NULL\n");
ok(V_VT(pvarValue) == VT_BOOL, "V_VT(pvarValue)=%d\n", V_VT(pvarValue));
ok(V_BOOL(pvarValue) == VARIANT_TRUE, "V_BOOL(pvarValue)=%x\n", V_BOOL(pvarValue));
return E_NOTIMPL;
return S_OK;
}
static const IActiveScriptPropertyVtbl ActiveScriptPropertyVtbl = {
@ -1028,12 +1052,14 @@ static void test_simple_script(void)
SET_EXPECT(CreateInstance);
SET_EXPECT(GetInterfaceSafetyOptions);
SET_EXPECT(SetInterfaceSafetyOptions);
SET_EXPECT(SetProperty);
SET_EXPECT(SetProperty_INVOKEVERSIONING); /* IE8 */
SET_EXPECT(SetProperty_HACK_TRIDENTEVENTSINK);
SET_EXPECT(InitNew);
SET_EXPECT(SetScriptSite);
SET_EXPECT(GetScriptState);
SET_EXPECT(SetScriptState_STARTED);
SET_EXPECT(AddNamedItem);
SET_EXPECT(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION); /* IE8 */
SET_EXPECT(ParseScriptText);
SET_EXPECT(SetScriptState_CONNECTED);
@ -1043,12 +1069,14 @@ static void test_simple_script(void)
CHECK_CALLED(CreateInstance);
CHECK_CALLED(GetInterfaceSafetyOptions);
CHECK_CALLED(SetInterfaceSafetyOptions);
CHECK_CALLED(SetProperty);
CHECK_CALLED_BROKEN(SetProperty_INVOKEVERSIONING); /* IE8 */
CHECK_CALLED(SetProperty_HACK_TRIDENTEVENTSINK);
CHECK_CALLED(InitNew);
CHECK_CALLED(SetScriptSite);
CHECK_CALLED(GetScriptState);
CHECK_CALLED(SetScriptState_STARTED);
CHECK_CALLED(AddNamedItem);
CHECK_CALLED_BROKEN(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION); /* IE8 */
CHECK_CALLED(ParseScriptText);
CHECK_CALLED(SetScriptState_CONNECTED);