Problem
daemon 的 runJSInCurrentTab template(PreCompiledScripts.swift:105-115):
tell application "Safari"
do JavaScript "{{JS_SOURCE}}" in current tab of front window
end tell
— Source: PreCompiledScripts.swift:111-115
current tab of front window 在 front window 為 0-tab 時不存在 → AppleScript raise -1728,js(及走 daemon JS path 的命令)失敗。此 template 沒有 try guard。
Type
bug
Reproduction
- Safari front window 為 0-tab(剛開的 profile 空視窗 /
Cmd+N 空白視窗)
safari-browser js "document.title"(走 daemon JS path)
- line 113
current tab of front window raise -1728 → 命令失敗
Expected
front window 為 0-tab 時,JS 命令應給出可理解的錯誤(例如 "front window has no tabs — open a tab or use --url/--window"),或 fallback 到有 tab 的 window,而非吐 raw -1728。
Actual
raw AppleScript -1728。
Root Cause
in current tab of front window 假設 front window 有 current tab。0-tab front window 無 current tab,且此 daemon template 沒有 try guard。
Suggested fix
- 明確指定有 tab 的 target,或在 front window 0-tab 時給明確錯誤訊息
- 兩條 path 應一致:in-process 的 front-window current tab 存取(SafariBridge.swift:2962-2965)已包 try;daemon 這條(PreCompiledScripts.swift:113)沒有
Relation to #85
同根(0-tab / current tab 缺 guard),本 issue 是 daemon JS path 的版本。#85 修 in-process listAllWindows 枚舉路徑;本 issue 修 daemon JS template 的 front-window 假設。
Source: surfaced during /idd-diagnose #85 sister concern surfacing (Step 3.6)
Current Status
Problem
daemon 的
runJSInCurrentTabtemplate(PreCompiledScripts.swift:105-115):current tab of front window在 front window 為 0-tab 時不存在 → AppleScript raise-1728,js(及走 daemon JS path 的命令)失敗。此 template 沒有 try guard。Type
bug
Reproduction
Cmd+N空白視窗)safari-browser js "document.title"(走 daemon JS path)current tab of front windowraise-1728→ 命令失敗Expected
front window 為 0-tab 時,JS 命令應給出可理解的錯誤(例如 "front window has no tabs — open a tab or use --url/--window"),或 fallback 到有 tab 的 window,而非吐 raw
-1728。Actual
raw AppleScript
-1728。Root Cause
in current tab of front window假設 front window 有 current tab。0-tab front window 無 current tab,且此 daemon template 沒有 try guard。Suggested fix
Relation to #85
同根(0-tab /
current tab缺 guard),本 issue 是 daemon JS path 的版本。#85 修 in-processlistAllWindows枚舉路徑;本 issue 修 daemon JS template 的 front-window 假設。Source: surfaced during /idd-diagnose #85 sister concern surfacing (Step 3.6)
Current Status
idd/cluster-zerotab-guard, isolated worktree); regression tests green, full suite no-regression./idd-verify