Commit c1861dc7 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Support deletion for accessor, builtin and idx props.

IDX props are not configurable, thus they cannot be deleted, so it makes no sense to special-case them anyway. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3f135a06
......@@ -1651,14 +1651,17 @@ static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
return S_OK;
}
*ret = TRUE; /* FIXME: not exactly right */
*ret = TRUE;
if(prop->type == PROP_JSVAL) {
if(prop->type == PROP_JSVAL)
jsval_release(prop->u.val);
prop->type = PROP_DELETED;
if(prop->type == PROP_ACCESSOR) {
if(prop->u.accessor.getter)
jsdisp_release(prop->u.accessor.getter);
if(prop->u.accessor.setter)
jsdisp_release(prop->u.accessor.setter);
}
if(prop->type == PROP_ACCESSOR)
FIXME("not supported on accessor property\n");
prop->type = PROP_DELETED;
return S_OK;
}
......
......@@ -1589,6 +1589,13 @@ ok((delete tmp["test"]) === true, "delete returned false");
ok(typeof(tmp.test) === "undefined", "tmp.test type = " + typeof(tmp.test));
ok(!("test" in tmp), "test is still in tmp after delete?");
arr = [1, 2, 3];
ok(arr.length === 3, "arr.length = " + arr.length);
ok((delete arr.length) === false, "delete arr.length returned true");
ok("reverse" in arr, "reverse not in arr");
ok((delete Array.prototype.reverse) === true, "delete Array.prototype.reverse returned false");
ok(!("reverse" in arr), "reverse is still in arr after delete from prototype");
tmp.testWith = true;
with(tmp)
ok(testWith === true, "testWith !== true");
......
......@@ -342,7 +342,8 @@ sync_test("defineProperty", function() {
},
set: function(v) {
getsetprop_value = v;
}
},
configurable: true
};
Object.defineProperty(obj, "getsetprop", desc);
test_accessor_prop_desc(obj, "getsetprop", desc);
......@@ -353,6 +354,9 @@ sync_test("defineProperty", function() {
test_accessor_prop_desc(obj, "getsetprop", desc);
ok(obj.getsetprop === 2, "getsetprop = " + obj.getsetprop);
ok((delete obj.getsetprop) === true, "delete getsetprop returned false");
ok(!("getsetprop" in obj), "getsetprop still in obj after delete");
Object.defineProperty(obj, "notConf", {writable: true, enumerable: true, configurable: false, value: 1});
test_own_data_prop_desc(obj, "notConf", true, true, false);
......@@ -631,6 +635,15 @@ sync_test("property_definitions", function() {
ok(obj[0] === 7, "obj.prop = " + obj[0]);
});
sync_test("string_idx", function() {
var s = "foobar";
ok(s[0] === "f", "s[0] = " + s[0]);
ok(s[5] === "r", "s[5] = " + s[5]);
ok(s[6] === undefined, "s[6] = " + s[6]);
ok((delete s[0]) === false, "delete s[0] returned true");
ok((delete s[6]) === true, "delete s[6] returned false");
});
sync_test("string_trim", function() {
function test_trim(value, expected) {
var r = String.prototype.trim.call(value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment