Skip to content

fix: include pending background tabs in tab list; add tabs create/switch to batch - #736

Open
tqjason wants to merge 1 commit into
lsdefine:mainfrom
tqjason:patch-1
Open

fix: include pending background tabs in tab list; add tabs create/switch to batch#736
tqjason wants to merge 1 commit into
lsdefine:mainfrom
tqjason:patch-1

Conversation

@tqjason

@tqjason tqjason commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

fix(tmwdb): show newly created background tabs before page fully loads

Tabs created via chrome.tabs.create({active: false}) were missing from the pushed tab list until the page reached 'complete' status, because:

  1. sendTabsUpdate() ran on tabs.onCreated while the tab's navigation had not committed, so tab.url was "" and isScriptable() filtered it out (the real URL lives in tab.pendingUrl at that point).
  2. The tabs.onUpdated listener only fired on status==='complete', so no update was pushed when the URL committed during loading.

Introduce tabUrl() = t.url || t.pendingUrl || '' and use it everywhere a tab URL is read (ext_ready, tabs_update, tabs list, batch tabs, handleWsExec newTabs capture, tabs create response, handleCookies). Also push tabs_update on changeInfo.url so a new tab appears as soon as its navigation commits instead of only after full page load.

Additionally:

  • Fix handleExtMessage tabs branching to if/else-if/else so 'create' no longer relies on early return to skip the list branch.
  • Support tabs create/switch sub-commands inside batch requests.

…h on URL commit); add tabs create/switch to batch

fix(tmwdb): show newly created background tabs before page fully loads

Tabs created via chrome.tabs.create({active: false}) were missing from
the pushed tab list until the page reached 'complete' status, because:

1. sendTabsUpdate() ran on tabs.onCreated while the tab's navigation
   had not committed, so tab.url was "" and isScriptable() filtered it
   out (the real URL lives in tab.pendingUrl at that point).
2. The tabs.onUpdated listener only fired on status==='complete', so
   no update was pushed when the URL committed during loading.

Introduce tabUrl() = t.url || t.pendingUrl || '' and use it everywhere
a tab URL is read (ext_ready, tabs_update, tabs list, batch tabs,
handleWsExec newTabs capture, tabs create response, handleCookies).
Also push tabs_update on changeInfo.url so a new tab appears as soon
as its navigation commits instead of only after full page load.

Additionally:
- Fix handleExtMessage tabs branching to if/else-if/else so 'create'
  no longer relies on early return to skip the list branch.
- Support tabs create/switch sub-commands inside batch requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant