From 7ba99ba4a492ceff6c0b5b6509b85a7a65039d64 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Wed, 5 Aug 2026 07:57:22 -0700 Subject: [PATCH] [eric] browser: a top document that never settles must not deny its child frames a look --- frontend/src/shared/browserCommandHandler.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/shared/browserCommandHandler.ts b/frontend/src/shared/browserCommandHandler.ts index f1b7d139..808ec5e9 100644 --- a/frontend/src/shared/browserCommandHandler.ts +++ b/frontend/src/shared/browserCommandHandler.ts @@ -737,14 +737,25 @@ async function handleFindComposer(wv: BrowserWebview, params: Record /still loading|never finished loading/i.test(String(e?.message || e)); let result: any; try { result = await evalInPage(wv, code); } catch (err: any) { - if (!/still loading|never finished loading/i.test(String(err?.message || err))) throw err; + if (!p_stillLoading(err)) throw err; console.log('[find_composer] page still loading; one retry after a settle'); await new Promise((r) => setTimeout(r, 1200)); - result = await evalInPage(wv, code); + try { + result = await evalInPage(wv, code); + } catch (err2: any) { + if (!p_stillLoading(err2)) throw err2; + // The TOP document timing out says nothing about the frames inside it, and each child frame + // is a separate CDP session with its own load state. Rethrowing here was the whole disqus + // failure: an ad-heavy page kept the top document in isLoading forever, and the composer, + // which lives in the embedded Disqus iframe and was perfectly readable, never got looked at. + console.log('[find_composer] top document never settled; trying child frames anyway'); + result = null; + } } // Nothing in the top document? Run the SAME search inside each child frame. deepMatch pierces // shadow DOM but starts at `document` and recurses only into shadowRoot, so an iframe is a wall