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

Unified Diff: test/mjsunit/harmony/arrow-functions.js

Issue 1027283004: [es6] do not add caller/arguments to ES6 function definitions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase + test262 exceptions Created 5 years, 8 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/harmony/arrow-functions.js
diff --git a/test/mjsunit/harmony/arrow-functions.js b/test/mjsunit/harmony/arrow-functions.js
index 0ffa9369919aa8b83bd88ebf6cbb57eea373eea3..6b84c3a6b4fe6ea20d8b6da633c69ba296ca45c2 100644
--- a/test/mjsunit/harmony/arrow-functions.js
+++ b/test/mjsunit/harmony/arrow-functions.js
@@ -47,3 +47,26 @@ var fives = [];
if (v % 5 === 0) fives.push(v);
});
assertEquals([5, 10], fives);
+
+(function testRestrictedFunctionPropertiesStrict() {
+ var arrowFn = () => { "use strict"; };
+ assertFalse(arrowFn.hasOwnProperty("arguments"));
+ assertThrows(function() { return arrowFn.arguments; }, TypeError);
+ assertThrows(function() { arrowFn.arguments = {}; }, TypeError);
+
+ assertFalse(arrowFn.hasOwnProperty("caller"));
+ assertThrows(function() { return arrowFn.caller; }, TypeError);
+ assertThrows(function() { arrowFn.caller = {}; }, TypeError);
+})();
+
+
+(function testRestrictedFunctionPropertiesSloppy() {
+ var arrowFn = () => {};
+ assertFalse(arrowFn.hasOwnProperty("arguments"));
+ assertThrows(function() { return arrowFn.arguments; }, TypeError);
+ assertThrows(function() { arrowFn.arguments = {}; }, TypeError);
+
+ assertFalse(arrowFn.hasOwnProperty("caller"));
+ assertThrows(function() { return arrowFn.caller; }, TypeError);
+ assertThrows(function() { arrowFn.caller = {}; }, TypeError);
+})();

Powered by Google App Engine
This is Rietveld 408576698