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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (propNames.length == 0 || | 47 if (propNames.length == 0 || |
48 (propNames.length == 1 && propNames[0] == "constructor")) { | 48 (propNames.length == 1 && propNames[0] == "constructor")) { |
49 // Not a constructor. | 49 // Not a constructor. |
50 return; | 50 return; |
51 } | 51 } |
52 var proto_desc = Object.getOwnPropertyDescriptor(func, "prototype"); | 52 var proto_desc = Object.getOwnPropertyDescriptor(func, "prototype"); |
53 assertTrue(proto_desc.hasOwnProperty("value"), name); | 53 assertTrue(proto_desc.hasOwnProperty("value"), name); |
54 assertFalse(proto_desc.writable, name); | 54 assertFalse(proto_desc.writable, name); |
55 assertFalse(proto_desc.configurable, name); | 55 assertFalse(proto_desc.configurable, name); |
56 var prototype = proto_desc.value; | 56 var prototype = proto_desc.value; |
57 assertEquals(null, Object.getPrototypeOf(prototype), name); | 57 assertEquals(name == "GeneratorFunctionPrototype" ? Object.prototype : null, |
| 58 Object.getPrototypeOf(prototype), |
| 59 name); |
58 for (var i = 0; i < propNames.length; i++) { | 60 for (var i = 0; i < propNames.length; i++) { |
59 var propName = propNames[i]; | 61 var propName = propNames[i]; |
60 if (propName == "constructor") continue; | 62 if (propName == "constructor") continue; |
61 var testName = name + "-" + propName; | 63 var testName = name + "-" + propName; |
62 var propDesc = Object.getOwnPropertyDescriptor(prototype, propName); | 64 var propDesc = Object.getOwnPropertyDescriptor(prototype, propName); |
63 assertTrue(propDesc.hasOwnProperty("value"), testName); | 65 assertTrue(propDesc.hasOwnProperty("value"), testName); |
64 assertFalse(propDesc.configurable, testName); | 66 assertFalse(propDesc.configurable, testName); |
65 if (isFunction(propDesc.value)) { | 67 if (isFunction(propDesc.value)) { |
66 assertFalse(propDesc.writable, testName); | 68 assertFalse(propDesc.writable, testName); |
67 } | 69 } |
68 } | 70 } |
69 } | 71 } |
70 | 72 |
71 for (var i = 0; i < names.length; i++) { | 73 for (var i = 0; i < names.length; i++) { |
72 var name = names[i]; | 74 var name = names[i]; |
73 var desc = Object.getOwnPropertyDescriptor(builtins, name); | 75 var desc = Object.getOwnPropertyDescriptor(builtins, name); |
74 assertTrue(desc.hasOwnProperty("value")); | 76 assertTrue(desc.hasOwnProperty("value")); |
75 var value = desc.value; | 77 var value = desc.value; |
76 if (isFunction(value)) { | 78 if (isFunction(value)) { |
77 checkConstructor(value, name); | 79 checkConstructor(value, name); |
78 } | 80 } |
79 } | 81 } |
OLD | NEW |