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

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: Fix status file again 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
« no previous file with comments | « test/mjsunit/es6/function-length-configurable.js ('k') | test/mjsunit/regress/regress-1530.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es7/object-observe.js
diff --git a/test/mjsunit/es7/object-observe.js b/test/mjsunit/es7/object-observe.js
index ad47da56513e02cc1f11b43dfae008b16d11365d..b2853c40484fc7cfd215885d2016f6c4325b3401 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) {
@@ -1826,6 +1827,31 @@ for (var b1 = 0; b1 < 2; ++b1)
})();
+(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' },
+ ]);
+})();
+
+
(function TestObserveInvalidAcceptMessage() {
var ex;
try {
« no previous file with comments | « test/mjsunit/es6/function-length-configurable.js ('k') | test/mjsunit/regress/regress-1530.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698