Bug 151348
Summary: | Nonstandard RegExp own properties do not observe invariability of nonwritable, nonconfigurable property | ||
---|---|---|---|
Product: | WebKit | Reporter: | Claude Pache <claude.pache> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | ashvayka, ggaren, msaboff |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Claude Pache
Testcase:
> Object.getOwnPropertyDescriptor(RegExp, 'lastMatch')
< {value: "", writable: false, enumerable: true, configurable: false}
> /a/.exec('a')
> Object.getOwnPropertyDescriptor(RegExp, 'lastMatch')
< {value: "a", writable: false, enumerable: true, configurable: false}
The value of the property changes even when it is marked as nonwritable and nonconfigurable.
This must not be the case; for reference, see:
http://www.ecma-international.org/ecma-262/6.0/#sec-invariants-of-the-essential-internal-methods
paragraph [[GetOwnProperty]] (P), third bullet
The best thing to do, here, is to use an accessor property.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Shvayka
Thank you for detailed report and your effort on https://github.com/tc39/proposal-regexp-legacy-features proposal, Claude!
Legacy RegExp field are being turned into accessors in https://bugs.webkit.org/show_bug.cgi?id=220233.
*** This bug has been marked as a duplicate of bug 220233 ***