Commit 0b4688e1 authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

msscript: Implement IScriptControl_[get|put]_UseSafeSubset.

parent f98d0764
......@@ -90,6 +90,7 @@ struct ScriptControl {
SIZEL extent;
LONG timeout;
VARIANT_BOOL allow_ui;
VARIANT_BOOL use_safe_subset;
/* connection points */
ConnectionPoint *cp_list;
......@@ -838,15 +839,22 @@ static HRESULT WINAPI ScriptControl_put_AllowUI(IScriptControl *iface, VARIANT_B
static HRESULT WINAPI ScriptControl_get_UseSafeSubset(IScriptControl *iface, VARIANT_BOOL *p)
{
ScriptControl *This = impl_from_IScriptControl(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
if(!p)
return E_POINTER;
*p = This->use_safe_subset;
return S_OK;
}
static HRESULT WINAPI ScriptControl_put_UseSafeSubset(IScriptControl *iface, VARIANT_BOOL v)
static HRESULT WINAPI ScriptControl_put_UseSafeSubset(IScriptControl *iface, VARIANT_BOOL use_safe_subset)
{
ScriptControl *This = impl_from_IScriptControl(iface);
FIXME("(%p)->(%x)\n", This, v);
return E_NOTIMPL;
TRACE("(%p)->(%x)\n", This, use_safe_subset);
This->use_safe_subset = use_safe_subset;
return S_OK;
}
static HRESULT WINAPI ScriptControl_get_Modules(IScriptControl *iface, IScriptModuleCollection **p)
......@@ -1891,6 +1899,7 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow
script_control->view_sink_flags = 0;
script_control->view_sink = NULL;
script_control->allow_ui = VARIANT_TRUE;
script_control->use_safe_subset = VARIANT_FALSE;
ConnectionPoint_Init(&script_control->cp_scsource, script_control, &DIID_DScriptControlSource);
ConnectionPoint_Init(&script_control->cp_propnotif, script_control, &IID_IPropertyNotifySink);
......
......@@ -1254,6 +1254,43 @@ static void test_AllowUI(void)
IScriptControl_Release(sc);
}
static void test_UseSafeSubset(void)
{
IScriptControl *sc;
VARIANT_BOOL use_safe_subset;
HRESULT hr;
BSTR str;
hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IScriptControl, (void**)&sc);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IScriptControl_get_UseSafeSubset(sc, NULL);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
hr = IScriptControl_get_UseSafeSubset(sc, &use_safe_subset);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(use_safe_subset == VARIANT_FALSE, "got %d\n", use_safe_subset);
hr = IScriptControl_put_UseSafeSubset(sc, VARIANT_TRUE);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IScriptControl_get_UseSafeSubset(sc, &use_safe_subset);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(use_safe_subset == VARIANT_TRUE, "got %d\n", use_safe_subset);
str = SysAllocString(vbW);
hr = IScriptControl_put_Language(sc, str);
ok(hr == S_OK, "got 0x%08x\n", hr);
SysFreeString(str);
hr = IScriptControl_get_UseSafeSubset(sc, &use_safe_subset);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(use_safe_subset == VARIANT_TRUE, "got %d\n", use_safe_subset);
IScriptControl_Release(sc);
}
START_TEST(msscript)
{
IUnknown *unk;
......@@ -1281,6 +1318,7 @@ START_TEST(msscript)
test_Reset();
test_AddObject();
test_AllowUI();
test_UseSafeSubset();
CoUninitialize();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment