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

Side by Side Diff: test/mjsunit/for-in.js

Issue 2686513002: [key] Fix for-in with trailing shadowing keys with dict-mode receiver (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/objects.cc ('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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 delete obj.a; 107 delete obj.a;
108 for (var i = 0; i < 3; i++) { 108 for (var i = 0; i < 3; i++) {
109 assertArrayEquals("34159bx".split(""), props(obj)); 109 assertArrayEquals("34159bx".split(""), props(obj));
110 } 110 }
111 delete obj[3]; 111 delete obj[3];
112 for (var i = 0; i < 3; i++) { 112 for (var i = 0; i < 3; i++) {
113 assertArrayEquals("4159bx".split(""), props(obj)); 113 assertArrayEquals("4159bx".split(""), props(obj));
114 } 114 }
115 })(); 115 })();
116 116
117 (function forInShadowingSlowReceiver() {
118 // crbug 688307
119 // Make sure we track all non-enumerable keys on a slow-mode receiver.
120 let receiver = {a:1};
121 delete receiver.a;
122 let proto = Object.create(null);
123 let enumProperties = [];
124 for (let i = 0; i < 10; i++) {
125 let key = "property_"+i;
126 enumProperties.push(key);
127 receiver[key] = i;
128 proto[key] = i;
129 }
130 for (let i = 0; i < 1000; i++) {
131 let nonEnumKey = "nonEnumerableProperty_"+ i;
132 Object.defineProperty(receiver, nonEnumKey, {});
133 // Add both keys as enumerable to the prototype.
134 proto[nonEnumKey] = i;
135 }
136 receiver.__proto__ = proto;
137 // Only the enumerable properties from the receiver should be visible.
138 for (let key in receiver) {
139 assertEquals(key, enumProperties.shift());
140 }
141 })();
142
117 (function forInCharCodes() { 143 (function forInCharCodes() {
118 var o = {}; 144 var o = {};
119 var a = []; 145 var a = [];
120 for (var i = 0x0020; i < 0x01ff; i+=2) { 146 for (var i = 0x0020; i < 0x01ff; i+=2) {
121 var s = 'char:' + String.fromCharCode(i); 147 var s = 'char:' + String.fromCharCode(i);
122 a.push(s); 148 a.push(s);
123 o[s] = i; 149 o[s] = i;
124 } 150 }
125 assertArrayEquals(a, props(o), "charcodes"); 151 assertArrayEquals(a, props(o), "charcodes");
126 })(); 152 })();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 assertUnreachable(); 262 assertUnreachable();
237 } 263 }
238 })(); 264 })();
239 265
240 (function testNonEnumerableSloppyArgumentsIndex(a) { 266 (function testNonEnumerableSloppyArgumentsIndex(a) {
241 Object.defineProperty(arguments, 0, {enumerable:false}); 267 Object.defineProperty(arguments, 0, {enumerable:false});
242 for (var k in arguments) { 268 for (var k in arguments) {
243 assertUnreachable(); 269 assertUnreachable();
244 } 270 }
245 })(true); 271 })(true);
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698