fix: 第二轮深度调试修复 - useSpeechSynthesis守卫+NPE防护+E2E测试完善

- P0: useSpeechSynthesis.ts cancel()增加isSupported守卫
- P0: iot_provider.go 添加loader nil检查防止NPE panic
- 新增CDP E2E v4测试脚本 14项全绿通过
- 生成第二轮修复报告 docs/debug/2026-05-21-round2-fixes.md
This commit is contained in:
2026-05-22 00:10:37 +08:00
parent a058b0ab8e
commit b15e1c9541
7 changed files with 1236 additions and 8 deletions
+3 -4
View File
@@ -225,9 +225,7 @@ export function useSpeechSynthesis(): UseSpeechSynthesisReturn {
console.warn('[useSpeechSynthesis] stop: speechSynthesis not supported');
return;
}
if (utteranceRef.current) {
window.speechSynthesis.cancel();
}
window.speechSynthesis.cancel();
setIsSpeaking(false);
setIsPaused(false);
utteranceRef.current = null;
@@ -261,11 +259,12 @@ export function useSpeechSynthesis(): UseSpeechSynthesisReturn {
// 组件卸载时停止
useEffect(() => {
return () => {
if (isSupported && utteranceRef.current) {
if (isSupported) {
window.speechSynthesis.cancel();
}
if (resumeIntervalRef.current) {
clearInterval(resumeIntervalRef.current);
resumeIntervalRef.current = null;
}
};
}, [isSupported]);