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

Unified Diff: test/mjsunit/es7/object-observe.js

Issue 993073002: [es6] Function length property should be configurable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Refactor to share more code Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/es7/object-observe.js
diff --git a/test/mjsunit/es7/object-observe.js b/test/mjsunit/es7/object-observe.js
index 99fa38a8573f1f2db70b3c2a0875d61132202c8b..f119ed6a5a003a696d31df8f3623a33732c5d0e2 100644
--- a/test/mjsunit/es7/object-observe.js
+++ b/test/mjsunit/es7/object-observe.js
@@ -1143,7 +1143,8 @@ function blacklisted(obj, prop) {
return (obj instanceof Int32Array && prop == 1) ||
(obj instanceof Int32Array && prop === "length") ||
(obj instanceof ArrayBuffer && prop == 1) ||
- (obj instanceof Function && prop === "name"); // Has its own test.
+ (obj instanceof Function && prop === "name") || // Has its own test.
+ (obj instanceof Function && prop === "length"); // Has its own test.
}
for (var i in objects) for (var j in properties) {
@@ -1824,3 +1825,28 @@ for (var b1 = 0; b1 < 2; ++b1)
{ object: fun, type: 'add', name: 'name' },
]);
})();
+
+
+(function TestFunctionLength() {
+ reset();
+
+ function fun(x) {}
+ Object.observe(fun, observer.callback);
+ fun.length = 'x'; // No change. Not writable.
+ Object.defineProperty(fun, 'length', {value: 'a'});
+ Object.defineProperty(fun, 'length', {writable: true});
+ fun.length = 'b';
+ delete fun.length;
+ fun.length = 'x'; // No change. Function.prototype.length is non writable
+ Object.defineProperty(Function.prototype, 'length', {writable: true});
+ fun.length = 'c';
+ fun.length = 'c'; // Same, no update.
+ Object.deliverChangeRecords(observer.callback);
+ observer.assertCallbackRecords([
+ { object: fun, type: 'update', name: 'length', oldValue: 1 },
+ { object: fun, type: 'reconfigure', name: 'length'},
+ { object: fun, type: 'update', name: 'length', oldValue: 'a' },
+ { object: fun, type: 'delete', name: 'length', oldValue: 'b' },
+ { object: fun, type: 'add', name: 'length' },
+ ]);
+})();

Powered by Google App Engine
This is Rietveld 408576698