fix: make sure discovery happens before auto-attach (#11100)

This commit is contained in:
Alex Rudenko 2023-10-09 13:16:12 +02:00 committed by GitHub
parent b1eee926cc
commit 9ce204e27e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,14 +127,6 @@ export class ChromeTargetManager
this.#onSessionDetached this.#onSessionDetached
); );
this.#setupAttachmentListeners(this.#connection); this.#setupAttachmentListeners(this.#connection);
this.#connection
.send('Target.setDiscoverTargets', {
discover: true,
filter: this.#discoveryFilter,
})
.then(this.#storeExistingTargetsForInit)
.catch(debugError);
} }
#storeExistingTargetsForInit = () => { #storeExistingTargetsForInit = () => {
@ -163,6 +155,13 @@ export class ChromeTargetManager
}; };
async initialize(): Promise<void> { async initialize(): Promise<void> {
await this.#connection.send('Target.setDiscoverTargets', {
discover: true,
filter: this.#discoveryFilter,
});
this.#storeExistingTargetsForInit();
await this.#connection.send('Target.setAutoAttach', { await this.#connection.send('Target.setAutoAttach', {
waitForDebuggerOnStart: true, waitForDebuggerOnStart: true,
flatten: true, flatten: true,