jscript: Allow overriding builtin methods by setting the prop.
Methods can be overriden by simple assignment, not just via defineProperty, unlike accessors. 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
324b82d9ec
commit
94349fdd9a
|
@ -495,6 +495,12 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
|
||||||
|
|
||||||
switch(prop->type) {
|
switch(prop->type) {
|
||||||
case PROP_BUILTIN:
|
case PROP_BUILTIN:
|
||||||
|
if(prop->u.p->invoke) {
|
||||||
|
prop->type = PROP_JSVAL;
|
||||||
|
prop->flags = PROPF_CONFIGURABLE | PROPF_WRITABLE;
|
||||||
|
prop->u.val = jsval_undefined();
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(!prop->u.p->setter) {
|
if(!prop->u.p->setter) {
|
||||||
TRACE("getter with no setter\n");
|
TRACE("getter with no setter\n");
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -2955,7 +2955,6 @@ static void test_script_exprs(void)
|
||||||
hres = parse_script_expr(L"var o=new Object(); Object.prototype.toString = function() {return \"wine\";}; Object.prototype.toLocaleString.call(o)", &v, NULL);
|
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(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(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)));
|
ok(!lstrcmpW(V_BSTR(&v), L"wine"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
|
||||||
VariantClear(&v);
|
VariantClear(&v);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue