Commit 324b82d9 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Return JS_E_INVALID_PROPERTY in jsdisp_call_name if property is not found.

parent f324021e
......@@ -2007,6 +2007,9 @@ HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned
if(FAILED(hres))
return hres;
if(!prop || prop->type == PROP_DELETED)
return JS_E_INVALID_PROPERTY;
return invoke_prop_func(disp, to_disp(disp), prop, flags, argc, argv, r, NULL);
}
......
......@@ -2946,6 +2946,28 @@ static void test_script_exprs(void)
CHECK_CALLED(global_success_d);
CHECK_CALLED(global_success_i);
hres = parse_script_expr(L"var o=new Object(); Object.prototype.toLocaleString.call(o)", &v, NULL);
ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres);
ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
ok(!lstrcmpW(V_BSTR(&v), L"[object Object]"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
hres = parse_script_expr(L"var o=new Object(); Object.prototype.toString = function() {return \"wine\";}; Object.prototype.toLocaleString.call(o)", &v, NULL);
ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres);
ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
todo_wine
ok(!lstrcmpW(V_BSTR(&v), L"wine"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
hres = parse_script_expr(L"var o=new Object(); delete Object.prototype.toString; Object.prototype.toLocaleString.call(o)", &v, NULL);
ok(hres == 0x800a01b6, "parse_script_expr failed: %08lx\n", hres);
hres = parse_script_expr(L"var o=new Object(); o.toString = function() {return \"wine\";}; Object.prototype.toLocaleString.call(o)", &v, NULL);
ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres);
ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
ok(!lstrcmpW(V_BSTR(&v), L"wine"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
test_default_value();
test_retval();
......
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