Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
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 ch13/13.2/13.2-18-1.js
8 * @description Function Object has 'prototype' as its own property, it is not enumerable and does not invoke the setter defined on Function.prototype (Step 18)
9 */
12 function testcase() {
13 try {
14 var getFunc = function () {
15 return 100;
16 };
18 var data = "data";
19 var setFunc = function (value) {
20 data = value;
21 };
22 Object.defineProperty(Function.prototype, "prototype", {
23 get: getFunc,
24 set: setFunc,
25 configurable: true
26 });
28 var fun = function () { };
30 var verifyValue = false;
31 verifyValue = (fun.prototype !== 100 && fun.prototype.toString() === "[object Object]");
33 var verifyEnumerable = false;
34 for (var p in fun) {
35 if (p === "prototype" && fun.hasOwnProperty("prototype")) {
36 verifyEnumerable = true;
37 }
38 }
40 var verifyConfigurable = false;
41 delete fun.prototype;
42 verifyConfigurable = fun.hasOwnProperty("prototype");
44 var verifyWritable = false;
45 fun.prototype = 12
46 verifyWritable = (fun.prototype === 12);
48 return verifyValue && verifyWritable && !verifyEnumerable && verifyConfigurable && data === "data";
49 } finally {
50 delete Function.prototype.prototype;
51 }
52 }
53 runTestCase(testcase);