a1c5883cc5dbb4b1ecec30f71f633778a6961d59
零修改 H5(原则 A):WKUserScript .atDocumentStart 在业务 JS 跑前 hook 三类异常源: - `console.error(...)`:保留原函数链式调用 + 转发 args - `window.onerror`:onmessage / filename / lineno / colno / error.stack - `unhandledrejection`:reason + reason.stack 走独立的 webkit.messageHandlers.h5error 通道(与 WVJB 不同 channel,不冲突)。 原生侧 MessageProxy weak target 切断 retain cycle。仅 BridgedWebView 安装 (大厅+子游戏),OverlayViewController 是第三方外链,不挂。 开发期价值:H5 出错时 Xcode console 直接能看到 "[H5 onerror] ... at xxx.js:42:8", 减少调试盲点。生产期 print 走 OSLog,对体积/性能影响极小。 新增: - Source/Bridge/H5ErrorRelay.swift(@MainActor singleton) 接入: - BridgedWebView.init:H5ErrorRelay.shared.install(into:) 在 WVJB 之后 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Description
No description provided
24 MiB
Languages
Swift
94.5%
Objective-C++
2.9%
JavaScript
1.8%
C
0.6%
Objective-C
0.2%