Index: test/mjsunit/harmony/object-observe.js |
diff --git a/test/mjsunit/harmony/object-observe.js b/test/mjsunit/harmony/object-observe.js |
index 231fe91e18594797c5519eec6fbc9f2b839998ef..d4fb48bfe7904618846105e39d85d6c4d35c4b3c 100644 |
--- a/test/mjsunit/harmony/object-observe.js |
+++ b/test/mjsunit/harmony/object-observe.js |
@@ -399,3 +399,19 @@ observer.assertCallbackRecords([ |
{ object: obj, name: "3", type: "new" }, |
{ object: obj, name: "4", type: "new" }, |
]); |
+ |
+// Adding elements past the end of an array should notify on length |
+reset(); |
+var arr = [1, 2, 3]; |
+Object.observe(arr, observer.callback); |
+arr[3] = 10; |
+arr[100] = 20; |
+arr[50] = 30; // no length change expected |
+Object.deliverChangeRecords(observer.callback); |
+observer.assertCallbackRecords([ |
+ { object: arr, name: 'length', type: 'updated', oldValue: 3 }, |
+ { object: arr, name: '3', type: 'new' }, |
+ { object: arr, name: 'length', type: 'updated', oldValue: 4 }, |
+ { object: arr, name: '100', type: 'new' }, |
+ { object: arr, name: '50', type: 'new' }, |
+]); |