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

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

Issue 11275292: Object.observe: Move notification of JSArray length changes to JSArray::SetElementsLength (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test Created 8 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 | 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 var array = {0: 1, 1: 2, 2: 3, length: 3}; 583 var array = {0: 1, 1: 2, 2: 3, length: 3};
584 Object.observe(array, observer.callback); 584 Object.observe(array, observer.callback);
585 Array.prototype.splice.call(array, 1, 1, 4, 5); 585 Array.prototype.splice.call(array, 1, 1, 4, 5);
586 Object.deliverChangeRecords(observer.callback); 586 Object.deliverChangeRecords(observer.callback);
587 observer.assertCallbackRecords([ 587 observer.assertCallbackRecords([
588 { object: array, name: '3', type: 'new' }, 588 { object: array, name: '3', type: 'new' },
589 { object: array, name: '1', type: 'updated', oldValue: 2 }, 589 { object: array, name: '1', type: 'updated', oldValue: 2 },
590 { object: array, name: '2', type: 'updated', oldValue: 3 }, 590 { object: array, name: '2', type: 'updated', oldValue: 3 },
591 { object: array, name: 'length', type: 'updated', oldValue: 3 }, 591 { object: array, name: 'length', type: 'updated', oldValue: 3 },
592 ]); 592 ]);
593
594 // Exercise StoreIC_ArrayLength
595 reset();
596 var dummy = {};
597 Object.observe(dummy, observer.callback);
598 Object.unobserve(dummy, observer.callback);
599 var array = [0];
600 Object.observe(array, observer.callback);
601 array.splice(0, 1);
602 Object.deliverChangeRecords(observer.callback);
603 observer.assertCallbackRecords([
604 { object: array, name: '0', type: 'deleted', oldValue: 0 },
605 { object: array, name: 'length', type: 'updated', oldValue: 1},
606 ]);
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