Skip to content

Commit 32714e6

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[environment] RegExp: Properly type prototype and add more properties
The added properties are deprecated, but in the end it matters what we ship, not if it's deprecated. Bug: 487347678 Change-Id: I3e027d8a1ece8a6bdf31929fd3952d2589cc0bfa Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9052180 Auto-Submit: Matthias Liedtke <mliedtke@google.com> Commit-Queue: Danylo Mocherniuk <mdanylo@google.com> Reviewed-by: Danylo Mocherniuk <mdanylo@google.com>
1 parent bae3163 commit 32714e6

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

Sources/Fuzzilli/Environment/JavaScriptEnvironment.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ public class JavaScriptEnvironment: ComponentBase {
402402
registerObjectGroup(.jsStringPrototype)
403403
registerObjectGroup(.jsSymbolConstructor)
404404
registerObjectGroup(.jsBigIntConstructor)
405+
registerObjectGroup(.jsRegExpPrototype)
405406
registerObjectGroup(.jsRegExpConstructor)
406407
registerObjectGroup(.jsBooleanConstructor)
407408
registerObjectGroup(.jsNumberConstructor)
@@ -1173,7 +1174,7 @@ public extension ILType {
11731174
static let jsBigIntConstructor = ILType.function([.number] => .bigint) + .object(ofGroup: "BigIntConstructor", withProperties: ["prototype"], withMethods: ["asIntN", "asUintN"])
11741175

11751176
/// Type of the JavaScript RegExp constructor builtin.
1176-
static let jsRegExpConstructor = ILType.functionAndConstructor([.string] => .jsRegExp) + .object(ofGroup: "RegExpConstructor", withProperties: ["prototype"], withMethods: ["escape"])
1177+
static let jsRegExpConstructor = ILType.functionAndConstructor([.string] => .jsRegExp) + .object(ofGroup: "RegExpConstructor", withProperties: ["prototype", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$_", "input", "lastMatch", "lastParen", "leftContext"], withMethods: ["escape"])
11771178

11781179
/// Type of a JavaScript Error object of the given variant.
11791180
static func jsError(_ variant: String) -> ILType {
@@ -2221,13 +2222,29 @@ public extension ObjectGroup {
22212222
]
22222223
)
22232224

2225+
static let jsRegExpPrototype = createPrototypeObjectGroup(jsRegExps, constructor: .jsRegExpConstructor)
2226+
22242227
/// Object group modelling the JavaScript RegExp constructor builtin
22252228
static let jsRegExpConstructor = ObjectGroup(
22262229
name: "RegExpConstructor",
22272230
constructorPath: "RegExp",
22282231
instanceType: .jsRegExpConstructor,
22292232
properties: [
2230-
"prototype" : .object()
2233+
"prototype" : jsRegExpPrototype.instanceType,
2234+
"$1": .jsString,
2235+
"$2": .jsString,
2236+
"$3": .jsString,
2237+
"$4": .jsString,
2238+
"$5": .jsString,
2239+
"$6": .jsString,
2240+
"$7": .jsString,
2241+
"$8": .jsString,
2242+
"$9": .jsString,
2243+
"$_": .jsString,
2244+
"input": .jsString,
2245+
"lastMatch": .jsString,
2246+
"lastParen": .jsString,
2247+
"leftContext": .jsString,
22312248
],
22322249
methods: [
22332250
"escape" : [.string] => .jsString,

0 commit comments

Comments
 (0)