Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
E0010: Function.prototype.bind() creates functions with additional caller and arguments properties
The specification states:
-
4.3.34 own property property that is directly contained by its object 8.2.2 CreateIntrinsics ( realmRec ) ... ... 9. Let funcProto be CreateBuiltinFunction(realmRec, ... noSteps, objProto). 10. Set intrinsics.[[%FunctionPrototype%]] to funcProto. 11. Call thrower.[[SetPrototypeOf]](funcProto). 12. Perform AddRestrictedFunctionProperties(funcProto, realmRec). 9.2.5 FunctionCreate (kind, ParameterList, Body, Scope, Strict [, prototype]) ... 1. If the prototype argument was not passed, then a. Let prototype be the intrinsic object %FunctionPrototype%. ... AddRestrictedFunctionProperties ( F, realm ) ... ... 3. Perform ! DefinePropertyOrThrow(F, "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: true}). 4. Return ! DefinePropertyOrThrow(F, "arguments", PropertyDescriptor {[[Get]]: thrower, [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: true}). 9.3 Built-in Function Objects ... Unless otherwise specified every built-in function object has the %FunctionPrototype% object as the initial value of its [[Prototype]] internal slot. 9.4.1.3 BoundFunctionCreate (targetFunction, boundThis, boundArgs) ... ... 2. Let proto ? be targetFunction.[[GetPrototypeOf]](). ... 7. Set obj.[[Prototype]] to proto. 19.2.3.2 Function.prototype.bind ( thisArg , ...args) ... ... 4. Let F be ? BoundFunctionCreate(Target, thisArg, args).
EdgeHTML Mode
Function.prototype.bind()
creates functions with additional caller
and arguments
properties. These properties should be
inherited from the Function prototype (%FunctionPrototype%
).
The 5.1 Edition of the ECMAScript® Language Specification of
the version of the spec said that bind
should add
caller
and Arguments
own properties to the created bound function. However, later specifications do
not.
These are the relevant lines from the 5.1 Edition:
15.3.4.5 Function.prototype.bind (thisArg [, arg1 [, arg2, ...]])
...
...
20. Call the [[DefineOwnProperty]] internal method of F with arguments "caller",
PropertyDescriptor.
{[[Get]]: thrower, [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
and false.
21. Call the [[DefineOwnProperty]] internal method of F with arguments "arguments",
PropertyDescriptor,
{[[Get]]: thrower, [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
and false.