Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local files cannot be restored (on Linux) #931

Closed
MarcClaessens opened this issue Jan 4, 2022 · 6 comments
Closed

Local files cannot be restored (on Linux) #931

MarcClaessens opened this issue Jan 4, 2022 · 6 comments

Comments

@MarcClaessens
Copy link

Short description

I have a local HTML file which I use as a portal page (i.e. it stores my favorite, commonly visited web sites).
I find however that my HTML file can not be opened by Tab Session Manager when on Linux (my home PC).
However the same file on Windows (my work laptop) can be opened.

Steps to reproduce

  1. Start browser with clean profile
  2. Install Tab Session Manager
  3. Create a simple test.html file on the Desktop:
<head></head>
<body>
	<h2>Test</h2>
</body>
  1. Open the file with Firefox
  2. Restart Firefox

Expected result

The test.html file is opened and shows the heading "Test"

Actual result

Visible text :

/home/marc/Desktop/test.html

file:///home/marc/Desktop/test.html
Copy URL
This page can not be opened by Tab Session Manager.

HTML body :

<body data-theme="light">
  <div class="container">
   <div class="title">/home/marc/Desktop/test.html</div>
   <input class="replacedUrl caption" value="about:example"> 
   <a class="copyButton">Copy URL</a>
  <div class="replacedPageMessage caption">This page can not be opened by Tab Session Manager.</div></div>
</body>

Note 1 : if I copy the URL and paste it, then Firefox opens it without problem
Note 2 : the URL bar contains :

moz-extension://40f5b4cd-859d-46f8-9266-072e9a3be5c0/replaced/index.html?state=open_faild&title=%2Fhome%2Fmarc%2FDesktop%2Ftest.html&url=file%3A%2F%2F%2Fhome%2Fmarc%2FDesktop%2Ftest.html&favIconUrl=undefined&theme=light

Platform information

  • Platform (OS): Ubuntu 21.10
  • Version of browser: Firefox 95.0.1 (64-bit)
  • Version of Tab Session Manager: 6.11.1
@andoruB
Copy link

andoruB commented Jun 4, 2022

Can confirm this at my end as well.

@ninmonkey
Copy link

Maybe the source?

Below, state=open_faild seems to be the trigger, and that is being added right here:

You could try removing the param

otherwise

Windows will not restore tabs using the file:// protocol on my local machine.
Often browser APIs will limit local file access, for security reasons.

Maybe easily editable? About:Config

It's probably an about:config setting, or userprefs.js maybe security.fileuri.strict_origin_policy ? It didn't seem to do anything, but, the code itself doesn't seem to catch all errors. (see below)

If you have two different machines, both running the same versions, and one view local and not the other, check the group policies. File may be used in WebsiteFilter

A simple workaround I use for my speed dial is

  • set "homepage" to my file:// page, and
  • set "new tabs" to my file

image

This lets me get my custom speed dial if I use any of these

  • click home toolbar icon
  • ctrl+n a new window, or
  • use the alt+home hotkey (TIL)

I use that setup because I have it set to auto restore my previous session on load

First git clone the addon, then

I greped for This page can not be opened by Tab Session Manager

src\_locales\en\messages.json
786:    "message": "This page can not be opened by Tab Session Manager."

src_locales\en\messages.json

taking me to

if (parameter.state == "open_faild") {
document.getElementsByClassName("replacedPageMessage")[0].innerText = browser.i18n.getMessage(
"replacedPageMessage"
);

Now find open_faild

image

@MimmyJau
Copy link

MimmyJau commented Aug 28, 2022

Can confirm that this is a problem on macOS (tested with both local pdfs and html files). From my understanding, this is a Firefox Security Issue.

I found a workaround here that helped solve the problem. One must go to about:config (just type it into the url) and add the following settings:

capability.policy.policynames = "localfilelinks"
capability.policy.localfilelinks.checkloaduri.enabled = "allAccess"
capability.policy.localfilelinks.sites = "moz-extension://UNIQUE_ID_OF_TAB_SESSION_MANAGER"

Two notes:

  1. The UNIQUE_ID_OF_TAB_SESSION_MANAGER will be different on every computer. The easiest way of finding it is to just look at the URL of the tab that failed to load. It should look like:

moz-extension://UNIQUE_ID_OF_TAB_SESSION_MANAGER/replaced/index.html?state=open_faild&title=....

Alternatively, you can go to the settings page for Tab Session Manager, and you'll see something similar in the URL:

moz-extension://UNIQUE_ID_OF_TAB_SESSION_MANAGER/options/index.html

  1. When adding the three lines above to about:config you first type what's on the left side of the equation (e.g. capability.policy.policynames) then select string and then type in what's on the right hand side of the equation (e.g. localfilelinks without double quotes). Note, this is at least what the UI looks like on macOS Firefox (not sure about Windows or Linux).

Other sources suggesting this is a Firefox Security Issue:

@MarcClaessens
Copy link
Author

Excellent, that fixed my issue !
Thank you MimmyJau :)

@Obscure2020
Copy link

Recently ran into the same issue. MimmyJau's instructions did the trick perfectly.

Out of curiosity, is there no way the addition of these settings could be automated during the installation process? Or performed by a button in the settings menu?

@sienori
Copy link
Owner

sienori commented Sep 15, 2022

@Obscure2020 It would not be possible to configure about:config from webExtensions...

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

No branches or pull requests

6 participants