(state)
| 22 | } = deps; |
| 23 | |
| 24 | async function executeStep4(state) { |
| 25 | const mail = getMailConfig(state); |
| 26 | if (mail.error) throw new Error(mail.error); |
| 27 | const stepStartedAt = Date.now(); |
| 28 | const signupTabId = await getTabId('signup-page'); |
| 29 | if (!signupTabId) { |
| 30 | throw new Error('认证页面标签页已关闭,无法继续步骤 4。'); |
| 31 | } |
| 32 | |
| 33 | await chrome.tabs.update(signupTabId, { active: true }); |
| 34 | throwIfStopped(); |
| 35 | await addLog('步骤 4:正在确认注册验证码页面是否就绪,必要时自动恢复密码页超时报错...'); |
| 36 | const prepareResult = await sendToContentScriptResilient( |
| 37 | 'signup-page', |
| 38 | { |
| 39 | type: 'PREPARE_SIGNUP_VERIFICATION', |
| 40 | step: 4, |
| 41 | source: 'background', |
| 42 | payload: { password: state.password || state.customPassword || '' }, |
| 43 | }, |
| 44 | { |
| 45 | timeoutMs: 30000, |
| 46 | retryDelayMs: 700, |
| 47 | logMessage: '步骤 4:认证页正在切换,等待页面重新就绪后继续检测...', |
| 48 | } |
| 49 | ); |
| 50 | |
| 51 | if (prepareResult && prepareResult.error) { |
| 52 | throw new Error(prepareResult.error); |
| 53 | } |
| 54 | if (prepareResult?.alreadyVerified) { |
| 55 | await completeStepFromBackground(4, {}); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | if (shouldUseCustomRegistrationEmail(state)) { |
| 60 | await confirmCustomVerificationStepBypass(4); |
| 61 | return; |
| 62 | } |
| 63 | |
| 64 | throwIfStopped(); |
| 65 | if (mail.provider === HOTMAIL_PROVIDER || mail.provider === LUCKMAIL_PROVIDER || mail.provider === CLOUDFLARE_TEMP_EMAIL_PROVIDER) { |
| 66 | await addLog(`步骤 4:正在通过 ${mail.label} 轮询验证码...`); |
| 67 | } else { |
| 68 | await addLog(`步骤 4:正在打开${mail.label}...`); |
| 69 | |
| 70 | const alive = await isTabAlive(mail.source); |
| 71 | if (alive) { |
| 72 | if (mail.navigateOnReuse) { |
| 73 | await reuseOrCreateTab(mail.source, mail.url, { |
| 74 | inject: mail.inject, |
| 75 | injectSource: mail.injectSource, |
| 76 | }); |
| 77 | } else { |
| 78 | const tabId = await getTabId(mail.source); |
| 79 | await chrome.tabs.update(tabId, { active: true }); |
| 80 | } |
| 81 | } else { |
nothing calls this directly
no test coverage detected