Skip to content

Commit

Permalink
fix: make sure discovery happens before auto-attach (#11100)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Oct 9, 2023
1 parent b1eee92 commit 9ce204e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/puppeteer-core/src/cdp/ChromeTargetManager.ts
Expand Up @@ -127,14 +127,6 @@ export class ChromeTargetManager
this.#onSessionDetached
);
this.#setupAttachmentListeners(this.#connection);

this.#connection
.send('Target.setDiscoverTargets', {
discover: true,
filter: this.#discoveryFilter,
})
.then(this.#storeExistingTargetsForInit)
.catch(debugError);
}

#storeExistingTargetsForInit = () => {
Expand Down Expand Up @@ -163,6 +155,13 @@ export class ChromeTargetManager
};

async initialize(): Promise<void> {
await this.#connection.send('Target.setDiscoverTargets', {
discover: true,
filter: this.#discoveryFilter,
});

this.#storeExistingTargetsForInit();

await this.#connection.send('Target.setAutoAttach', {
waitForDebuggerOnStart: true,
flatten: true,
Expand Down

0 comments on commit 9ce204e

Please sign in to comment.