Bug 204067

Summary: RegExpBuiltinExec should create "groups" property unconditionally
Product: WebKit Reporter: Alexey Shvayka <ashvayka>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Minor CC: commit-queue, ews-watchlist, keith_miller, mark.lam, msaboff, ross.kirsling, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 202475, 204264    
Attachments:
Description Flags
Patch none

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>