Commit 561437ad authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

jscript: Fixed var handling.

parent 6afd5354
......@@ -407,8 +407,15 @@ HRESULT exec_source(exec_ctx_t *ctx, parser_ctx_t *parser, source_elements_t *so
for(var = source->variables; var; var = var->next) {
DISPID id = 0;
BSTR name;
hres = jsdisp_get_id(ctx->var_disp, var->identifier, fdexNameEnsure, &id);
name = SysAllocString(var->identifier);
if(!name)
return E_OUTOFMEMORY;
if(!lookup_global_members(parser->script, name, NULL))
hres = jsdisp_get_id(ctx->var_disp, var->identifier, fdexNameEnsure, &id);
SysFreeString(name);
if(FAILED(hres))
return hres;
}
......
......@@ -63,6 +63,7 @@ DEFINE_EXPECT(global_propput_d);
DEFINE_EXPECT(global_propput_i);
DEFINE_EXPECT(global_success_d);
DEFINE_EXPECT(global_success_i);
DEFINE_EXPECT(global_notexists_d);
DEFINE_EXPECT(testobj_delete);
DEFINE_EXPECT(GetItemInfo_testVal);
......@@ -288,6 +289,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
*pid = DISPID_GLOBAL_NULL_BSTR;
return S_OK;
}
if(!strcmp_wa(bstrName, "notExists")) {
CHECK_EXPECT(global_notexists_d);
ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
return DISP_E_UNKNOWNNAME;
}
if(strict_dispid_check)
ok(0, "unexpected call %s\n", debugstr_w(bstrName));
......@@ -837,6 +843,16 @@ static void run_tests(void)
parse_script_a("function reportSuccess() {}; reportSuccess();");
SET_EXPECT(global_propget_d);
parse_script_a("var testPropGet");
CHECK_CALLED(global_propget_d);
SET_EXPECT(global_notexists_d);
parse_script_a("var notExists; notExists = 1;");
CHECK_CALLED(global_notexists_d);
parse_script_a("function f() { var testPropGet; }");
run_from_res("lang.js");
run_from_res("api.js");
run_from_res("regexp.js");
......
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