New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
HW: ----
NextAction: ----
OS: ----
Priority: 2
Type: Bug



Sign in to add a comment

Function#arguments and Function#caller break the invariability of nonconfigurable, nonwritable properties

Reported by claude.p...@gmail.com, May 26 2016

Issue description

According to [ES6 6.7.1.3] Invariants of the Essential Internal Methods:

     If a property P is described as a data property with Desc.[[Value]] equal to v and Desc.[[Writable]] and Desc.[[Configurable]] are both false, then the SameValue must be returned for the Desc.[[Value]] attribute of the property on all future calls to [[GetOwnProperty]] ( P ).

[ES6 6.7.1.3]: http://www.ecma-international.org/ecma-262/6.0/#sec-invariants-of-the-essential-internal-methods


Testcase against `Function#arguments`

```js
function f() { return Object.getOwnPropertyDescriptor(f, 'arguments'); }
Object.getOwnPropertyDescriptor(f, 'arguments');
// value: null, writable: false, configurable: false
f();
// value: Arguments[], writable: false, configurable: false
```


Testcase against `Function#caller`

```js
function g() { return Object.getOwnPropertyDescriptor(g, 'caller'); }
function h() { return g(); }
Object.getOwnPropertyDescriptor(g, 'caller');
// value: null, writable: false, configurable: false
h();
// value: function h(), writable: false, configurable: false
```


Suggested fix: Use getters.

 
To be clear: it concerns the own properties of sloppy-mode functions, not those found on Function.prototype.
Components: Language
Labels: Harmony
Status: Available (was: Untriaged)
Labels: Priority-2
Cc: littledan@chromium.org rossberg@chromium.org
 Issue 6049  has been merged into this issue.

Sign in to add a comment