diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index aa81de7ad75..1dd18fcc2ee 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -3282,8 +3282,14 @@ HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t if(desc->explicit_value) { if(prop->type == PROP_JSVAL) jsval_release(prop->u.val); - else + else { + if(prop->type == PROP_EXTERN && obj->builtin_info->prop_delete) { + hres = obj->builtin_info->prop_delete(obj, prop->u.id); + if(FAILED(hres)) + return hres; + } prop->type = PROP_JSVAL; + } hres = jsval_copy(desc->value, &prop->u.val); if(FAILED(hres)) { prop->u.val = jsval_undefined(); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 3adb7cc1d61..efc3bf0f8d1 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2153,6 +2153,23 @@ sync_test("builtin_context", function() { ok(obj.length === 1, "obj.length = " + obj.length); }); +sync_test("globals override", function() { + wineprop = 1337; /* global */ + ok(window.hasOwnProperty("wineprop"), "wineprop not a prop of window"); + ok(window.wineprop === 1337, "window.wineprop = " + window.wineprop); + ok(wineprop === 1337, "wineprop = " + wineprop); + + var r = Object.defineProperty(window, "wineprop", { value: 42, configurable: true }); + ok(r === window, "defineProperty(window.wineprop) returned " + r); + ok(window.hasOwnProperty("wineprop"), "wineprop not a prop of window after override"); + ok(window.wineprop === 42, "window.wineprop after override = " + window.wineprop); + ok(wineprop === 42, "wineprop after override = " + wineprop); + + r = (delete window.wineprop); + ok(r === true, "delete window.wineprop returned " + r); + ok(!("wineprop" in window), "wineprop in window after delete"); +}); + sync_test("host this", function() { var tests = [ undefined, null, external.nullDisp, function() {}, [0], "foobar", true, 42, new Number(42), external.testHostContext(true), window, document ]; var i, obj = Object.create(Function.prototype);