mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(puppeteer-core): target interceptor is not async (#9430)
I found that the only call to `addTargetInterceptor` passes
`onAttachedToTarget` and is not async.
I also found a typo 🤓
This commit is contained in:
parent
65aedcdfc4
commit
e3e9cc622a
@ -353,7 +353,7 @@ export class ChromeTargetManager extends EventEmitter implements TargetManager {
|
|||||||
// present in #attachedTargetsBySessionId.
|
// present in #attachedTargetsBySessionId.
|
||||||
assert(this.#attachedTargetsBySessionId.has(parentSession.id()));
|
assert(this.#attachedTargetsBySessionId.has(parentSession.id()));
|
||||||
}
|
}
|
||||||
await interceptor(
|
interceptor(
|
||||||
target,
|
target,
|
||||||
parentSession instanceof Connection
|
parentSession instanceof Connection
|
||||||
? null
|
? null
|
||||||
|
@ -270,7 +270,7 @@ export class CDPPage extends Page {
|
|||||||
this.emit(PageEmittedEvents.WorkerDestroyed, worker);
|
this.emit(PageEmittedEvents.WorkerDestroyed, worker);
|
||||||
};
|
};
|
||||||
|
|
||||||
#onAttachedToTarget = async (createdTarget: Target) => {
|
#onAttachedToTarget = (createdTarget: Target) => {
|
||||||
this.#frameManager.onAttachedToTarget(createdTarget);
|
this.#frameManager.onAttachedToTarget(createdTarget);
|
||||||
if (createdTarget._getTargetInfo().type === 'worker') {
|
if (createdTarget._getTargetInfo().type === 'worker') {
|
||||||
const session = createdTarget._session();
|
const session = createdTarget._session();
|
||||||
|
@ -33,7 +33,7 @@ export type TargetFactory = (
|
|||||||
export type TargetInterceptor = (
|
export type TargetInterceptor = (
|
||||||
createdTarget: Target,
|
createdTarget: Target,
|
||||||
parentTarget: Target | null
|
parentTarget: Target | null
|
||||||
) => Promise<void>;
|
) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TargetManager encapsulates all interactions with CDP targets and is
|
* TargetManager encapsulates all interactions with CDP targets and is
|
||||||
|
@ -229,7 +229,7 @@ describe('AriaQueryHandler', () => {
|
|||||||
await page.waitForSelector('aria/[role="button"]');
|
await page.waitForSelector('aria/[role="button"]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work for ElementHandler.waitForSelector', async () => {
|
it('should work for ElementHandle.waitForSelector', async () => {
|
||||||
const {page, server} = getTestState();
|
const {page, server} = getTestState();
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user