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:
Darío Kondratiuk 2022-12-17 14:47:21 -03:00 committed by GitHub
parent 65aedcdfc4
commit e3e9cc622a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -353,7 +353,7 @@ export class ChromeTargetManager extends EventEmitter implements TargetManager {
// present in #attachedTargetsBySessionId.
assert(this.#attachedTargetsBySessionId.has(parentSession.id()));
}
await interceptor(
interceptor(
target,
parentSession instanceof Connection
? null

View File

@ -270,7 +270,7 @@ export class CDPPage extends Page {
this.emit(PageEmittedEvents.WorkerDestroyed, worker);
};
#onAttachedToTarget = async (createdTarget: Target) => {
#onAttachedToTarget = (createdTarget: Target) => {
this.#frameManager.onAttachedToTarget(createdTarget);
if (createdTarget._getTargetInfo().type === 'worker') {
const session = createdTarget._session();

View File

@ -33,7 +33,7 @@ export type TargetFactory = (
export type TargetInterceptor = (
createdTarget: Target,
parentTarget: Target | null
) => Promise<void>;
) => void;
/**
* TargetManager encapsulates all interactions with CDP targets and is

View File

@ -229,7 +229,7 @@ describe('AriaQueryHandler', () => {
await page.waitForSelector('aria/[role="button"]');
});
it('should work for ElementHandler.waitForSelector', async () => {
it('should work for ElementHandle.waitForSelector', async () => {
const {page, server} = getTestState();
await page.goto(server.EMPTY_PAGE);
await page.evaluate(() => {