Use [[DefineOwnProperty]] in Array builtins where necessary.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai.u-szeged@partner.samsung.com
This commit is contained in:
Dániel Bátyai
2015-07-21 13:21:19 +02:00
parent 8cd1ade515
commit 1193de88cc
7 changed files with 125 additions and 38 deletions
+7
View File
@@ -144,6 +144,13 @@ assert(result.length === 1)
assert(result[0] === "bar")
assert(array[0] === "y")
var arr = [1,2];
Array.prototype[0] = 3;
var newArr = arr.splice(0, 1);
delete Array.prototype[0];
assert(newArr.hasOwnProperty("0"));
assert(newArr[0] === 1);
// Checking behavior when unable to get length
var obj = {splice : Array.prototype.splice};
Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } });