Skip to content

fix: open 後立即以 --url targeting 執行可能撞 -1719 invalid index — resolve-then-execute 間 tab 索引不穩定 (sister bug from #76) #78

Description

@kiki830621

Problem

open <url> 之後立即以 --url targeting 執行指令,可能撞 AppleScript -1719 invalid index:

$ .build/debug/safari-browser open "file://…/test-page.html"; sleep 2
$ .build/debug/safari-browser js "1+1" --url test-page
Error: AppleScript error: 811:814: execution error: Safari發生錯誤:無法取得「tab 2 of window 1」。索引錯誤。 (-1719)

同一 target 立即重試即成功(後續 js / --large 呼叫全部正常)。顯示 resolve-then-execute 兩步之間 tab 索引在頁面 load/settle 期間不穩定 — resolution 算出的 (window, tab) 在執行時已失效。

Type

bug

Expected

以下擇一(或組合):

  • resolve-then-execute 路徑對 -1719(invalid index)在短 grace window 內自動重新 resolve + 重試一次
  • open 在 tab 穩定註冊前 block(或提供 --wait-ready

Actual

一次性 -1719 錯誤直接 surface 給 caller,需 caller 自行重試。

Impact

Source: surfaced during /idd-implement #76 reproduction (Step 5.7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions