|
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 */ |
|
10 |
|
11 |
|
12 function testcase() { |
|
13 try { |
|
14 var data = "data"; |
|
15 var getFunc = function () { |
|
16 return 12; |
|
17 }; |
|
18 |
|
19 var setFunc = function (value) { |
|
20 data = value; |
|
21 }; |
|
22 |
|
23 Object.defineProperty(Object.prototype, "length", { |
|
24 get: getFunc, |
|
25 set: setFunc, |
|
26 configurable: true |
|
27 }); |
|
28 |
|
29 var verifyValue = false; |
|
30 var argObj = (function () { return arguments })(); |
|
31 verifyValue = (argObj.length === 0); |
|
32 |
|
33 var verifyWritable = false; |
|
34 argObj.length = 1001; |
|
35 verifyWritable = (argObj.length === 1001); |
|
36 |
|
37 var verifyEnumerable = false; |
|
38 for (var p in argObj) { |
|
39 if (p === "length") { |
|
40 verifyEnumerable = true; |
|
41 } |
|
42 } |
|
43 |
|
44 var verifyConfigurable = false; |
|
45 delete argObj.length; |
|
46 verifyConfigurable = argObj.hasOwnProperty("length"); |
|
47 |
|
48 return verifyValue && verifyWritable && !verifyEnumerable && !verifyConfigurable && data === "data"; |
|
49 } finally { |
|
50 delete Object.prototype.length; |
|
51 } |
|
52 } |
|
53 runTestCase(testcase); |