fix(browser): goto 重试覆盖裸 'Page not found:' 失效身份#1869
Open
huanghe wants to merge 1 commit into
Open
Conversation
…oto retry The goto() stale-identity retry only matched errors containing 'stale page identity'. Under concurrent adapter calls the extension can reject with just 'Page not found: <id>' (no suffix) when the cached targetId was evicted — those were not retried, so a dead targetId cascaded into repeated failures across calls. Broaden isStalePageIdentityError() to also match 'Page not found:' so goto() drops the stale identity and retries once through the session lease.
d09bfa1 to
c2978a7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Page.goto()已有「stale page identity 自动重试」逻辑:当缓存的targetId失效(标签被外部关闭、identity 被驱逐)时,丢弃死 id 并经 session lease 重试一次。但判定函数
isStalePageIdentityError()只匹配错误信息里包含stale page identity的情况。在并发 adapter 调用下,扩展有时只抛出Page not found: <id>(不带— stale page identity后缀)。这类错误没被识别为「身份失效」,于是不会重试——同一个死targetId被反复发送,导致后续调用连环失败。改动
把
isStalePageIdentityError()放宽为同时匹配Page not found::这样
goto()在收到裸Page not found:时也会丢弃失效身份、重试一次。重试本身是安全的:只是清掉缓存targetId后让扩展的 session lease 重新解析到活标签(已有逻辑),_page为空时仍照旧直接抛错、不重试。测试
新增用例
retries on a bare "Page not found:" error without the stale-identity suffix:src/browser/page.test.ts25 个用例全部通过。goto()直接抛Page not found: deadbeef,证明它精确覆盖了新分支。npx tsc --noEmit通过。