Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit f421160

Browse files
committed
[Merge chakra-core/ChakraCore@3c659bbe63] [1.6>1.7] [MERGE #3414 @curtisman] Fix issue #3393: Remove throwing accessor for caller property on argument object in strict mode
Merge pull request #3414 from curtisman:fix3393
1 parent f9033a5 commit f421160

File tree

8 files changed

+10
-32
lines changed

8 files changed

+10
-32
lines changed

deps/chakrashim/core/lib/Runtime/Language/JavascriptOperators.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6983,8 +6983,6 @@ namespace Js
69836983
if (funcCallee->IsStrictMode())
69846984
{
69856985
JavascriptFunction* restrictedPropertyAccessor = library->GetThrowTypeErrorRestrictedPropertyAccessorFunction();
6986-
argsObj->SetAccessors(PropertyIds::caller, restrictedPropertyAccessor, restrictedPropertyAccessor, PropertyOperation_NonFixedValue);
6987-
69886986
argsObj->SetAccessors(PropertyIds::callee, restrictedPropertyAccessor, restrictedPropertyAccessor, PropertyOperation_NonFixedValue);
69896987

69906988
}

deps/chakrashim/core/lib/Runtime/Types/DictionaryTypeHandler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ namespace Js
1717
{
1818
DictionaryTypeHandlerBase<T> * dictTypeHandler = New(recycler, 8, 0, 0);
1919

20-
dictTypeHandler->Add(scriptContext->GetPropertyName(Js::PropertyIds::caller), PropertyWritable, scriptContext);
2120
dictTypeHandler->Add(scriptContext->GetPropertyName(Js::PropertyIds::callee), PropertyWritable, scriptContext);
2221
dictTypeHandler->Add(scriptContext->GetPropertyName(Js::PropertyIds::length), PropertyBuiltInMethodDefaults, scriptContext);
2322
dictTypeHandler->Add(scriptContext->GetPropertyName(Js::PropertyIds::_symbolIterator), PropertyBuiltInMethodDefaults, scriptContext);

deps/chakrashim/core/test/DebuggerCommon/ES6_letconst_eval_strict_fn.js.dbg.baseline

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"locals": {
77
"arguments": {
88
"#__proto__": "Object {...}",
9-
"caller": "Error <large string>",
109
"callee": "Error <large string>",
1110
"length": "number 0",
1211
"Symbol.iterator": "function <large string>"
@@ -22,4 +21,4 @@
2221
"a": "number 1"
2322
}
2423
}
25-
]
24+
]

deps/chakrashim/core/test/es6/classes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ var tests = [
948948
{
949949
name: "Extends expression of a class declaration or expression is strict mode",
950950
body: function() {
951-
var BadClass = class extends function() { arguments.caller; } {};
951+
var BadClass = class extends function() { arguments.callee; } {};
952952
assert.throws(function() { Object.getPrototypeOf(BadClass).arguments; }, TypeError, "The extends expression of a class expression should be parsed in strict mode", "'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context");
953953
assert.throws(function() { new BadClass(); }, TypeError, "New'ing a class with a parent constructor that throws in strict mode, should throw", "'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context");
954954

deps/chakrashim/core/test/strict/05.arguments_sm.baseline

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,6 @@ arguments.callee:setter : function() {
88
[native code]
99
}
1010
arguments.callee:value : undefined
11-
arguments.caller:configurable : false
12-
arguments.caller:enumerable : false
13-
arguments.caller:writable : undefined
14-
arguments.caller:getter : function() {
15-
[native code]
16-
}
17-
arguments.caller:setter : function() {
18-
[native code]
19-
}
20-
arguments.caller:value : undefined
21-
Exception: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
22-
Exception: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
11+
arguments.caller :propDesc undefined
2312
Exception: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
2413
Exception: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context

deps/chakrashim/core/test/strict/19.function_sm.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ Exception: function.caller set TypeError
33
Exception: function.arguments get TypeError
44
Exception: function.arguments set TypeError
55
Return: true true: function.arguments and function.caller descriptors are undefined
6-
Return: true true: arguments.caller and arguments.callee are equal/strictEqual to each other
6+
Return: true true: arguments.caller is not defined and arguments.callee getter and setter are equal/strictEqual to each other
77
Exception: function.caller's value is a strict mode function TypeError

deps/chakrashim/core/test/strict/19.function_sm.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,16 @@ function exceptToString(ee) {
9090

9191
(function Test5() {
9292
"use strict";
93-
var str = "arguments.caller and arguments.callee are equal/strictEqual to each other";
93+
var str = "arguments.caller is not defined and arguments.callee getter and setter are equal/strictEqual to each other";
9494

9595
// Properties on the arguments object.
96-
var argumentsCallerGet = Object.getOwnPropertyDescriptor(arguments, 'caller').get;
97-
var argumentsCallerSet = Object.getOwnPropertyDescriptor(arguments, 'caller').set;
96+
var argumentsCallerDescriptor = Object.getOwnPropertyDescriptor(arguments, 'caller');
9897
var argumentsCalleeGet = Object.getOwnPropertyDescriptor(arguments, 'callee').get;
9998
var argumentsCalleeSet = Object.getOwnPropertyDescriptor(arguments, 'callee').set;
10099

101100
write("Return: " +
102-
(argumentsCallerGet == argumentsCalleeGet && argumentsCallerSet == argumentsCalleeSet &&
103-
argumentsCallerGet == argumentsCallerSet).toString() + " " +
104-
(argumentsCallerGet === argumentsCalleeGet && argumentsCallerSet === argumentsCalleeSet &&
105-
argumentsCallerGet === argumentsCallerSet).toString() + ": " +
101+
(argumentsCallerDescriptor === undefined).toString() + " " +
102+
(argumentsCalleeGet === argumentsCalleeSet).toString() + ": " +
106103
str);
107104
})();
108105

deps/chakrashim/core/test/strict/22.callerCalleeArguments_sm.baseline

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function(){"use strict";echo("hasOwnProperty(caller): ", arguments.hasOwnProperty("caller"));})();
2-
hasOwnProperty(caller): true
2+
hasOwnProperty(caller): false
33

44
var foo = function(){"use strict";};(function(){echo("hasOwnProperty(caller): ", foo.hasOwnProperty("caller"));})();
55
hasOwnProperty(caller): false
@@ -17,7 +17,6 @@ var foo = function(){"use strict";};(function(){"use strict";echo("hasOwnPropert
1717
hasOwnProperty(arguments): false
1818

1919
(function(){"use strict";arguments.caller;})();
20-
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
2120

2221
var foo = function(){"use strict";};(function(){foo.caller;})();
2322
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
@@ -35,7 +34,6 @@ var foo = function(){"use strict";};(function(){"use strict";foo.arguments;})();
3534
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
3635

3736
(function(){"use strict";arguments.caller = 0;})();
38-
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
3937

4038
var foo = function(){"use strict";};(function(){foo.caller = 0;})();
4139
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
@@ -53,7 +51,6 @@ var foo = function(){"use strict";};(function(){"use strict";foo.arguments = 0;}
5351
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
5452

5553
(function(){"use strict";Object.defineProperty(arguments, "caller", {value: 0});})();
56-
TypeError: Cannot redefine non-configurable property 'caller'
5754

5855
var foo = function(){"use strict";};(function(){Object.defineProperty(foo, "caller", {value: 0});})();
5956

@@ -67,8 +64,7 @@ var foo = function(){"use strict";};(function(){Object.defineProperty(foo, "argu
6764
var foo = function(){"use strict";};(function(){"use strict";Object.defineProperty(foo, "arguments", {value: 0});})();
6865

6966
(function(){"use strict";var descriptor = Object.getOwnPropertyDescriptor(arguments, "caller");if(descriptor.hasOwnProperty("get")) safeCall(descriptor.get);if(descriptor.hasOwnProperty("set")) safeCall(descriptor.set);})();
70-
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
71-
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context
67+
TypeError: Unable to get property 'hasOwnProperty' of undefined or null reference
7268

7369
var foo = function(){"use strict";};(function(){var descriptor = Object.getOwnPropertyDescriptor(foo, "caller");if(descriptor.hasOwnProperty("get")) safeCall(descriptor.get);if(descriptor.hasOwnProperty("set")) safeCall(descriptor.set);})();
7470
TypeError: Unable to get property 'hasOwnProperty' of undefined or null reference

0 commit comments

Comments
 (0)