Closed Bug 1427202 Opened 8 years ago Closed 8 years ago

Webextensions, Native Messaging: provide a way to specify arguments for native application

Categories

(WebExtensions :: Untriaged, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: code, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Build ID: 20171201083152 Steps to reproduce: As far as I know, there currently is no way to specify arguments for the native application that is started when using the Native Messaging APIs available to webextensions. Being able to provide arguments would be useful for various things. The main reason why I would like to be able to do it is that I'm trying to integrate Neovim with Firefox by making use of Neovim's UI protocol ( https://github.com/neovim/neovim/blob/102e0689d8a11a6085c0856fcb1bfdb529c55e46/runtime/doc/ui.txt#L20 ). In order to do this, one must spawn Neovim with the --embed argument, which allows the UI to communicate with Neovim through messages sent on stdin/stdout. A possible workaround would be to have the webextension start a shell and then ask it to run the native application with the right arguments. However, there are two downsides to this solution: it is not portable (it would require extra work to support windows) and it asks for more "privileges" than needed: a webextension could run any kind of arbitrary code if allowed to access a shell. I know this concern doesn't really stand in Neovim's case but I think it does when thinking about more basic unix utilities (we could imagine a webextension that gives arguments to the 'cat' binary in order to read files from the filesystem while ensuring that the webextension can't write to the filesystem). This could be implemented in two ways: one would be to specify the arguments in the manifest.json file (this would be enough for my Neovim use case) or add an argument to the connectNative ( https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/connectNative ) function in order to enable dynamically specified arguments (I think this would be more useful to webextension developers). If this sounds like a good idea to you, I'd be willing to implement this feature. I would however need to be mentored as this would be my first contribution to Firefox.
If you want to launch a native application with specific arguments, you'll need to create a stub application or shell script which launches it with those arguments. In any case, I don't see how being able to pass the --embed argument to neovim would solve any problems, since its protocol is not compatible with the native messaging protocol.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
>If you want to launch a native application with specific arguments, you'll need to create a stub application or shell script which launches it with those arguments. This is what I was trying to avoid since I thought the script would have been ridiculously small (just an `exec $binary $arg`). >In any case, I don't see how being able to pass the --embed argument to neovim would solve any problems, since its protocol is not compatible with the native messaging protocol. Oh, you're right. Thank you for pointing this out and sorry for bothering you with this useless issue.
I think I found another use case for allowing arguments to be given to a binary: passing urls of current pages to media players. Creating a native application "just" to do that seems a bit absurd, being able to drop the manifest file in the right place and have everything automatically work without having to install a 10 lines long script would be better.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.