chore: use deep serialization zero for Handles (#10848)

This commit is contained in:
Nikolay Vitkov 2023-09-05 10:39:52 +02:00 committed by GitHub
parent 34953dc3f0
commit 7ac04eb2e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,6 +140,12 @@ export class Realm extends EventEmitter {
const resultOwnership = returnByValue
? Bidi.Script.ResultOwnership.None
: Bidi.Script.ResultOwnership.Root;
const serializationOptions: Bidi.Script.SerializationOptions = returnByValue
? {}
: {
maxObjectDepth: 0,
maxDomDepth: 0,
};
if (isString(pageFunction)) {
const expression = SOURCE_URL_REGEX.test(pageFunction)
? pageFunction
@ -151,6 +157,7 @@ export class Realm extends EventEmitter {
resultOwnership,
awaitPromise: true,
userActivation: true,
serializationOptions,
});
} else {
let functionDeclaration = stringifyFunction(pageFunction);
@ -168,6 +175,7 @@ export class Realm extends EventEmitter {
resultOwnership,
awaitPromise: true,
userActivation: true,
serializationOptions,
});
}