Skip to content

Commit

Permalink
chore: fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Mar 27, 2024
1 parent 2eced38 commit f6b24ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
16 changes: 3 additions & 13 deletions packages/puppeteer-core/src/bidi/CDPSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ export class BidiCdpSession extends CDPSession {
static sessions = new Map<string, BidiCdpSession>();

#detached = false;
#userCreated: boolean;
readonly #connection: BidiConnection | undefined = undefined;
readonly #sessionId = Deferred.create<string>();
readonly frame: BidiFrame;

constructor(frame: BidiFrame, sessionId?: string, userCreated = false) {
constructor(frame: BidiFrame, sessionId?: string) {
super();
this.frame = frame;
this.#userCreated = userCreated;
if (!this.frame.page().browser().cdpSupported) {
return;
}
Expand Down Expand Up @@ -89,16 +87,8 @@ export class BidiCdpSession extends CDPSession {
return;
}

try {
if (this.#userCreated) {
await this.frame.client.send('Target.detachFromTarget', {
sessionId: this.id(),
});
}
} finally {
BidiCdpSession.sessions.delete(this.id());
this.#detached = true;
}
BidiCdpSession.sessions.delete(this.id());
this.#detached = true;
}

override id(): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/bidi/Frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ export class BidiFrame extends Frame {
flatten: true,
});
await this.browsingContext.subscribe([Bidi.ChromiumBidi.BiDiModule.Cdp]);
return new BidiCdpSession(this, sessionId, true);
return new BidiCdpSession(this, sessionId);
}

@throwIfDetached
Expand Down

0 comments on commit f6b24ef

Please sign in to comment.