jscript: Added SetProperty(SCRIPTPROP_INVOKEVERSIONING) implementation.
This commit is contained in:
parent
b16634c2f9
commit
3b2d5ecdf5
|
@ -51,6 +51,7 @@ typedef struct {
|
|||
script_ctx_t *ctx;
|
||||
LONG thread_id;
|
||||
LCID lcid;
|
||||
DWORD version;
|
||||
|
||||
IActiveScriptSite *site;
|
||||
|
||||
|
@ -659,6 +660,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
|
|||
ctx->ref = 1;
|
||||
ctx->state = SCRIPTSTATE_UNINITIALIZED;
|
||||
ctx->safeopt = This->safeopt;
|
||||
ctx->version = This->version;
|
||||
jsheap_init(&ctx->tmp_heap);
|
||||
|
||||
ctx = InterlockedCompareExchangePointer((void**)&This->ctx, ctx, NULL);
|
||||
|
@ -822,8 +824,27 @@ static HRESULT WINAPI JScriptProperty_SetProperty(IActiveScriptProperty *iface,
|
|||
VARIANT *pvarIndex, VARIANT *pvarValue)
|
||||
{
|
||||
JScript *This = ACTSCPPROP_THIS(iface);
|
||||
FIXME("(%p)->(%x %p %p)\n", This, dwProperty, pvarIndex, pvarValue);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%x %s %s)\n", This, dwProperty, debugstr_variant(pvarIndex), debugstr_variant(pvarValue));
|
||||
|
||||
if(pvarIndex)
|
||||
FIXME("unsupported pvarIndex\n");
|
||||
|
||||
switch(dwProperty) {
|
||||
case SCRIPTPROP_INVOKEVERSIONING:
|
||||
if(V_VT(pvarValue) != VT_I4 || V_I4(pvarValue) < 0 || V_I4(pvarValue) > 15) {
|
||||
WARN("invalid value %s\n", debugstr_variant(pvarValue));
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
This->version = V_I4(pvarValue);
|
||||
break;
|
||||
default:
|
||||
FIXME("Unimplemented property %x\n", dwProperty);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#undef ACTSCPPROP_THIS
|
||||
|
|
|
@ -262,6 +262,7 @@ struct _script_ctx_t {
|
|||
IActiveScriptSite *site;
|
||||
IInternetHostSecurityManager *secmgr;
|
||||
DWORD safeopt;
|
||||
DWORD version;
|
||||
LCID lcid;
|
||||
|
||||
jsheap_t tmp_heap;
|
||||
|
|
|
@ -295,6 +295,49 @@ static void test_safety(IUnknown *unk)
|
|||
IObjectSafety_Release(safety);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static void test_invoke_versioning(IActiveScript *script)
|
||||
{
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
V_VT(&v) = VT_NULL;
|
||||
hres = set_script_prop(script, SCRIPTPROP_INVOKEVERSIONING, &v);
|
||||
if(hres == E_NOTIMPL) {
|
||||
win_skip("SCRIPTPROP_INVOKESTRING not supported\n");
|
||||
return;
|
||||
}
|
||||
ok(hres == E_INVALIDARG, "SetProperty(SCRIPTPROP_INVOKEVERSIONING) failed: %08x\n", hres);
|
||||
|
||||
V_VT(&v) = VT_I2;
|
||||
V_I2(&v) = 0;
|
||||
hres = set_script_prop(script, SCRIPTPROP_INVOKEVERSIONING, &v);
|
||||
ok(hres == E_INVALIDARG, "SetProperty(SCRIPTPROP_INVOKEVERSIONING) failed: %08x\n", hres);
|
||||
|
||||
V_VT(&v) = VT_I4;
|
||||
V_I4(&v) = 16;
|
||||
hres = set_script_prop(script, SCRIPTPROP_INVOKEVERSIONING, &v);
|
||||
ok(hres == E_INVALIDARG, "SetProperty(SCRIPTPROP_INVOKEVERSIONING) failed: %08x\n", hres);
|
||||
|
||||
V_VT(&v) = VT_I4;
|
||||
V_I4(&v) = 2;
|
||||
hres = set_script_prop(script, SCRIPTPROP_INVOKEVERSIONING, &v);
|
||||
ok(hres == S_OK, "SetProperty(SCRIPTPROP_INVOKEVERSIONING) failed: %08x\n", hres);
|
||||
}
|
||||
|
||||
static void test_jscript(void)
|
||||
{
|
||||
IActiveScriptParse *parse;
|
||||
|
@ -322,6 +365,7 @@ static void test_jscript(void)
|
|||
|
||||
test_state(script, SCRIPTSTATE_UNINITIALIZED);
|
||||
test_safety(unk);
|
||||
test_invoke_versioning(script);
|
||||
|
||||
hres = IActiveScriptParse64_InitNew(parse);
|
||||
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
|
||||
|
|
Loading…
Reference in New Issue