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

firefox extensions using "native-messaging-hosts": cant get it to work #453

Closed
m040601 opened this issue Mar 21, 2019 · 4 comments
Closed

Comments

@m040601
Copy link

m040601 commented Mar 21, 2019

Hi, first off all thank you for you work in this project.
I'm on Arch Linux Firefox 66.
I'm using the default template with every possible hardening measure enforced.
I'm still learning, so please apologize if after reading the docs/issues, I missed something apparently "obvious".

I'm trying to get this (great) extension to work, https://github.com/persepolisdm/Persepolis-WebExtension . Persepolis itself, https://github.com/persepolisdm/persepolis,
is just a great gui to the ariac download manager.
So this all makes a great open source "download manager/interceptor" solution for firefox.

The installation gave no error messages, everything seems to be there menus buttons etc,
The extension itself wrote a file to
$HOME/.mozilla/native-messaging-hosts/
called, com.persepolis.pdmchromewrapper.json, with this content:

{"name": "com.persepolis.pdmchromewrapper", "type": "stdio", "path": "/home/REDACTED/.config/persepolis_download_manager/persepolis_run_shell", "description": "Integrate Persepolis with firefox using WebExtensions", "allowed_extensions": ["com.persepolis.pdmchromewrapper@persepolisdm.github.io", "com.persepolis.pdmchromewrapper.offline@persepolisdm.github.io"]}

Except it doesn work. Nothing happens. No error message nothing.
When I try to use it, that is right clicking:

  • on a link and choose from the context menu "download this link with Persepolis"
  • on a page and choose from the context menu "download all links in this page with Persepolis"

So I went slowly, step by step trying to pinpoint the problem.
First suspicion, was some other addon or ublock addblocker.
So I started with a fresh Firefox profile. With nothing customized. Zero addons, no custom user.js. And It works.I then, added step by step all my usual addons, including ublock, heavy javascript blockers etc. It works.

I must also say, that I use other extensions that make use of this "native-messaging" thing WITH user.js and without any problem Example, the great browserpass, https://github.com/browserpass/browserpass-extension

So then i then turned into my user.js file.
I admit, my techical knowledge is limited, but, I tryied to search for some setting or hardening option responsible for this. Searched for "native" and similar things found nothing.

Do you have any idea what could be causing this ?
Any tips or tools I could use to debug this ?
This issue concerns a particular extension.
But I would also like to ask you, if possible to expand on the documentation on this issue. That is, the possible issues/gotchas/limitations of using user.js with this kind of "native-messaging" extensions/functionality.

Thanks in advance.

@Atavic
Copy link

Atavic commented Mar 21, 2019

You have to enable URL protocol handlers: https://github.com/pyllyukko/user.js/blob/master/user.js#L333

See: #295

@m040601
Copy link
Author

m040601 commented Mar 23, 2019

Still cant' get it to work.
Sorry, I've tryed all combinations possible.
Let me restate again what I had.
I had the exact default user.js template, nothing changed.
So that was:

user_pref("network.protocol-handler.warn-external-default",	true);
user_pref("network.protocol-handler.external.http",		false);
user_pref("network.protocol-handler.external.https",		false);
user_pref("network.protocol-handler.external.javascript",	false);
user_pref("network.protocol-handler.external.moz-extension",	false);
user_pref("network.protocol-handler.external.ftp",		false);
user_pref("network.protocol-handler.external.file",		false);
user_pref("network.protocol-handler.external.about",		false);
user_pref("network.protocol-handler.external.chrome",		false);
user_pref("network.protocol-handler.external.blob",		false);
user_pref("network.protocol-handler.external.data",		false);
user_pref("network.protocol-handler.expose-all",		false);
user_pref("network.protocol-handler.expose.http",		true);
user_pref("network.protocol-handler.expose.https",		true);
user_pref("network.protocol-handler.expose.javascript",		true);
user_pref("network.protocol-handler.expose.moz-extension",	true);
user_pref("network.protocol-handler.expose.ftp",		true);
user_pref("network.protocol-handler.expose.file",		true);
user_pref("network.protocol-handler.expose.about",		true);
user_pref("network.protocol-handler.expose.chrome",		true);
user_pref("network.protocol-handler.expose.blob",		true);
user_pref("network.protocol-handler.expose.data", true);

You wrote,

You have to enable URL protocol handlers

I suppose by "enable" you mean, changing from "false" to "true" those "handler.external" lines ? Am I correct ? Because on the "handler.expose" lines, the defaults are OK right ?

So, regarding the "handler.external" lines .
I'm not sure which one of them exactly, could have an effect on the external download manager extension. Changing some of them has some other non desired effect on firefox.

So conclusion.
I did try them to changed them from false to true. One by one. All of them. I even commented out the entire block. Still the same problem.

@JafarAkhondali
Copy link

@m040601 Hey,
Thanks for using PDM. To find more about problem:

  1. Go to about:debugging
  2. Mark Add-on debugging
  3. Click on Debug button of "Persepolis Download Manager Integration"
    Then try to use addon and download something, if anything went wrong an error should appear in console tab of debug area

@m040601
Copy link
Author

m040601 commented Mar 25, 2019

As discussed here, persepolisdm/Persepolis-WebExtension#20
The main culprit seems to be this setting:
user_pref("privacy.firstparty.isolate", true);
So to use the default "user.js" you have to set it to false.

So conclusion, this option may affect other Firefox extensions (like download managers)
Yeah, these kind of "experimental" and "aggressive" browser settings,
keep changing fast and being created by Mozzila at an incredibe and difficult to
keep up pace with.

Thanks for your attention to this issue.

@m040601 m040601 closed this as completed Mar 25, 2019
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

3 participants