mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
jscript: Delete external props before redefining them.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
parent
12925e9113
commit
10cf578898
Notes:
Alexandre Julliard
2024-11-18 23:19:10 +01:00
Approved-by: Jacek Caban (@jacek) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6678
2 changed files with 24 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue