chakra-core / chakra-core/ChakraCore

Own "arguments" and "caller" properties of non-strict functions don't observe the invariability of nonconfigurable, nonwritable properties

Open
#1,048 5 comments 0 reactions 1 assignee Claimed by @akroshg View on GitHub
Bug Severity: 2
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Only tested in a stable Edge release. Please confirm.

According to [ES6 6.1.7.3](http://www.ecma-international.org/ecma-262/6.0/#sec-invariants-of-the-essential-internal-methods) 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 ).

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.