Skip to content

Commit 23ae17f

Browse files
committed
fix: auto dismiss dialogs during crawling
1 parent 6f78d2f commit 23ae17f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

apps/workers/workers/crawlerWorker.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,14 @@ async function crawlPage(
544544
await globalBlocker.enableBlockingInPage(nextPage);
545545
}
546546

547+
// Auto-dismiss JavaScript dialogs (alert, confirm, prompt)
548+
// to prevent pages from hanging during crawl.
549+
nextPage.on("dialog", (dialog) => {
550+
dialog.dismiss().catch(() => {
551+
// Ignore errors — the dialog may have already been closed.
552+
});
553+
});
554+
547555
// Block audio/video resources and disallowed sub-requests
548556
await nextPage.route("**/*", async (route) => {
549557
if (abortSignal.aborted) {

0 commit comments

Comments
 (0)