| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 assertThrows(function() { getProto.call(null); }, TypeError); | 95 assertThrows(function() { getProto.call(null); }, TypeError); |
| 96 assertThrows(function() { getProto.call(undefined); }, TypeError); | 96 assertThrows(function() { getProto.call(undefined); }, TypeError); |
| 97 } | 97 } |
| 98 TestGetProtoOfValues(); | 98 TestGetProtoOfValues(); |
| 99 | 99 |
| 100 | 100 |
| 101 var values = [1, true, false, 's', Symbol()]; | 101 var values = [1, true, false, 's', Symbol()]; |
| 102 | 102 |
| 103 | 103 |
| 104 function TestSetProtoOfValues() { | 104 function TestSetProtoOfValues() { |
| 105 var proto = {}; |
| 105 for (var i = 0; i < values.length; i++) { | 106 for (var i = 0; i < values.length; i++) { |
| 106 assertEquals(setProto.call(values[i], i), undefined); | 107 assertEquals(setProto.call(values[i], proto), undefined); |
| 107 } | 108 } |
| 108 | 109 |
| 109 assertThrows(function() { setProto.call(null, 7); }, TypeError); | 110 assertThrows(function() { setProto.call(null, proto); }, TypeError); |
| 110 assertThrows(function() { setProto.call(undefined, 8); }, TypeError); | 111 assertThrows(function() { setProto.call(undefined, proto); }, TypeError); |
| 111 } | 112 } |
| 112 TestSetProtoOfValues(); | 113 TestSetProtoOfValues(); |
| 113 | 114 |
| 114 | 115 |
| 115 function TestSetProtoToValue() { | 116 function TestSetProtoToValue() { |
| 116 var object = {}; | 117 var object = {}; |
| 117 var proto = {}; | 118 var proto = {}; |
| 118 setProto.call(object, proto); | 119 setProto.call(object, proto); |
| 119 | 120 |
| 120 var valuesWithUndefined = values.concat(undefined); | 121 var valuesWithUndefined = values.concat(undefined); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 137 var p = {}; | 138 var p = {}; |
| 138 o.__proto__ = p; | 139 o.__proto__ = p; |
| 139 assertEquals(Object.getPrototypeOf(o), Object.prototype); | 140 assertEquals(Object.getPrototypeOf(o), Object.prototype); |
| 140 var desc4 = Object.getOwnPropertyDescriptor(o, "__proto__"); | 141 var desc4 = Object.getOwnPropertyDescriptor(o, "__proto__"); |
| 141 assertTrue(desc4.configurable); | 142 assertTrue(desc4.configurable); |
| 142 assertTrue(desc4.enumerable); | 143 assertTrue(desc4.enumerable); |
| 143 assertTrue(desc4.writable); | 144 assertTrue(desc4.writable); |
| 144 assertEquals(desc4.value, p); | 145 assertEquals(desc4.value, p); |
| 145 } | 146 } |
| 146 TestDeleteProto(); | 147 TestDeleteProto(); |
| OLD | NEW |