msscript: Implement IScriptControl_[get|put]_UseSafeSubset.

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2018-03-15 21:28:40 +01:00 committed by Alexandre Julliard
parent f98d0764d5
commit 0b4688e198
2 changed files with 52 additions and 5 deletions

View File

@ -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);

View File

@ -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();
}