OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 assertThrows(function() { getProto.call(null); }, TypeError); | 91 assertThrows(function() { getProto.call(null); }, TypeError); |
92 assertThrows(function() { getProto.call(undefined); }, TypeError); | 92 assertThrows(function() { getProto.call(undefined); }, TypeError); |
93 } | 93 } |
94 TestGetProtoOfValues(); | 94 TestGetProtoOfValues(); |
95 | 95 |
96 | 96 |
97 var values = [1, true, false, 's', Symbol()]; | 97 var values = [1, true, false, 's', Symbol()]; |
98 | 98 |
99 | 99 |
100 function TestSetProtoOfValues() { | 100 function TestSetProtoOfValues() { |
| 101 var proto = {}; |
101 for (var i = 0; i < values.length; i++) { | 102 for (var i = 0; i < values.length; i++) { |
102 assertEquals(setProto.call(values[i], i), undefined); | 103 assertEquals(setProto.call(values[i], proto), undefined); |
103 } | 104 } |
104 | 105 |
105 assertThrows(function() { setProto.call(null, 7); }, TypeError); | 106 assertThrows(function() { setProto.call(null, proto); }, TypeError); |
106 assertThrows(function() { setProto.call(undefined, 8); }, TypeError); | 107 assertThrows(function() { setProto.call(undefined, proto); }, TypeError); |
107 } | 108 } |
108 TestSetProtoOfValues(); | 109 TestSetProtoOfValues(); |
109 | 110 |
110 | 111 |
111 function TestSetProtoToValue() { | 112 function TestSetProtoToValue() { |
112 var object = {}; | 113 var object = {}; |
113 var proto = {}; | 114 var proto = {}; |
114 setProto.call(object, proto); | 115 setProto.call(object, proto); |
115 | 116 |
116 var valuesWithUndefined = values.concat(undefined); | 117 var valuesWithUndefined = values.concat(undefined); |
(...skipping 16 matching lines...) Expand all Loading... |
133 var p = {}; | 134 var p = {}; |
134 o.__proto__ = p; | 135 o.__proto__ = p; |
135 assertEquals(Object.getPrototypeOf(o), Object.prototype); | 136 assertEquals(Object.getPrototypeOf(o), Object.prototype); |
136 var desc4 = Object.getOwnPropertyDescriptor(o, "__proto__"); | 137 var desc4 = Object.getOwnPropertyDescriptor(o, "__proto__"); |
137 assertTrue(desc4.configurable); | 138 assertTrue(desc4.configurable); |
138 assertTrue(desc4.enumerable); | 139 assertTrue(desc4.enumerable); |
139 assertTrue(desc4.writable); | 140 assertTrue(desc4.writable); |
140 assertEquals(desc4.value, p); | 141 assertEquals(desc4.value, p); |
141 } | 142 } |
142 TestDeleteProto(); | 143 TestDeleteProto(); |
OLD | NEW |