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

Unified Diff: test/mjsunit/strict-mode.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 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
« no previous file with comments | « test/mjsunit/harmony/object-literals-method.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/strict-mode.js
diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js
index c97429f7b7a007e38e955b87aa59ec163ef16a4f..326e725774493c873638a04d66d3f2c8b17f2659 100644
--- a/test/mjsunit/strict-mode.js
+++ b/test/mjsunit/strict-mode.js
@@ -1010,7 +1010,35 @@ repeat(10, function() {
})();
-function CheckPillDescriptor(func, name) {
+function CheckFunctionPillDescriptor(func, name) {
+
+ function CheckPill(pill) {
+ assertEquals("function", typeof pill);
+ assertInstanceof(pill, Function);
+ pill.property = "value";
+ assertEquals(pill.value, undefined);
+ assertThrows(function() { 'use strict'; pill.property = "value"; },
+ TypeError);
+ assertThrows(pill, TypeError);
+ assertEquals(pill.prototype, (function(){}).prototype);
+ var d = Object.getOwnPropertyDescriptor(pill, "prototype");
+ assertFalse(d.writable);
+ assertFalse(d.configurable);
+ assertFalse(d.enumerable);
+ }
+
+ // Poisoned accessors are no longer own properties
+ func = Object.getPrototypeOf(func);
+ var descriptor = Object.getOwnPropertyDescriptor(func, name);
+ CheckPill(descriptor.get)
+ CheckPill(descriptor.set);
+ assertFalse(descriptor.enumerable);
+ // In ES6, restricted function properties are configurable
+ assertTrue(descriptor.configurable);
+}
+
+
+function CheckArgumentsPillDescriptor(func, name) {
function CheckPill(pill) {
assertEquals("function", typeof pill);
@@ -1056,12 +1084,12 @@ function CheckPillDescriptor(func, name) {
assertThrows(function() { third.caller = 42; }, TypeError);
assertThrows(function() { third.arguments = 42; }, TypeError);
- CheckPillDescriptor(strict, "caller");
- CheckPillDescriptor(strict, "arguments");
- CheckPillDescriptor(another, "caller");
- CheckPillDescriptor(another, "arguments");
- CheckPillDescriptor(third, "caller");
- CheckPillDescriptor(third, "arguments");
+ CheckFunctionPillDescriptor(strict, "caller");
+ CheckFunctionPillDescriptor(strict, "arguments");
+ CheckFunctionPillDescriptor(another, "caller");
+ CheckFunctionPillDescriptor(another, "arguments");
+ CheckFunctionPillDescriptor(third, "caller");
+ CheckFunctionPillDescriptor(third, "arguments");
})();
@@ -1093,15 +1121,15 @@ function CheckPillDescriptor(func, name) {
}
var args = strict();
- CheckPillDescriptor(args, "caller");
- CheckPillDescriptor(args, "callee");
+ CheckArgumentsPillDescriptor(args, "caller");
+ CheckArgumentsPillDescriptor(args, "callee");
args = strict(17, "value", strict);
assertEquals(17, args[0])
assertEquals("value", args[1])
assertEquals(strict, args[2]);
- CheckPillDescriptor(args, "caller");
- CheckPillDescriptor(args, "callee");
+ CheckArgumentsPillDescriptor(args, "caller");
+ CheckArgumentsPillDescriptor(args, "callee");
function outer() {
"use strict";
@@ -1112,15 +1140,15 @@ function CheckPillDescriptor(func, name) {
}
var args = outer()();
- CheckPillDescriptor(args, "caller");
- CheckPillDescriptor(args, "callee");
+ CheckArgumentsPillDescriptor(args, "caller");
+ CheckArgumentsPillDescriptor(args, "callee");
args = outer()(17, "value", strict);
assertEquals(17, args[0])
assertEquals("value", args[1])
assertEquals(strict, args[2]);
- CheckPillDescriptor(args, "caller");
- CheckPillDescriptor(args, "callee");
+ CheckArgumentsPillDescriptor(args, "caller");
+ CheckArgumentsPillDescriptor(args, "callee");
})();
« no previous file with comments | « test/mjsunit/harmony/object-literals-method.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698