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

Side by Side Diff: test/mjsunit/es7/object-observe.js

Issue 1489423002: [proxies] Make Object.{freeze,seal} behave correctly for proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add some tests. Created 5 years 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/runtime/runtime-object.cc ('k') | test/mjsunit/harmony/proxies-hash.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 Object.defineProperty(obj, 'd', { 343 Object.defineProperty(obj, 'd', {
344 writable: false, 344 writable: false,
345 configurable: false, 345 configurable: false,
346 value: 'd' 346 value: 'd'
347 }); 347 });
348 Object.observe(obj, observer.callback); 348 Object.observe(obj, observer.callback);
349 Object.freeze(obj); 349 Object.freeze(obj);
350 350
351 Object.deliverChangeRecords(observer.callback); 351 Object.deliverChangeRecords(observer.callback);
352 observer.assertCallbackRecords([ 352 observer.assertCallbackRecords([
353 { object: obj, type: 'preventExtensions' },
353 { object: obj, type: 'reconfigure', name: 'a' }, 354 { object: obj, type: 'reconfigure', name: 'a' },
354 { object: obj, type: 'reconfigure', name: 'b' }, 355 { object: obj, type: 'reconfigure', name: 'b' },
355 { object: obj, type: 'reconfigure', name: 'c' }, 356 { object: obj, type: 'reconfigure', name: 'c' },
356 { object: obj, type: 'preventExtensions' },
357 ]); 357 ]);
358 358
359 reset(); 359 reset();
360 var obj = { foo: 'bar'}; 360 var obj = { foo: 'bar'};
361 Object.freeze(obj); 361 Object.freeze(obj);
362 Object.observe(obj, observer.callback); 362 Object.observe(obj, observer.callback);
363 Object.freeze(obj); 363 Object.freeze(obj);
364 Object.deliverChangeRecords(observer.callback); 364 Object.deliverChangeRecords(observer.callback);
365 observer.assertNotCalled(); 365 observer.assertNotCalled();
366 366
(...skipping 13 matching lines...) Expand all
380 Object.defineProperty(obj, 'd', { 380 Object.defineProperty(obj, 'd', {
381 writable: false, 381 writable: false,
382 configurable: false, 382 configurable: false,
383 value: 'd' 383 value: 'd'
384 }); 384 });
385 Object.observe(obj, observer.callback); 385 Object.observe(obj, observer.callback);
386 Object.seal(obj); 386 Object.seal(obj);
387 387
388 Object.deliverChangeRecords(observer.callback); 388 Object.deliverChangeRecords(observer.callback);
389 observer.assertCallbackRecords([ 389 observer.assertCallbackRecords([
390 { object: obj, type: 'preventExtensions' },
390 { object: obj, type: 'reconfigure', name: 'a' }, 391 { object: obj, type: 'reconfigure', name: 'a' },
391 { object: obj, type: 'reconfigure', name: 'b' }, 392 { object: obj, type: 'reconfigure', name: 'b' },
392 { object: obj, type: 'preventExtensions' },
393 ]); 393 ]);
394 394
395 reset(); 395 reset();
396 var obj = { foo: 'bar'}; 396 var obj = { foo: 'bar'};
397 Object.seal(obj); 397 Object.seal(obj);
398 Object.observe(obj, observer.callback); 398 Object.observe(obj, observer.callback);
399 Object.seal(obj); 399 Object.seal(obj);
400 Object.deliverChangeRecords(observer.callback); 400 Object.deliverChangeRecords(observer.callback);
401 observer.assertNotCalled(); 401 observer.assertNotCalled();
402 402
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 var ex; 1856 var ex;
1857 try { 1857 try {
1858 Object.observe({}, function(){}, "not an object"); 1858 Object.observe({}, function(){}, "not an object");
1859 } catch (e) { 1859 } catch (e) {
1860 ex = e; 1860 ex = e;
1861 } 1861 }
1862 assertInstanceof(ex, TypeError); 1862 assertInstanceof(ex, TypeError);
1863 assertEquals("Third argument to Object.observe must be an array of strings.", 1863 assertEquals("Third argument to Object.observe must be an array of strings.",
1864 ex.message); 1864 ex.message);
1865 })() 1865 })()
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/mjsunit/harmony/proxies-hash.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698