52 lines
1.6 KiB
Bash
Executable File
52 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cat <<'EOF'
|
|
在 Chrome DevTools Console 粘贴执行:
|
|
|
|
(() => {
|
|
const stamp = () => new Date().toISOString();
|
|
const wrap = (name) => {
|
|
const original = window[name];
|
|
if (typeof original !== "function" || original.__deployTestProbe) {
|
|
console.log(`[probe] ${name}:`, typeof original);
|
|
return;
|
|
}
|
|
const wrapped = function (...args) {
|
|
console.log(`[probe ${stamp()}] ${name} called`, args);
|
|
try {
|
|
const ret = original.apply(this, args);
|
|
console.log(`[probe ${stamp()}] ${name} returned`, ret);
|
|
return ret;
|
|
} catch (err) {
|
|
console.error(`[probe ${stamp()}] ${name} threw`, err);
|
|
throw err;
|
|
}
|
|
};
|
|
wrapped.__deployTestProbe = true;
|
|
window[name] = wrapped;
|
|
};
|
|
|
|
["initSDK", "login", "commonEventFunc"].forEach(wrap);
|
|
window.addEventListener("error", (event) => {
|
|
console.error("[probe window error]", event.message, event.filename, event.lineno, event.error);
|
|
});
|
|
window.addEventListener("unhandledrejection", (event) => {
|
|
console.error("[probe unhandledrejection]", event.reason);
|
|
});
|
|
console.log("[probe ready]", {
|
|
electronAPI: Boolean(window.electronAPI),
|
|
Go: typeof Go,
|
|
initSDK: typeof window.initSDK,
|
|
login: typeof window.login,
|
|
commonEventFunc: typeof window.commonEventFunc,
|
|
openIMRenderApi: typeof window.openIMRenderApi,
|
|
});
|
|
})();
|
|
|
|
然后退出登录/刷新页面重新登录一次,观察是否打印:
|
|
- initSDK called / returned
|
|
- login called / returned
|
|
- window error / unhandledrejection
|
|
EOF
|