review: M0/M1 成果审查后的质量加固
三路独立审查:桥引擎(对照 lzyzsd 逐字)与契约 SSOT(对照原 Android 44 handler) 两个命门维度【零问题】;以下为架构/质量改进项的修复: - [安全红线] BridgeGameContainer setWebDebuggingAccess 加 AppEnv.isDebug() 守卫 (common 新增 AppEnv,用 bundleManager.appInfo.debug 运行时判断,release 自动关闭, 消除 CLAUDE.md 附录B 红线违反) - [生命周期] BridgeController 加 dispose() 清回执表/注册表/启动队列;HandlerRegistry 加 clear();容器 aboutToDisappear 先 dispose 桥再 dispose adapter 并置空,防残留命中/泄漏 - [事件总线] EventBus.on/once 返回取消函数支持 per-subscriber 精确退订;off→offAll 并 标注谨慎(避免 M3 多容器订阅 appservice 时误注销他人回调) - [单测] 加强 escape 断言覆盖内层 " 加倍(命门);新增 dispose 用例;16 用例全通过, 桥核心覆盖率 89.0% - [记录] Index.pageMap param as 运行期不校验,M4 外部 scheme 唤起时需补校验(已注释) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
74b302e131
commit
bdb920f61e
@@ -41,6 +41,14 @@ export class BridgeController {
|
||||
this.bridgeJs = js;
|
||||
}
|
||||
|
||||
/** 释放:清空回执表/注册表/启动队列,断开与已注册能力闭包的引用,防泄漏。
|
||||
* 容器 aboutToDisappear 调用(注意:IWebController 由容器另行 dispose)。 */
|
||||
dispose(): void {
|
||||
this.responseCallbacks.clear();
|
||||
this.registry.clear();
|
||||
this.startupMessages = null;
|
||||
}
|
||||
|
||||
// —— H5 → 原生:在 Web().onLoadIntercept 调用,返回 true 表示拦截、阻断真实导航 ——
|
||||
onLoadIntercept(rawUrl: string): boolean {
|
||||
let url: string;
|
||||
|
||||
@@ -39,6 +39,11 @@ export class HandlerRegistry {
|
||||
this.handlers.delete(name);
|
||||
}
|
||||
|
||||
/** 清空全部已注册 handler(容器销毁时防泄漏;默认兜底 handler 保留)。 */
|
||||
clear(): void {
|
||||
this.handlers.clear();
|
||||
}
|
||||
|
||||
has(name: string): boolean {
|
||||
return this.handlers.has(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user