Bug 204067 - RegExpBuiltinExec should create "groups" property unconditionally
Summary: RegExpBuiltinExec should create "groups" property unconditionally
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Minor
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 202475 204264
  Show dependency treegraph
 
Reported: 2019-11-11 06:03 PST by Alexey Shvayka
Modified: 2019-11-15 16:59 PST (History)
9 users (show)

See Also:


Attachments
Patch (15.45 KB, patch)
2019-11-11 06:45 PST, Alexey Shvayka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Shvayka 2019-11-11 06:03:44 PST
Test case:
  /\d/.exec("1").hasOwnProperty("groups")

Expected:
  true

Actual:
  false

Also, "groups" object should have `null` [[Prototype]].

Discussion: https://github.com/tc39/proposal-regexp-named-groups/issues/34
ECMA262: https://tc39.es/ecma262/#sec-regexpbuiltinexec (step 24)
Test262:
  https://test262.report/browse/built-ins/RegExp/named-groups/groups-object-undefined.js
  https://test262.report/browse/built-ins/RegExp/named-groups/groups-object.js
Comment 1 Alexey Shvayka 2019-11-11 06:45:43 PST
Created attachment 383266 [details]
Patch
Comment 2 Alexey Shvayka 2019-11-11 07:11:28 PST
I am adding this bug as a blocker of RegExp Match Indices proposal (https://bugs.webkit.org/show_bug.cgi?id=202475), because "indices" property should be created after "groups" (order is observable), and the way we currently add properties in RegExpMatchesArray.cpp/createStructureImpl will make that unnecessarily tricky.
Comment 3 Ross Kirsling 2019-11-12 13:26:24 PST
Comment on attachment 383266 [details]
Patch

Nice!
Comment 4 WebKit Commit Bot 2019-11-12 14:09:44 PST
Comment on attachment 383266 [details]
Patch

Clearing flags on attachment: 383266

Committed r252374: <https://trac.webkit.org/changeset/252374>
Comment 5 WebKit Commit Bot 2019-11-12 14:09:45 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2019-11-12 14:10:16 PST
<rdar://problem/57130089>