Skip to content

Commit f475e21

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[environment] Add prototypes to WeakMap, WeakRef and WeakSet
Bug: 487347678 Change-Id: I11dd214d888556ded07b3d41afe387ae5c4c79cc Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9052181 Reviewed-by: Danylo Mocherniuk <mdanylo@google.com> Commit-Queue: Danylo Mocherniuk <mdanylo@google.com> Auto-Submit: Matthias Liedtke <mliedtke@google.com>
1 parent 32714e6 commit f475e21

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

Sources/Fuzzilli/Environment/JavaScriptEnvironment.swift

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,15 @@ public class JavaScriptEnvironment: ComponentBase {
371371
registerObjectGroup(.jsMapPrototype)
372372
registerObjectGroup(.jsMapConstructor)
373373
registerObjectGroup(.jsWeakMaps)
374+
registerObjectGroup(.jsWeakMapPrototype)
375+
registerObjectGroup(.jsWeakMapConstructor)
374376
registerObjectGroup(.jsSets)
375377
registerObjectGroup(.jsWeakSets)
378+
registerObjectGroup(.jsWeakSetPrototype)
379+
registerObjectGroup(.jsWeakSetConstructor)
376380
registerObjectGroup(.jsWeakRefs)
381+
registerObjectGroup(.jsWeakRefPrototype)
382+
registerObjectGroup(.jsWeakRefConstructor)
377383
registerObjectGroup(.jsFinalizationRegistrys)
378384
registerObjectGroup(.jsFinalizationRegistryPrototype)
379385
registerObjectGroup(.jsFinalizationRegistryConstructor)
@@ -1217,16 +1223,16 @@ public extension ILType {
12171223
static let jsMapConstructor = ILType.constructor([.object()] => .jsMap) + .object(ofGroup: "MapConstructor", withProperties: ["prototype"], withMethods: ["groupBy"])
12181224

12191225
/// Type of the JavaScript WeakMap constructor builtin.
1220-
static let jsWeakMapConstructor = ILType.constructor([.object()] => .jsWeakMap)
1226+
static let jsWeakMapConstructor = ILType.constructor([.object()] => .jsWeakMap) + .object(ofGroup: "WeakMapConstructor", withProperties: ["prototype"])
12211227

12221228
/// Type of the JavaScript Set constructor builtin.
12231229
static let jsSetConstructor = ILType.constructor([.object()] => .jsSet)
12241230

12251231
/// Type of the JavaScript WeakSet constructor builtin.
1226-
static let jsWeakSetConstructor = ILType.constructor([.object()] => .jsWeakSet)
1232+
static let jsWeakSetConstructor = ILType.constructor([.object()] => .jsWeakSet) + .object(ofGroup: "WeakSetConstructor", withProperties: ["prototype"])
12271233

12281234
/// Type of the JavaScript WeakRef constructor builtin.
1229-
static let jsWeakRefConstructor = ILType.constructor([.object()] => .jsWeakRef)
1235+
static let jsWeakRefConstructor = ILType.constructor([.object()] => .jsWeakRef) + .object(ofGroup: "WeakRefConstructor", withProperties: ["prototype"])
12301236

12311237
/// Type of the JavaScript FinalizationRegistry constructor builtin.
12321238
static let jsFinalizationRegistryConstructor = ILType.constructor([.function()] => .jsFinalizationRegistry) + .object(ofGroup: "FinalizationRegistryConstructor", withProperties: ["prototype"])
@@ -1704,6 +1710,19 @@ public extension ObjectGroup {
17041710
]
17051711
)
17061712

1713+
static let jsWeakMapPrototype = createPrototypeObjectGroup(jsWeakMaps,
1714+
constructor: .jsWeakMapConstructor)
1715+
1716+
static let jsWeakMapConstructor = ObjectGroup(
1717+
name: "WeakMapConstructor",
1718+
constructorPath: "WeakMap",
1719+
instanceType: .jsWeakMapConstructor,
1720+
properties: [
1721+
"prototype" : jsWeakMapPrototype.instanceType
1722+
],
1723+
methods: [:]
1724+
)
1725+
17071726
/// ObjectGroup modelling JavaScript Set objects
17081727
static let jsSets = ObjectGroup(
17091728
name: "Set",
@@ -1735,6 +1754,19 @@ public extension ObjectGroup {
17351754
]
17361755
)
17371756

1757+
static let jsWeakSetPrototype = createPrototypeObjectGroup(jsWeakSets,
1758+
constructor: .jsWeakSetConstructor)
1759+
1760+
static let jsWeakSetConstructor = ObjectGroup(
1761+
name: "WeakSetConstructor",
1762+
constructorPath: "WeakSet",
1763+
instanceType: .jsWeakSetConstructor,
1764+
properties: [
1765+
"prototype" : jsWeakSetPrototype.instanceType
1766+
],
1767+
methods: [:]
1768+
)
1769+
17381770
/// ObjectGroup modelling JavaScript WeakRef objects
17391771
static let jsWeakRefs = ObjectGroup(
17401772
name: "WeakRef",
@@ -1745,6 +1777,19 @@ public extension ObjectGroup {
17451777
]
17461778
)
17471779

1780+
static let jsWeakRefPrototype = createPrototypeObjectGroup(jsWeakRefs,
1781+
constructor: .jsWeakRefConstructor)
1782+
1783+
static let jsWeakRefConstructor = ObjectGroup(
1784+
name: "WeakRefConstructor",
1785+
constructorPath: "WeakRef",
1786+
instanceType: .jsWeakRefConstructor,
1787+
properties: [
1788+
"prototype" : jsWeakRefPrototype.instanceType
1789+
],
1790+
methods: [:]
1791+
)
1792+
17481793
/// ObjectGroup modelling JavaScript FinalizationRegistry objects
17491794
static let jsFinalizationRegistrys = ObjectGroup(
17501795
name: "FinalizationRegistry",

0 commit comments

Comments
 (0)