Bug 177813
| Summary: | RegExp non-standard properties are inconsistent with other browsers | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Rick Byers <rbyers> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | ashvayka, benjamin, cdumez, msaboff, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Rick Byers
The non-standard properties on RegExp (eg. lastMatch, lastParen, leftContext, rightContext) are data properties in Safari, but accessor properties in current versions of Chrome, Firefox and Edge. Here's a simple repro: http://output.jsbin.com/yubojom
On Chrome, Edge and Firefox it prints:
RegExp.lastMatch: get,set,enumerable,configurable
RegExp.lastParen: get,set,enumerable,configurable
RegExp.leftContext: get,set,enumerable,configurable
RegExp.rightContext: get,set,enumerable,configurable
On Safari it prints:
RegExp.lastMatch: value,writable,enumerable,configurable
RegExp.lastParen: value,writable,enumerable,configurable
RegExp.leftContext: value,writable,enumerable,configurable
RegExp.rightContext: value,writable,enumerable,configurable
Unfortunately, despite being widely supported, these APIs do not appear to be standardized (https://tc39.github.io/ecma262/#sec-regexp-constructor). The difference is unlikely to matter much in practice, but in theory it could cause interop issue. One specific (though rather special) example is here: https://github.com/GoogleChrome/confluence/issues/202. If it's trivial for JSC to change to match the other JS engines, perhaps it's worth doing?
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Rick Byers
Sorry, correction. They're data accessors on Edge 15 as well, they're just writable=true where safari is writable=false.
Radar WebKit Bug Importer
<rdar://problem/34873681>
Alexey Shvayka
(In reply to Rick Byers from comment #0)
> Unfortunately, despite being widely supported, these APIs do not appear to
> be standardized (https://tc39.github.io/ecma262/#sec-regexp-constructor).
> The difference is unlikely to matter much in practice, but in theory it
> could cause interop issue. One specific (though rather special) example is
> here: https://github.com/GoogleChrome/confluence/issues/202. If it's
> trivial for JSC to change to match the other JS engines, perhaps it's worth
> doing?
Thanks for the report. These APIs are now being standardized (https://github.com/tc39/proposal-regexp-legacy-features) as an accessors, and were implemented as such in r280460.
*** This bug has been marked as a duplicate of bug 220233 ***