This commit is contained in:
vet
2026-04-14 15:34:23 +07:00
parent 4ce37703b3
commit c493ccda6e

View File

@@ -59,7 +59,7 @@ cat <<'EOF'
console.log(`[probe] ${name}: wrapped`); console.log(`[probe] ${name}: wrapped`);
}; };
["initSDK", "login", "commonEventFunc", "initDB", "setSqlWasmPath"].forEach(wrap); ["initSDK", "login", "logout", "commonEventFunc", "initDB", "setSqlWasmPath"].forEach(wrap);
window.addEventListener("error", (event) => { window.addEventListener("error", (event) => {
console.error("[probe window error]", event.message, event.filename, event.lineno, event.error); console.error("[probe window error]", event.message, event.filename, event.lineno, event.error);
}); });
@@ -68,9 +68,14 @@ cat <<'EOF'
}); });
console.log("[probe ready]", { console.log("[probe ready]", {
electronAPI: Boolean(window.electronAPI), electronAPI: Boolean(window.electronAPI),
href: window.location.href,
isSecureContext: window.isSecureContext,
crossOriginIsolated: window.crossOriginIsolated,
SharedArrayBuffer: typeof window.SharedArrayBuffer,
Go: typeof Go, Go: typeof Go,
initSDK: typeof window.initSDK, initSDK: typeof window.initSDK,
login: typeof window.login, login: typeof window.login,
logout: typeof window.logout,
commonEventFunc: typeof window.commonEventFunc, commonEventFunc: typeof window.commonEventFunc,
initDB: typeof window.initDB, initDB: typeof window.initDB,
setSqlWasmPath: typeof window.setSqlWasmPath, setSqlWasmPath: typeof window.setSqlWasmPath,
@@ -114,6 +119,16 @@ cat <<'EOF'
const state = { const state = {
href: window.location.href, href: window.location.href,
hash: window.location.hash, hash: window.location.hash,
isSecureContext: window.isSecureContext,
crossOriginIsolated: window.crossOriginIsolated,
SharedArrayBuffer: typeof window.SharedArrayBuffer,
electronAPI: Boolean(window.electronAPI),
Go: typeof Go,
initSDK: typeof window.initSDK,
login: typeof window.login,
logout: typeof window.logout,
initDB: typeof window.initDB,
setSqlWasmPath: typeof window.setSqlWasmPath,
userID: await window.__deployTestReadLocalForage("IM_USERID"), userID: await window.__deployTestReadLocalForage("IM_USERID"),
hasIMToken: Boolean(await window.__deployTestReadLocalForage("IM_TOKEN")), hasIMToken: Boolean(await window.__deployTestReadLocalForage("IM_TOKEN")),
hasChatToken: Boolean(await window.__deployTestReadLocalForage("IM_CHAT_TOKEN")), hasChatToken: Boolean(await window.__deployTestReadLocalForage("IM_CHAT_TOKEN")),
@@ -238,13 +253,17 @@ cat <<'EOF'
}; };
clearInterval(window.__deployTestProbeTimer); clearInterval(window.__deployTestProbeTimer);
window.__deployTestProbeTimer = setInterval(() => { window.__deployTestProbeTimer = setInterval(() => {
console.log(`[probe ${stamp()}] counts`, { ...counts }); const snapshot = { ...counts };
console.log(`[probe ${stamp()}] counts`, snapshot);
if (!snapshot.initSDK && !snapshot.login) {
console.warn("[probe hint] initSDK/login 仍为 0当前页面没有重新触发 SDK 登录。若 logout > 0 且报 10008只说明业务层在未初始化 SDK 时触发了退出。请执行 await window.__deployTestAuthState();若仍有 token可执行 await window.__deployTestManualLogin() 手动验证 SDK 初始化链路。");
}
}, 5000); }, 5000);
})(); })();
然后退出登录/刷新页面重新登录一次,观察是否打印: 然后退出登录/刷新页面重新登录一次,观察是否打印:
- new Worker / worker.postMessage / worker error - new Worker / worker.postMessage / worker error
- initSDK / login / initDB / setSqlWasmPath called / returned - initSDK / login / logout / initDB / setSqlWasmPath called / returned
- window error / unhandledrejection - window error / unhandledrejection
- counts 里的 initSDK/login 是否从 0 变成 1 - counts 里的 initSDK/login 是否从 0 变成 1
@@ -278,4 +297,6 @@ await window.__deployTestManualInitDB()
如果 counts 仍为 0查看业务登录链路状态 如果 counts 仍为 0查看业务登录链路状态
await window.__deployTestAuthState() await window.__deployTestAuthState()
其中 isSecureContext / crossOriginIsolated 应为 trueSharedArrayBuffer 应为 "function"。
EOF EOF