Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
1 /// Copyright (c) 2012 Ecma International. All rights reserved.
2 /// Ecma International makes this code available under the terms and conditions set
3 /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
4 /// "Use Terms"). Any redistribution of this code must retain the above
5 /// copyright and this notice and otherwise comply with the Use Terms.
6 /**
7 * @path ch10/10.6/10.6-7-1.js
8 * @description Arguments Object has length as its own property and does not invoke the setter defined on Object.prototype.length (Step 7)
9 */
12 function testcase() {
13 try {
14 var data = "data";
15 var getFunc = function () {
16 return 12;
17 };
19 var setFunc = function (value) {
20 data = value;
21 };
23 Object.defineProperty(Object.prototype, "length", {
24 get: getFunc,
25 set: setFunc,
26 configurable: true
27 });
29 var verifyValue = false;
30 var argObj = (function () { return arguments })();
31 verifyValue = (argObj.length === 0);
33 var verifyWritable = false;
34 argObj.length = 1001;
35 verifyWritable = (argObj.length === 1001);
37 var verifyEnumerable = false;
38 for (var p in argObj) {
39 if (p === "length") {
40 verifyEnumerable = true;
41 }
42 }
44 var verifyConfigurable = false;
45 delete argObj.length;
46 verifyConfigurable = argObj.hasOwnProperty("length");
48 return verifyValue && verifyWritable && !verifyEnumerable && !verifyConfigurable && data === "data";
49 } finally {
50 delete Object.prototype.length;
51 }
52 }
53 runTestCase(testcase);