MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / waitForStep8Ready

Function waitForStep8Ready

background.js:6040–6066  ·  view source on GitHub ↗
(tabId, timeoutMs = STEP8_READY_WAIT_TIMEOUT_MS)

Source from the content-addressed store, hash-verified

6038}
6039
6040async function waitForStep8Ready(tabId, timeoutMs = STEP8_READY_WAIT_TIMEOUT_MS) {
6041 const start = Date.now();
6042 let recovered = false;
6043
6044 while (Date.now() - start < timeoutMs) {
6045 throwIfStopped();
6046 const pageState = await getStep8PageState(tabId);
6047 if (pageState?.addPhonePage) {
6048 throw new Error('步骤 8:认证页进入了手机号页面,当前不是 OAuth 同意页,无法继续自动授权。');
6049 }
6050 if (pageState?.consentReady) {
6051 return pageState;
6052 }
6053 if (pageState === null && !recovered) {
6054 recovered = true;
6055 await ensureStep8SignupPageReady(tabId, {
6056 timeoutMs: Math.min(10000, timeoutMs),
6057 logMessage: '步骤 8:认证页内容脚本已失联,正在等待页面重新就绪...',
6058 });
6059 continue;
6060 }
6061 recovered = false;
6062 await sleepWithStop(250);
6063 }
6064
6065 throw new Error('步骤 8:长时间未进入 OAuth 同意页,无法定位“继续”按钮。');
6066}
6067
6068async function prepareStep8DebuggerClick(tabId) {
6069 await ensureStep8SignupPageReady(tabId, {

Callers 1

executeStep8Function · 0.85

Calls 4

getStep8PageStateFunction · 0.85
sleepWithStopFunction · 0.85
throwIfStoppedFunction · 0.70

Tested by

no test coverage detected