Skip to content

fix: tab is invalid if user closes source tab - #3146

Merged
dteviot merged 1 commit into
dteviot:ExperimentalTabModefrom
matthewsong18:firefox-invalid-tab
Nov 13, 2026
Merged

dteviot merged 1 commit into
dteviot:ExperimentalTabModefrom
matthewsong18:firefox-invalid-tab

Conversation

@matthewsong18

Copy link
Copy Markdown
Contributor

TL;DR You can now close new tab and reload as you please without getting an invalid tab ID error on Firefox. For novels, you still shouldn't reload the extension page if you closed the source novel tab.

Problem

  • invalid tab ID when opening extension from new tab.
    • Could not reproduce following user description.

Cause

  • Through testing, was unable to reproduce the error exactly as the user described.
  • On Firefox, reproduced the error by closing the new tab used to open the extension, then reloaded the extension. The error now showed that the tab ID was invalid.
  • Here is an example: popup.html?id=2. The extension is tracking the id of the tab used to open the extension. In this case, the id is 2. This can be any tab, from new tab to novel page. When that tab is closed, that id is no longer valid to Firefox. If the extension tab is reloaded what whatever reason, since the tab it was originally tracking is no longer valid, Firefox returns an error and displays invalid tab ID.

Fix

  • Added a try/catch around the code requesting the tab. If this errors out due to the tab being invalid, we just return. Injecting doesn't make sense anyways if that page is gone.

Notes

  • I tested on a version prior to Fix firefox new tab perm #3118 to see if reloading after closing a novel page returned an invalid tab error and it did. Therefore, this is a previously existing behavior on Firefox.
  • The invalid tab error does not display anymore due to the try-catch. Instead, the page functions normally without injecting after reload, including on novel pages. If a novel page isn't reloaded after closing the source novel tab, it behaves as normal.

@matthewsong18

Copy link
Copy Markdown
Contributor Author

Turns out that I reproduced the error completely differently from how the user was generating it. The user seems to have copied the url from an open extension page and saved that to use as a bookmark and a home page. I inadvertently solved part of the error, caused by saving an old invalid tab id in the url and reusing it.

More information in #3148.

@dteviot
dteviot merged commit 5a124ac into dteviot:ExperimentalTabMode Nov 13, 2026
1 check passed
@matthewsong18
matthewsong18 deleted the firefox-invalid-tab branch November 13, 2026 07:53
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.

2 participants