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

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

Issue 11362115: Object.observe: include oldValue in change records, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. 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/property.h ('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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 ]); 243 ]);
244 244
245 // Observing named properties. 245 // Observing named properties.
246 reset(); 246 reset();
247 var obj = {a: 1} 247 var obj = {a: 1}
248 Object.observe(obj, observer.callback); 248 Object.observe(obj, observer.callback);
249 obj.a = 2; 249 obj.a = 2;
250 obj["a"] = 3; 250 obj["a"] = 3;
251 delete obj.a; 251 delete obj.a;
252 obj.a = 4; 252 obj.a = 4;
253 obj.a = 4; // ignored
253 obj.a = 5; 254 obj.a = 5;
254 Object.defineProperty(obj, "a", {value: 6}); 255 Object.defineProperty(obj, "a", {value: 6});
255 Object.defineProperty(obj, "a", {writable: false}); 256 Object.defineProperty(obj, "a", {writable: false});
256 obj.a = 7; // ignored 257 obj.a = 7; // ignored
257 Object.defineProperty(obj, "a", {value: 8}); 258 Object.defineProperty(obj, "a", {value: 8});
259 Object.defineProperty(obj, "a", {value: 7, writable: true});
260 Object.defineProperty(obj, "a", {get: function() {}});
258 Object.defineProperty(obj, "a", {get: function() {}}); 261 Object.defineProperty(obj, "a", {get: function() {}});
259 delete obj.a; 262 delete obj.a;
260 Object.defineProperty(obj, "a", {get: function() {}}); 263 delete obj.a;
264 Object.defineProperty(obj, "a", {get: function() {}, configurable: true});
265 Object.defineProperty(obj, "a", {value: 9, writable: true});
266 obj.a = 10;
267 delete obj.a;
268 Object.defineProperty(obj, "a", {value: 11, configurable: true});
261 Object.deliverChangeRecords(observer.callback); 269 Object.deliverChangeRecords(observer.callback);
262 // TODO(observe): oldValue not included yet.
263 observer.assertCallbackRecords([ 270 observer.assertCallbackRecords([
264 { object: obj, name: "a", type: "updated" }, 271 { object: obj, name: "a", type: "updated", oldValue: 1 },
265 { object: obj, name: "a", type: "updated" }, 272 { object: obj, name: "a", type: "updated", oldValue: 2 },
266 { object: obj, name: "a", type: "deleted" }, 273 { object: obj, name: "a", type: "deleted", oldValue: 3 },
267 { object: obj, name: "a", type: "new" }, 274 { object: obj, name: "a", type: "new" },
268 { object: obj, name: "a", type: "updated" }, 275 { object: obj, name: "a", type: "updated", oldValue: 4 },
269 { object: obj, name: "a", type: "updated" }, 276 { object: obj, name: "a", type: "updated", oldValue: 5 },
270 { object: obj, name: "a", type: "reconfigured" }, 277 { object: obj, name: "a", type: "reconfigured", oldValue: 6 },
271 { object: obj, name: "a", type: "updated" }, 278 { object: obj, name: "a", type: "updated", oldValue: 6 },
279 { object: obj, name: "a", type: "reconfigured", oldValue: 8 },
280 { object: obj, name: "a", type: "reconfigured", oldValue: 7 },
272 { object: obj, name: "a", type: "reconfigured" }, 281 { object: obj, name: "a", type: "reconfigured" },
273 { object: obj, name: "a", type: "deleted" }, 282 { object: obj, name: "a", type: "deleted" },
274 { object: obj, name: "a", type: "new" }, 283 { object: obj, name: "a", type: "new" },
284 { object: obj, name: "a", type: "reconfigured" },
285 { object: obj, name: "a", type: "updated", oldValue: 9 },
286 { object: obj, name: "a", type: "deleted", oldValue: 10 },
287 { object: obj, name: "a", type: "new" },
275 ]); 288 ]);
OLDNEW
« no previous file with comments | « src/property.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698