chakra-core / ChakraCore

ChakraCore is an open source Javascript engine with a C API.
MIT License
9.12k stars 1.2k forks source link

Inconsistent output compared with other JS engines when handling global property of RegExp #5508

Closed sunlili closed 4 years ago

sunlili commented 6 years ago

Hello, The following code behaves incorrectly (inconsistent with other engines).

RegExp.prototype.__defineGetter__("global", () => true);
print("BT_FLAG");

In ChakraCore, the output is TypeError: Cannot redefine non-configurable property 'global'

However, in V8 , SpiderMonkey and JSC, output is BT_FLAG

BT group 2018.7.24

MSLaguana commented 6 years ago

This is because we have not yet enabled the ES6 regex prototype properties by default. If you run with -ES6RegexPrototypeProperties then it behaves as expected.

rhuanjl commented 4 years ago

Consolidating as part of #6390