refactor: reuse otherTarget on createTarget (#10957)
This commit is contained in:
parent
af42663edb
commit
3fc8da9955
@ -275,7 +275,7 @@ export class CdpBrowser extends BrowserBase {
|
|||||||
const createSession = (isAutoAttachEmulated: boolean) => {
|
const createSession = (isAutoAttachEmulated: boolean) => {
|
||||||
return this.#connection._createSession(targetInfo, isAutoAttachEmulated);
|
return this.#connection._createSession(targetInfo, isAutoAttachEmulated);
|
||||||
};
|
};
|
||||||
const targetForFilter = new OtherTarget(
|
const otherTarget = new OtherTarget(
|
||||||
targetInfo,
|
targetInfo,
|
||||||
session,
|
session,
|
||||||
context,
|
context,
|
||||||
@ -294,7 +294,7 @@ export class CdpBrowser extends BrowserBase {
|
|||||||
this.#screenshotTaskQueue
|
this.#screenshotTaskQueue
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (this.#isPageTargetCallback(targetForFilter)) {
|
if (this.#isPageTargetCallback(otherTarget)) {
|
||||||
return new PageTarget(
|
return new PageTarget(
|
||||||
targetInfo,
|
targetInfo,
|
||||||
session,
|
session,
|
||||||
@ -318,13 +318,7 @@ export class CdpBrowser extends BrowserBase {
|
|||||||
createSession
|
createSession
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return new OtherTarget(
|
return otherTarget;
|
||||||
targetInfo,
|
|
||||||
session,
|
|
||||||
context,
|
|
||||||
this.#targetManager,
|
|
||||||
createSession
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#onAttachedToTarget = async (target: CdpTarget) => {
|
#onAttachedToTarget = async (target: CdpTarget) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user