Skip to content

Commit

Permalink
fix: handle frame manager init without unhandled rejection (#10902)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Sep 13, 2023
1 parent 4b8d20d commit ea14834
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions packages/puppeteer-core/src/common/FrameManager.ts
Expand Up @@ -238,19 +238,16 @@ export class FrameManager extends EventEmitter<FrameManagerEvents> {

async initialize(client: CDPSession): Promise<void> {
try {
const networkInit = this.#networkManager.addClient(client);
const result = await Promise.all([
client.send('Page.enable'),
client.send('Page.getFrameTree'),
]);
const {frameTree} = result[1];
this.#handleFrameTree(client, frameTree);
await Promise.all([
this.#networkManager.addClient(client),
client.send('Page.enable'),
client.send('Page.getFrameTree').then(({frameTree}) => {
this.#handleFrameTree(client, frameTree);
}),
client.send('Page.setLifecycleEventsEnabled', {enabled: true}),
client.send('Runtime.enable').then(() => {
return this.#createIsolatedWorld(client, UTILITY_WORLD_NAME);
}),
networkInit,
]);
} catch (error) {
// The target might have been closed before the initialization finished.
Expand Down
2 changes: 1 addition & 1 deletion test/TestExpectations.json
Expand Up @@ -4088,7 +4088,7 @@
{
"testIdPattern": "[coverage.spec] Coverage specs JSCoverage resetOnNavigation should report scripts across navigations when disabled",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "new-headless", "cdp", "tabTarget"],
"parameters": ["cdp", "chrome", "new-headless", "tabTarget"],
"expectations": ["FAIL"]
}
]

0 comments on commit ea14834

Please sign in to comment.