收口桌面壳导航诊断日志

桌面壳 H5 history 追踪脚本同步失败只记录稳定标签

更新桌面壳导航脚本测试禁止打印 error 对象

扩展桌面壳配置门禁防止恢复 console.warn error 参数

补充宿主壳方案中的桌面诊断日志边界
This commit is contained in:
2026-06-20 23:33:03 +08:00
parent 636880d4df
commit da00cac294
3 changed files with 20 additions and 3 deletions
+15 -1
View File
@@ -2635,7 +2635,7 @@ const requiredRustHostSnippets = [
'window.history.replaceState',
"window.addEventListener('popstate'",
'__genarrativeDesktopHistoryIndex',
"console.warn('desktop navigation state sync failed', error)",
"console.warn('desktop navigation state sync failed')",
'file.imageDropped',
'normalize_desktop_drop_position',
'.round().max(0.0) as i32',
@@ -2704,6 +2704,20 @@ const requiredRustHostSnippets = [
'replay_state.complete(slot, response)',
];
const desktopNavigationStateScriptBody = extractFunctionBody(
desktopShellNavigationSource,
'desktop_navigation_state_script',
);
if (
desktopNavigationStateScriptBody.includes(
"console.warn('desktop navigation state sync failed', error)",
)
) {
throw new Error(
'desktop shell navigation state diagnostics must not log native error objects',
);
}
assertSameList(
allowedTauriCommands,
['host_bridge_request'],
@@ -79,7 +79,7 @@ pub(crate) fn desktop_navigation_state_script() -> Result<String, serde_json::Er
try {{
originalReplaceState(stateWithIndex(window.history.state, currentIndex), '', window.location.href);
}} catch (error) {{
console.warn('desktop navigation state sync failed', error);
console.warn('desktop navigation state sync failed');
}}
}};
@@ -393,7 +393,8 @@ mod tests {
assert!(script.contains("(currentIndex > 0)"));
assert!(script.contains("\\\"canGoBack\\\":true"));
assert!(script.contains("\\\"canGoBack\\\":false"));
assert!(script.contains("console.warn('desktop navigation state sync failed', error)"));
assert!(script.contains("console.warn('desktop navigation state sync failed')"));
assert!(!script.contains("console.warn('desktop navigation state sync failed', error)"));
assert!(script.contains("window.__GENARRATIVE_DESKTOP_NAVIGATION_STATE_INSTALLED__"));
}
}