diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index 123541eae60..58db45b8611 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -500,6 +500,8 @@ static HRESULT Object_defineProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl hres = jsdisp_define_property(obj, name, &prop_desc); release_property_descriptor(&prop_desc); + if(SUCCEEDED(hres) && r) + *r = jsval_obj(jsdisp_addref(obj)); return hres; } diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 11b68e5953f..7ee8cc1e03b 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -311,8 +311,9 @@ function test_defineProperty() { ok(false, "expected exception"); } - var obj = new Object(); - Object.defineProperty(obj, "test", {}); + var obj = new Object(), defined; + defined = Object.defineProperty(obj, "test", {}); + ok(defined === obj, "defined != obj"); ok("test" in obj, "test is not in obj"); test_own_data_prop_desc(obj, "test", false, false, false); ok(obj.test === undefined, "obj.test = " + obj.test);