Skip to content

Commit

Permalink
chore: fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Apr 19, 2024
1 parent 0598314 commit 6a3b042
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 @@ -21,15 +21,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 @@ -95,16 +93,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 @@ -475,7 +475,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 6a3b042

Please sign in to comment.