From ff0cea33d04e2282dc47a32c225b5a9071c3cb44 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 1 Sep 2011 17:47:41 +0200 Subject: [PATCH] jscript: Added more SetInterfaceSafetyOptions tests and fixes. --- dlls/jscript/jscript.c | 2 +- dlls/jscript/tests/jscript.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index fb7fd8c7a7..be225b74df 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -943,7 +943,7 @@ static HRESULT WINAPI JScriptSafety_SetInterfaceSafetyOptions(IObjectSafety *ifa if(dwOptionSetMask & ~SUPPORTED_OPTIONS) return E_FAIL; - This->safeopt = dwEnabledOptions & dwEnabledOptions; + This->safeopt = (dwEnabledOptions & dwOptionSetMask) | (This->safeopt & ~dwOptionSetMask) | INTERFACE_USES_DISPEX; return S_OK; } diff --git a/dlls/jscript/tests/jscript.c b/dlls/jscript/tests/jscript.c index 67067b97d4..eda867d451 100644 --- a/dlls/jscript/tests/jscript.c +++ b/dlls/jscript/tests/jscript.c @@ -329,6 +329,38 @@ static void test_safety(IUnknown *unk) ok(enabled == (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER), "enabled=%x\n", enabled); + hres = IObjectSafety_SetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, INTERFACESAFE_FOR_UNTRUSTED_DATA, 0); + ok(hres == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hres); + + supported = enabled = 0xdeadbeef; + hres = IObjectSafety_GetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, &supported, &enabled); + ok(hres == S_OK, "GetInterfaceSafetyOptions failed: %08x\n", hres); + ok(supported == (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER), + "supported=%x\n", supported); + ok(enabled == (INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER), "enabled=%x\n", enabled); + + hres = IObjectSafety_SetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, + INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER, 0); + ok(hres == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hres); + + supported = enabled = 0xdeadbeef; + hres = IObjectSafety_GetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, &supported, &enabled); + ok(hres == S_OK, "GetInterfaceSafetyOptions failed: %08x\n", hres); + ok(supported == (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER), + "supported=%x\n", supported); + ok(enabled == INTERFACE_USES_DISPEX, "enabled=%x\n", enabled); + + hres = IObjectSafety_SetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, + INTERFACE_USES_DISPEX, 0); + ok(hres == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hres); + + supported = enabled = 0xdeadbeef; + hres = IObjectSafety_GetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, &supported, &enabled); + ok(hres == S_OK, "GetInterfaceSafetyOptions failed: %08x\n", hres); + ok(supported == (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER), + "supported=%x\n", supported); + ok(enabled == INTERFACE_USES_DISPEX, "enabled=%x\n", enabled); + IObjectSafety_Release(safety); }