Bug 177813 - RegExp non-standard properties are inconsistent with other browsers
Summary: RegExp non-standard properties are inconsistent with other browsers
Status: RESOLVED DUPLICATE of bug 220233
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-03 07:22 PDT by Rick Byers
Modified: 2022-02-06 13:34 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Byers 2017-10-03 07:22:19 PDT
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?
Comment 1 Rick Byers 2017-10-03 07:27:50 PDT
Sorry, correction.  They're data accessors on Edge 15 as well, they're just writable=true where safari is writable=false.
Comment 2 Radar WebKit Bug Importer 2017-10-07 16:07:34 PDT
<rdar://problem/34873681>
Comment 3 Alexey Shvayka 2022-02-06 13:34:39 PST
(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 ***