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

Side by Side Diff: test/mjsunit/harmony/reflect.js

Issue 1424233005: Fix another corner-case behavior of Object::SetSuperProperty. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove should_throw argument of SetDataProperty. Created 5 years, 1 month 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 | « test/mjsunit/es6/super.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-reflect 5 // Flags: --harmony-reflect
6 6
7 // TODO(neis): Test with proxies. 7 // TODO(neis): Test with proxies.
8 8
9 9
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 assertEquals(44, target.nowrite); 237 assertEquals(44, target.nowrite);
238 238
239 assertFalse(Reflect.set(target, "nowrite", value, target)); 239 assertFalse(Reflect.set(target, "nowrite", value, target));
240 assertEquals(44, target.nowrite); 240 assertEquals(44, target.nowrite);
241 241
242 assertFalse(Reflect.set(target, "nowrite", value, receiver)); 242 assertFalse(Reflect.set(target, "nowrite", value, receiver));
243 assertEquals(44, target.nowrite); 243 assertEquals(44, target.nowrite);
244 assertFalse("nowrite" in receiver); 244 assertFalse("nowrite" in receiver);
245 245
246 // Data vs Non-Writable 246 // Data vs Non-Writable
247 // TODO(neis): This must return false but currently doesn't. 247 assertFalse(Reflect.set({}, "nowrite", value, target));
248 // assertFalse(Reflect.set({}, "nowrite", value, target));
249 248
250 // Data vs Accessor 249 // Data vs Accessor
251 assertFalse(Reflect.set({}, "unknown", 0, {set unknown(x) {}})); 250 assertFalse(Reflect.set({}, "unknown", 0, {set unknown(x) {}}));
252 assertFalse(Reflect.set(target, "unknown", value, {set unknown(x) {}})); 251 assertFalse(Reflect.set(target, "unknown", value, {set unknown(x) {}}));
253 assertFalse(Reflect.set(target, "bla", value, {set bla(x) {}})); 252 assertFalse(Reflect.set(target, "bla", value, {set bla(x) {}}));
254 assertFalse(Reflect.set(target, "bla", value, {get bla() {}})); 253 assertFalse(Reflect.set(target, "bla", value, {get bla() {}}));
255 254
256 // Accessor vs Data 255 // Accessor vs Data
257 assertTrue(Reflect.set({set bla(x) {}}), "bla", value, target); 256 assertTrue(Reflect.set({set bla(x) {}}), "bla", value, target);
258 assertFalse(Reflect.set({get bla() {}}, "bla", value, target)); 257 assertFalse(Reflect.set({get bla() {}}, "bla", value, target));
259 258
260 // Data vs Non-Object 259 // Data vs Non-Object
261 assertFalse(Reflect.set({}, "bla", value, null)); 260 assertFalse(Reflect.set({}, "bla", value, null));
262 assertFalse(Reflect.set({bla: 42}, "bla", value, null)); 261 assertFalse(Reflect.set({bla: 42}, "bla", value, null));
263 262
264 // Accessor vs Non-Object 263 // Accessor vs Non-Object
265 assertTrue(Reflect.set(target, "setter2", value, null)); 264 assertTrue(Reflect.set(target, "setter2", value, null));
266 assertFalse(Reflect.set(target, "getter", value, null)); 265 assertFalse(Reflect.set(target, "getter", value, null));
266
267 let receiver2 = {};
268 Object.defineProperty(receiver2, "bla",
269 {configurable: false, writable: true, value: true});
270 Object.defineProperty(receiver2, "not_in_target",
271 {configurable: false, writable: true, value: true});
272 assertTrue(Reflect.set(target, "bla", value, receiver2));
273 assertTrue(Reflect.set(target, "not_in_target", value, receiver2));
267 } 274 }
268 })(); 275 })();
269 276
270 277
271 278
272 //////////////////////////////////////////////////////////////////////////////// 279 ////////////////////////////////////////////////////////////////////////////////
273 // Reflect.has 280 // Reflect.has
274 281
275 282
276 (function testReflectHasArity() { 283 (function testReflectHasArity() {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 assertThrows(function() { Reflect.preventExtensions(); }, TypeError); 552 assertThrows(function() { Reflect.preventExtensions(); }, TypeError);
546 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError); 553 assertThrows(function() { Reflect.preventExtensions(42); }, TypeError);
547 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError); 554 assertThrows(function() { Reflect.preventExtensions(null); }, TypeError);
548 })(); 555 })();
549 556
550 557
551 // See reflect-prevent-extensions.js for further tests. 558 // See reflect-prevent-extensions.js for further tests.
552 559
553 // TODO(neis): Need proxies to test the situation where 560 // TODO(neis): Need proxies to test the situation where
554 // [[preventExtensions]] returns false. 561 // [[preventExtensions]] returns false.
OLDNEW
« no previous file with comments | « test/mjsunit/es6/super.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698