AetherNo2332
edcf7bc7c0
fix(web): 诊断 - 在没有 window.location 的环境不再抛错 (#559)
Original-Commit: cdb07ca9cbdd74e63d8e80659f3bdbd6d49b3dff
fix(web): 诊断 - 在没有 window.location 的环境不再抛错
recordDiagnosticEvent / normalizeRoute 用 `typeof window !== "undefined"` 判断"在浏览器里",
但 bun 的测试环境里 window 存在、window.location 不存在,于是每次记录诊断事件都抛
`TypeError: undefined is not an object (evaluating 'window.location.pathname')`,
director-diagnostics-recorder 的 9 条基线用例因此全红。
改成 browserLocation():window 与 window.location 都探测,取不到就当没有地址(路由回落 "/")。
浏览器内的行为完全不变。
2026-09-21 09:37:19 +08:00
..
2026-09-20 16:40:08 +08:00
2026-09-21 09:37:19 +08:00
2026-09-17 18:40:42 +08:00
2026-09-09 13:00:42 +08:00
2026-09-02 20:33:25 +08:00
2026-09-09 13:01:47 +08:00
2026-09-09 13:01:47 +08:00
2026-09-16 18:29:48 +08:00
2026-09-19 22:29:09 +08:00
2026-09-14 01:11:56 +08:00
2026-09-17 18:40:42 +08:00
2026-09-01 16:47:03 +08:00
2026-09-14 01:11:56 +08:00
2026-09-09 13:01:14 +08:00
2026-08-19 23:25:03 +08:00
2026-08-19 23:25:03 +08:00
2026-09-14 01:11:56 +08:00
2026-09-09 13:00:42 +08:00
2026-09-15 20:56:19 +08:00
2026-09-05 13:24:10 +08:00
2026-09-19 22:29:09 +08:00
2026-08-15 12:45:29 +08:00
2026-09-09 22:02:10 +08:00
2026-08-15 12:45:29 +08:00
2026-08-15 12:45:29 +08:00
2026-08-15 12:45:29 +08:00
2026-09-19 22:29:09 +08:00
2026-09-15 20:56:19 +08:00
2026-09-15 20:56:19 +08:00
2026-09-15 20:56:19 +08:00
2026-08-25 13:49:15 +08:00
2026-09-15 20:56:19 +08:00
2026-09-19 22:29:09 +08:00
2026-08-15 12:45:29 +08:00
2026-09-18 23:27:34 +08:00
2026-09-14 01:11:56 +08:00
2026-09-09 13:02:20 +08:00
2026-09-19 08:43:19 +08:00