Skip to content

Commit 01ae8ac

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[environment] Register DisposableStack and its properties, methods and instance type
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DisposableStack Bug: 487347678 Change-Id: I85e523864482d16d5b1f2a1c9d0cd3ba0cb77613 Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9051796 Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@google.com> Auto-Submit: Matthias Liedtke <mliedtke@google.com> Reviewed-by: Rezvan Mahdavi Hezaveh <rezvan@google.com>
1 parent a350d0f commit 01ae8ac

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Sources/Fuzzilli/Environment/JavaScriptEnvironment.swift

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ public class JavaScriptEnvironment: ComponentBase {
343343
registerObjectGroup(.jsWeakSets)
344344
registerObjectGroup(.jsWeakRefs)
345345
registerObjectGroup(.jsFinalizationRegistrys)
346+
registerObjectGroup(.jsDisposableStacks)
347+
registerObjectGroup(.jsDisposableStackPrototype)
348+
registerObjectGroup(.jsDisposableStackConstructor)
346349
registerObjectGroup(.jsArrayBuffers)
347350
registerObjectGroup(.jsSharedArrayBuffers)
348351
for variant in ["Uint8Array", "Int8Array", "Uint16Array", "Int16Array", "Uint32Array", "Int32Array", "Float16Array", "Float32Array", "Float64Array", "Uint8ClampedArray", "BigInt64Array", "BigUint64Array"] {
@@ -596,6 +599,7 @@ public class JavaScriptEnvironment: ComponentBase {
596599
registerBuiltin("WeakSet", ofType: .jsWeakSetConstructor)
597600
registerBuiltin("WeakRef", ofType: .jsWeakRefConstructor)
598601
registerBuiltin("FinalizationRegistry", ofType: .jsFinalizationRegistryConstructor)
602+
registerBuiltin("DisposableStack", ofType: .jsDisposableStackConstructor)
599603
registerBuiltin("Math", ofType: .jsMathObject)
600604
registerBuiltin("JSON", ofType: .jsJSONObject)
601605
registerBuiltin("Reflect", ofType: .jsReflectObject)
@@ -1063,6 +1067,9 @@ public extension ILType {
10631067
/// Type of a JavaScript FinalizationRegistry object.
10641068
static let jsFinalizationRegistry = ILType.object(ofGroup: "FinalizationRegistry", withMethods: ["register", "unregister"])
10651069

1070+
/// Type of a JavaScript DisposableStack object.
1071+
static let jsDisposableStack = ILType.object(ofGroup: "DisposableStack", withProperties: ["disposed"], withMethods: ["dispose", "use", "adopt", "defer", "move"])
1072+
10661073
/// Type of a JavaScript ArrayBuffer object.
10671074
static let jsArrayBuffer = ILType.object(ofGroup: "ArrayBuffer", withProperties: ["byteLength", "maxByteLength", "resizable"], withMethods: ["resize", "slice", "transfer", "transferToFixedLength", "transferToImmutable"])
10681075

@@ -1167,6 +1174,9 @@ public extension ILType {
11671174
/// Type of the JavaScript FinalizationRegistry constructor builtin.
11681175
static let jsFinalizationRegistryConstructor = ILType.constructor([.function()] => .jsFinalizationRegistry)
11691176

1177+
/// Type of the JavaScript DisposableStack constructor builtin.
1178+
static let jsDisposableStackConstructor = ILType.constructor([] => .jsDisposableStack) + .object(ofGroup: "DisposableStackConstructor", withProperties: ["prototype"])
1179+
11701180
/// Type of the JavaScript Math constructor builtin.
11711181
static let jsMathObject = ILType.object(ofGroup: "Math", withProperties: ["E", "PI"], withMethods: ["abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "atan2", "ceil", "cbrt", "expm1", "clz32", "cos", "cosh", "exp", "floor", "fround", "f16round", "hypot", "imul", "log", "log1p", "log2", "log10", "max", "min", "pow", "random", "round", "sign", "sin", "sinh", "sqrt", "sumPrecise", "tan", "tanh", "trunc"])
11721182

@@ -1666,6 +1676,35 @@ public extension ObjectGroup {
16661676
]
16671677
)
16681678

1679+
/// ObjectGroup modelling JavaScript DisposableStack objects
1680+
static let jsDisposableStacks = ObjectGroup(
1681+
name: "DisposableStack",
1682+
instanceType: .jsDisposableStack,
1683+
properties: [
1684+
"disposed" : .boolean
1685+
],
1686+
methods: [
1687+
"dispose" : [] => .undefined,
1688+
"use" : [.jsAnything] => .jsAnything,
1689+
"adopt" : [.jsAnything, .function()] => .jsAnything,
1690+
"defer" : [.function()] => .undefined,
1691+
"move" : [] => .jsDisposableStack,
1692+
]
1693+
)
1694+
1695+
static let jsDisposableStackPrototype = createPrototypeObjectGroup(jsDisposableStacks,
1696+
constructor: .jsDisposableStackConstructor)
1697+
1698+
static let jsDisposableStackConstructor = ObjectGroup(
1699+
name: "DisposableStackConstructor",
1700+
constructorPath: "DisposableStack",
1701+
instanceType: .jsDisposableStackConstructor,
1702+
properties: [
1703+
"prototype" : jsDisposableStackPrototype.instanceType
1704+
],
1705+
methods: [:]
1706+
)
1707+
16691708
/// ObjectGroup modelling JavaScript ArrayBuffer objects
16701709
static let jsArrayBuffers = ObjectGroup(
16711710
name: "ArrayBuffer",

0 commit comments

Comments
 (0)