Bug 177813

Summary: RegExp non-standard properties are inconsistent with other browsers
Product: WebKit Reporter: Rick Byers <rbyers>
Component: JavaScriptCoreAssignee: 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
Reported 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?
Attachments
Rick Byers
Comment 1 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.
Radar WebKit Bug Importer
Comment 2 2017-10-07 16:07:34 PDT
Alexey Shvayka
Comment 3 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 ***
Note You need to log in before you can comment on or make changes to this bug.