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

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

Issue 11414177: When notifying observers of a truncated array, don't call getters on deleted element indices (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
« 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 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 arr.length = 0; 577 arr.length = 0;
578 arr.length = 10; 578 arr.length = 10;
579 arr2.length = 0; 579 arr2.length = 0;
580 arr2.length = 1; // no change expected 580 arr2.length = 1; // no change expected
581 arr3.length = 0; 581 arr3.length = 0;
582 Object.defineProperty(arr3, 'length', {value: 5}); 582 Object.defineProperty(arr3, 'length', {value: 5});
583 Object.defineProperty(arr3, 'length', {value: 10, writable: false}); 583 Object.defineProperty(arr3, 'length', {value: 10, writable: false});
584 Object.deliverChangeRecords(observer.callback); 584 Object.deliverChangeRecords(observer.callback);
585 observer.assertCallbackRecords([ 585 observer.assertCallbackRecords([
586 { object: arr, name: '3', type: 'deleted', oldValue: 'd' }, 586 { object: arr, name: '3', type: 'deleted', oldValue: 'd' },
587 // TODO(adamk): oldValue should not be present below 587 { object: arr, name: '2', type: 'deleted' },
588 { object: arr, name: '2', type: 'deleted', oldValue: undefined },
589 { object: arr, name: 'length', type: 'updated', oldValue: 4 }, 588 { object: arr, name: 'length', type: 'updated', oldValue: 4 },
590 { object: arr, name: '1', type: 'deleted', oldValue: 'b' }, 589 { object: arr, name: '1', type: 'deleted', oldValue: 'b' },
591 { object: arr, name: 'length', type: 'updated', oldValue: 2 }, 590 { object: arr, name: 'length', type: 'updated', oldValue: 2 },
592 { object: arr, name: 'length', type: 'updated', oldValue: 1 }, 591 { object: arr, name: 'length', type: 'updated', oldValue: 1 },
593 { object: arr2, name: '1', type: 'deleted', oldValue: 'beta' }, 592 { object: arr2, name: '1', type: 'deleted', oldValue: 'beta' },
594 { object: arr2, name: 'length', type: 'updated', oldValue: 2 }, 593 { object: arr2, name: 'length', type: 'updated', oldValue: 2 },
595 { object: arr3, name: '2', type: 'deleted', oldValue: 'goodbye' }, 594 { object: arr3, name: '2', type: 'deleted', oldValue: 'goodbye' },
596 { object: arr3, name: '0', type: 'deleted', oldValue: 'hello' }, 595 { object: arr3, name: '0', type: 'deleted', oldValue: 'hello' },
597 { object: arr3, name: 'length', type: 'updated', oldValue: 6 }, 596 { object: arr3, name: 'length', type: 'updated', oldValue: 6 },
598 { object: arr3, name: 'length', type: 'updated', oldValue: 0 }, 597 { object: arr3, name: 'length', type: 'updated', oldValue: 0 },
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 Object.observe(dummy, observer.callback); 803 Object.observe(dummy, observer.callback);
805 Object.unobserve(dummy, observer.callback); 804 Object.unobserve(dummy, observer.callback);
806 var array = [0]; 805 var array = [0];
807 Object.observe(array, observer.callback); 806 Object.observe(array, observer.callback);
808 array.splice(0, 1); 807 array.splice(0, 1);
809 Object.deliverChangeRecords(observer.callback); 808 Object.deliverChangeRecords(observer.callback);
810 observer.assertCallbackRecords([ 809 observer.assertCallbackRecords([
811 { object: array, name: '0', type: 'deleted', oldValue: 0 }, 810 { object: array, name: '0', type: 'deleted', oldValue: 0 },
812 { object: array, name: 'length', type: 'updated', oldValue: 1}, 811 { object: array, name: 'length', type: 'updated', oldValue: 1},
813 ]); 812 ]);
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