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

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

Issue 26592012: Prevent changes to hidden properties from being observable via Object.observe (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: moar Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-object-observe.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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 reset(); 279 reset();
280 var obj = {}; 280 var obj = {};
281 Object.getNotifier(obj); 281 Object.getNotifier(obj);
282 Object.observe(obj, observer.callback); 282 Object.observe(obj, observer.callback);
283 obj.id = 1; 283 obj.id = 1;
284 Object.deliverChangeRecords(observer.callback); 284 Object.deliverChangeRecords(observer.callback);
285 observer.assertCallbackRecords([ 285 observer.assertCallbackRecords([
286 { object: obj, type: 'new', name: 'id' }, 286 { object: obj, type: 'new', name: 'id' },
287 ]); 287 ]);
288 288
289 // The empty-string property is observable
290 reset();
291 var obj = {};
292 Object.observe(obj, observer.callback);
293 obj[''] = '';
294 obj[''] = ' ';
295 delete obj[''];
296 Object.deliverChangeRecords(observer.callback);
297 observer.assertCallbackRecords([
298 { object: obj, type: 'new', name: '' },
299 { object: obj, type: 'updated', name: '', oldValue: '' },
300 { object: obj, type: 'deleted', name: '', oldValue: ' ' },
301 ]);
302
289 // Observing a continuous stream of changes, while itermittantly unobserving. 303 // Observing a continuous stream of changes, while itermittantly unobserving.
290 reset(); 304 reset();
291 Object.observe(obj, observer.callback); 305 Object.observe(obj, observer.callback);
292 Object.getNotifier(obj).notify({ 306 Object.getNotifier(obj).notify({
293 type: 'updated', 307 type: 'updated',
294 val: 1 308 val: 1
295 }); 309 });
296 310
297 Object.unobserve(obj, observer.callback); 311 Object.unobserve(obj, observer.callback);
298 Object.getNotifier(obj).notify({ 312 Object.getNotifier(obj).notify({
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 for (var n1 = 0; n1 < 3; ++n1) 1629 for (var n1 = 0; n1 < 3; ++n1)
1616 for (var n2 = 0; n2 < 3; ++n2) 1630 for (var n2 = 0; n2 < 3; ++n2)
1617 for (var i in mutation) 1631 for (var i in mutation)
1618 TestFastElementsLength(mutation[i], b1 != 0, b2 != 0, 20*n1, 20*n2); 1632 TestFastElementsLength(mutation[i], b1 != 0, b2 != 0, 20*n1, 20*n2);
1619 1633
1620 for (var b1 = 0; b1 < 2; ++b1) 1634 for (var b1 = 0; b1 < 2; ++b1)
1621 for (var b2 = 0; b2 < 2; ++b2) 1635 for (var b2 = 0; b2 < 2; ++b2)
1622 for (var n = 0; n < 3; ++n) 1636 for (var n = 0; n < 3; ++n)
1623 for (var i in mutationByIncr) 1637 for (var i in mutationByIncr)
1624 TestFastElementsLength(mutationByIncr[i], b1 != 0, b2 != 0, 7*n, 7*n+1); 1638 TestFastElementsLength(mutationByIncr[i], b1 != 0, b2 != 0, 7*n, 7*n+1);
OLDNEW
« no previous file with comments | « test/cctest/test-object-observe.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698