check _objectId in releaseHandle

This commit is contained in:
Yury Semikhatsky 2025-02-24 09:49:26 -08:00
parent e8b601ad3d
commit fdda58d738
4 changed files with 12 additions and 4 deletions

View file

@ -122,9 +122,11 @@ export class BidiExecutionContext implements js.ExecutionContextDelegate {
}
async releaseHandle(handle: js.JSHandle): Promise<void> {
if (!handle._objectId)
return;
await this._session.send('script.disown', {
target: this._target,
handles: [handle._objectId!],
handles: [handle._objectId],
});
}

View file

@ -89,7 +89,9 @@ export class CRExecutionContext implements js.ExecutionContextDelegate {
}
async releaseHandle(handle: js.JSHandle): Promise<void> {
await releaseObject(this._client, handle._objectId!);
if (!handle._objectId)
return;
await releaseObject(this._client, handle._objectId);
}
}

View file

@ -83,9 +83,11 @@ export class FFExecutionContext implements js.ExecutionContextDelegate {
}
async releaseHandle(handle: js.JSHandle): Promise<void> {
if (!handle._objectId)
return;
await this._session.send('Runtime.disposeObject', {
executionContextId: this._executionContextId,
objectId: handle._objectId!,
objectId: handle._objectId,
});
}
}

View file

@ -102,7 +102,9 @@ export class WKExecutionContext implements js.ExecutionContextDelegate {
}
async releaseHandle(handle: js.JSHandle): Promise<void> {
await this._session.send('Runtime.releaseObject', { objectId: handle._objectId! });
if (!handle._objectId)
return;
await this._session.send('Runtime.releaseObject', { objectId: handle._objectId });
}
}