js/src/tests/test262/ch10/10.6/10.6-13-a-1.js

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:c7b9f4edfbb7
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-13-a-1.js
8 * @description In non-strict mode, arguments object should have its own 'callee' property defined (Step 13.a)
9 */
10
11
12 function testcase() {
13 try {
14 Object.defineProperty(Object.prototype, "callee", {
15 value: 1,
16 writable: false,
17 configurable: true
18 });
19
20 var argObj = (function () { return arguments })();
21
22 var verifyValue = false;
23 verifyValue = typeof argObj.callee === "function";
24
25 var verifyWritable = false;
26 argObj.callee = 1001;
27 verifyWritable = (argObj.callee === 1001);
28
29 var verifyEnumerable = false;
30 for (var p in argObj) {
31 if (p === "callee" && argObj.hasOwnProperty("callee")) {
32 verifyEnumerable = true;
33 }
34 }
35
36 var verifyConfigurable = false;
37 delete argObj.callee;
38 verifyConfigurable = argObj.hasOwnProperty("callee");
39
40 return verifyValue && verifyWritable && !verifyEnumerable && !verifyConfigurable;
41 } finally {
42 delete Object.prototype.callee;
43 }
44 }
45 runTestCase(testcase);

mercurial