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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/for-in.js
diff --git a/test/mjsunit/for-in.js b/test/mjsunit/for-in.js
index 94b39cfd57d67d747d99909253c75dd56e7cac76..319f93bd767481acb28e52ca1ff85058a6c6f970 100644
--- a/test/mjsunit/for-in.js
+++ b/test/mjsunit/for-in.js
@@ -114,6 +114,32 @@ function props(x) {
}
})();
+(function forInShadowingSlowReceiver() {
+ // crbug 688307
+ // Make sure we track all non-enumerable keys on a slow-mode receiver.
+ let receiver = {a:1};
+ delete receiver.a;
+ let proto = Object.create(null);
+ let enumProperties = [];
+ for (let i = 0; i < 10; i++) {
+ let key = "property_"+i;
+ enumProperties.push(key);
+ receiver[key] = i;
+ proto[key] = i;
+ }
+ for (let i = 0; i < 1000; i++) {
+ let nonEnumKey = "nonEnumerableProperty_"+ i;
+ Object.defineProperty(receiver, nonEnumKey, {});
+ // Add both keys as enumerable to the prototype.
+ proto[nonEnumKey] = i;
+ }
+ receiver.__proto__ = proto;
+ // Only the enumerable properties from the receiver should be visible.
+ for (let key in receiver) {
+ assertEquals(key, enumProperties.shift());
+ }
+})();
+
(function forInCharCodes() {
var o = {};
var a = [];
« 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