From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 11 ++++++++++- dlls/mshtml/tests/es5.js | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 2da2270fb0f..185a7954d03 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -579,7 +579,16 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t case PROP_IDX: { jsval_t val;
- hres = prop_get(This, prop, &val); + if(prop->type == PROP_IDX) + hres = This->builtin_info->idx_get(This, prop->u.idx, &val); + else if(prop->u.accessor.getter) + hres = jsdisp_call_value(prop->u.accessor.getter, jsval_disp(jsthis ? jsthis : (IDispatch*)&This->IDispatchEx_iface), + DISPATCH_METHOD, 0, NULL, &val); + else { + val = jsval_undefined(); + hres = S_OK; + } + if(FAILED(hres)) return hres;
diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index e86ab1dbe77..cef3c77c207 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -794,6 +794,7 @@ sync_test("defineProperty", function() { /* call prop with getter */ desc = { get: function() { + ok(this === obj, "this != obj"); return function(x) { ok(x === 100, "x = " + x); return 10; @@ -804,6 +805,10 @@ sync_test("defineProperty", function() { test_accessor_prop_desc(obj, "funcprop", desc); ok(obj.funcprop(100) === 10, "obj.funcprop() = " + obj.funcprop(100));
+ Object.defineProperty(child.prototype, "funcprop_prot", desc); + test_accessor_prop_desc(child.prototype, "funcprop_prot", desc); + ok(obj.funcprop_prot(100) === 10, "obj.funcprop_prot() = " + obj.funcprop_prot(100)); + expect_exception(function() { Object.defineProperty(null, "funcprop", desc); }, JS_E_OBJECT_EXPECTED);