Skip to content

Conversation

@m-GDEV
Copy link

@m-GDEV m-GDEV commented Jan 18, 2024

Hi there, thanks for making this extension!

I noticed that you cannot restore windows that have file:// links in any of the tabs.

After looking through the code it seems that the browser (I'm using firefox) blocks the loading of file:// links
when using the browser.tabs or browser.windows APIs.

As a solution to this, I added a little code that would modify URL of any file:// link and instead redirect it to a
program running locally that can then handle and display the file.

I realize this is not the best approach (especially hardcoding the port) so I was wondering if you had any ideas on how this feature could be implemented without hardcoded defaults. Maybe a field in the options page?

Thanks.

@glsignal
Copy link
Collaborator

Hiya, thank you for describing the issue and opening a PR! I'm sorry it took so long to notice this, the email must have gotten lost it among the many work-related notifications.

I wasn't actually aware of this behaviour related to the file:// scheme, but it makes sense from a security perspective. Chrome appears to behave in the same way. I also noticed in Firefox that the same happens when the slept window includes a new tab without any location.

Regarding a solution, applying the file path to a configurable hostname could work, however I worry that this may be too brittle as it relies on having something serving from that hostname, and with the same root location (paths may not agree).

Another option we could look at (and I haven't tried this yet) is to use the extension itself as a host for tabs that have file schemes: when saving/restoring, if we encounter a tab with a protected scheme like file://, prepend moz-extension://<extension-id>/static/jump.html?url= before creating the window. jump.html in this case would be some very simple interstitial location that lets someone go back to their file location if desired.

@glsignal glsignal added the bug label Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants