Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: test/mjsunit/proto-accessor.js

Issue 174113003: Fix issue with setting __proto__ on a value (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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();
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698