Skip to content

Commit

Permalink
add timed run to all frame.evaluate() just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed May 7, 2024
1 parent 66395da commit 3ca3525
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/crawler.ts
Expand Up @@ -1061,9 +1061,20 @@ self.__bx_behaviors.selectMainBehavior();

// this is all designed to detect and skip PDFs, and other frames that are actually EMBEDs
// if there's no tag or an iframe tag, then assume its a regular frame
const tagName = await frame.evaluate(
"self && self.frameElement && self.frameElement.tagName",
);
let tagName = "";

try {
tagName = await timedRun(
frame.evaluate(
"self && self.frameElement && self.frameElement.tagName",
),
PAGE_OP_TIMEOUT_SECS,
"Frame check timed out",
logDetails,
);
} catch (e) {
// ignore
}

if (tagName && tagName !== "IFRAME" && tagName !== "FRAME") {
logger.debug(
Expand Down

0 comments on commit 3ca3525

Please sign in to comment.