OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 (propNames.length == 1 && propNames[0] == "constructor")) { | 49 (propNames.length == 1 && propNames[0] == "constructor")) { |
50 // Not a constructor. | 50 // Not a constructor. |
51 return; | 51 return; |
52 } | 52 } |
53 var proto_desc = Object.getOwnPropertyDescriptor(func, "prototype"); | 53 var proto_desc = Object.getOwnPropertyDescriptor(func, "prototype"); |
54 assertTrue(proto_desc.hasOwnProperty("value"), name); | 54 assertTrue(proto_desc.hasOwnProperty("value"), name); |
55 assertFalse(proto_desc.writable, name); | 55 assertFalse(proto_desc.writable, name); |
56 assertFalse(proto_desc.configurable, name); | 56 assertFalse(proto_desc.configurable, name); |
57 var prototype = proto_desc.value; | 57 var prototype = proto_desc.value; |
58 assertEquals(null, prototype.__proto__, name); | 58 assertEquals(null, prototype.__proto__, name); |
59 assertFalse(Object.isExtensible(prototype), name); | |
60 for (var i = 0; i < propNames.length; i++) { | 59 for (var i = 0; i < propNames.length; i++) { |
61 var propName = propNames[i]; | 60 var propName = propNames[i]; |
62 if (propName == "constructor") continue; | 61 if (propName == "constructor") continue; |
63 var testName = name + "-" + propName; | 62 var testName = name + "-" + propName; |
64 var propDesc = Object.getOwnPropertyDescriptor(prototype, propName); | 63 var propDesc = Object.getOwnPropertyDescriptor(prototype, propName); |
65 assertTrue(propDesc.hasOwnProperty("value"), testName); | 64 assertTrue(propDesc.hasOwnProperty("value"), testName); |
66 assertFalse(propDesc.configurable, testName); | 65 assertFalse(propDesc.configurable, testName); |
67 if (isFunction(propDesc.value)) { | 66 if (isFunction(propDesc.value)) { |
68 assertFalse(propDesc.writable, testName); | 67 assertFalse(propDesc.writable, testName); |
69 } | 68 } |
70 } | 69 } |
71 } | 70 } |
72 | 71 |
73 for (var i = 0; i < names.length; i++) { | 72 for (var i = 0; i < names.length; i++) { |
74 var name = names[i]; | 73 var name = names[i]; |
75 var desc = Object.getOwnPropertyDescriptor(builtins, name); | 74 var desc = Object.getOwnPropertyDescriptor(builtins, name); |
76 assertTrue(desc.hasOwnProperty("value")); | 75 assertTrue(desc.hasOwnProperty("value")); |
77 var value = desc.value; | 76 var value = desc.value; |
78 if (isFunction(value)) { | 77 if (isFunction(value)) { |
79 assertFalse(desc.writable, name); | 78 assertFalse(desc.writable, name); |
80 assertFalse(desc.configurable, name); | 79 assertFalse(desc.configurable, name); |
81 checkConstructor(value, name); | 80 checkConstructor(value, name); |
82 } | 81 } |
83 } | 82 } |
OLD | NEW |