vbscript: Handle NULL code text in ParseScriptText and ParseProcedureText.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
85408ea191
commit
7c9139dffb
|
@ -1822,6 +1822,8 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
|
||||||
vbscode_t *code;
|
vbscode_t *code;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
if (!src) src = L"";
|
||||||
|
|
||||||
hres = parse_script(&ctx.parser, src, delimiter, flags);
|
hres = parse_script(&ctx.parser, src, delimiter, flags);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -1917,6 +1917,10 @@ static void test_parse_context(void)
|
||||||
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
||||||
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
||||||
|
|
||||||
|
/* NULL code text succeeds but does nothing */
|
||||||
|
hres = IActiveScriptParse_ParseScriptText(parser, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
||||||
|
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
||||||
|
|
||||||
/* unknown identifier context is not a valid argument */
|
/* unknown identifier context is not a valid argument */
|
||||||
str = a2bstr("Call reportSuccess()\n");
|
str = a2bstr("Call reportSuccess()\n");
|
||||||
hres = IActiveScriptParse_ParseScriptText(parser, str, yW, NULL, NULL, 0, 0, 0, NULL, NULL);
|
hres = IActiveScriptParse_ParseScriptText(parser, str, yW, NULL, NULL, 0, 0, 0, NULL, NULL);
|
||||||
|
@ -2003,6 +2007,7 @@ static void test_procedures(void)
|
||||||
DISPPARAMS dp = {NULL};
|
DISPPARAMS dp = {NULL};
|
||||||
IActiveScript *script;
|
IActiveScript *script;
|
||||||
IDispatchEx *proc;
|
IDispatchEx *proc;
|
||||||
|
IDispatch *disp;
|
||||||
EXCEPINFO ei = {0};
|
EXCEPINFO ei = {0};
|
||||||
VARIANT v;
|
VARIANT v;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -2012,6 +2017,10 @@ static void test_procedures(void)
|
||||||
hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc);
|
hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc);
|
||||||
ok(hres == S_OK, "Could not get IActiveScriptParseProcedure2 iface: %08x\n", hres);
|
ok(hres == S_OK, "Could not get IActiveScriptParseProcedure2 iface: %08x\n", hres);
|
||||||
|
|
||||||
|
hres = IActiveScriptParseProcedure2_ParseProcedureText(parse_proc, NULL, NULL, emptyW, NULL, NULL, NULL, 0, 0, 0, &disp);
|
||||||
|
ok(hres == S_OK, "ParseProcedureText failed: %08x\n", hres);
|
||||||
|
IDispatch_Release(disp);
|
||||||
|
|
||||||
proc = parse_procedure(parse_proc, "dim x\nif true then x=false", 0);
|
proc = parse_procedure(parse_proc, "dim x\nif true then x=false", 0);
|
||||||
|
|
||||||
V_VT(&v) = VT_EMPTY;
|
V_VT(&v) = VT_EMPTY;
|
||||||
|
|
Loading…
Reference in New Issue