修复接码邮箱绑定与验证码提交超时问题

This commit is contained in:
QLHazyCoder
2026-05-16 05:40:04 +08:00
parent 31046c1116
commit 8a11b91c5a
13 changed files with 394 additions and 34 deletions
+51
View File
@@ -1682,6 +1682,57 @@ test('verification flow does not replay step 8 code submit after transient auth-
assert.deepStrictEqual(resilientMessages, ['GET_LOGIN_AUTH_STATE']);
});
test('verification flow keeps step 8 code submit response timeout above local floor when flow budget is nearly exhausted', async () => {
const directCalls = [];
const helpers = api.createVerificationFlowHelpers({
addLog: async () => {},
chrome: {
tabs: {
update: async () => {},
},
},
CLOUDFLARE_TEMP_EMAIL_PROVIDER: 'cloudflare-temp-email',
completeNodeFromBackground: async () => {},
confirmCustomVerificationStepBypassRequest: async () => ({ confirmed: true }),
getHotmailVerificationPollConfig: () => ({}),
getHotmailVerificationRequestTimestamp: () => 0,
getState: async () => ({}),
getTabId: async () => 1,
HOTMAIL_PROVIDER: 'hotmail-api',
isStopError: () => false,
LUCKMAIL_PROVIDER: 'luckmail-api',
MAIL_2925_VERIFICATION_INTERVAL_MS: 15000,
MAIL_2925_VERIFICATION_MAX_ATTEMPTS: 15,
pollCloudflareTempEmailVerificationCode: async () => ({}),
pollHotmailVerificationCode: async () => ({}),
pollLuckmailVerificationCode: async () => ({}),
sendToContentScript: async (_source, message, options) => {
directCalls.push({ message, options });
return { success: true };
},
sendToContentScriptResilient: async () => {
throw new Error('step 8 code submit should use the direct channel once');
},
sendToMailContentScriptResilient: async () => ({}),
setState: async () => {},
setStepStatus: async () => {},
sleepWithStop: async () => {},
throwIfStopped: () => {},
VERIFICATION_POLL_MAX_ROUNDS: 5,
});
const result = await helpers.submitVerificationCode(8, '478910', {
completionStep: 11,
getRemainingTimeMs: async () => 1000,
});
assert.deepStrictEqual(result, { success: true });
assert.equal(directCalls.length, 1);
assert.equal(directCalls[0].message.type, 'FILL_CODE');
assert.equal(directCalls[0].options.responseTimeoutMs, 15000);
});
test('verification flow requests a new code immediately after Cloudflare Temp Email code is rejected', async () => {
const events = [];
const pollPayloads = [];