Skip to content

Commit

Permalink
fix(puppeteer-core): target interceptor is not async (#9430)
Browse files Browse the repository at this point in the history
I found that the only call to `addTargetInterceptor` passes
`onAttachedToTarget` and is not async.
I also found a typo 🤓
  • Loading branch information
kblok authored Dec 17, 2022
1 parent 65aedcd commit e3e9cc6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/ChromeTargetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/TargetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/src/ariaqueryhandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit e3e9cc6

Please sign in to comment.