chakra-core / chakra-core/ChakraCore

Wrong Realization of String.prototype.toLocaleLowerCase

Open
#6,173 0 comments 0 reactions 0 assignees View on GitHub
Bug Severity: 2
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Running code in ch version 1.11.9.0, the output is different from other js engines.

code:
```
let val = 10;
let handler_1 = {
get: function(oTarget, sKey) {
if (sKey.toString() == 'length') {
print("in get length");
val = 1;
}
return Reflect.get(oTarget, sKey);
},
};
let p_1 = new Proxy({}, handler_1);
var newStr = String.prototype.toLocaleLowerCase.call({}, p_1);

print("BT_FLAG");
print(val);
```

Output of sm, v8, jsc:
```
in get length
BT_FLAG
1
```
Output of ch:
```
BT_FLAG
10
```
In the specification(https://tc39.github.io/ecma402/#sec-canonicalizelocalelist), Get(locales, “length”) shows that we can use Proxy to trap 'get length',

BT group
2019.6.24

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.