To support my macOS bookmarks syncing application, I have an old Firefox extension (whose XPCOM binary I’ve lost the recipe to build!), and Google Chrome and Opera extensions. I am therefore delighted about WebExtensions. But I’m having trouble with Native Messaging.
What I did
-
Copy the files in my Google Chrome extension to a folder named
myextension@mycompany.com
. -
Copy my Google Chrome Native Messaging Manifest file to
~/Library/Application Support/Mozilla/NativeMessagingHosts/com.mycompany.chromessenger.json -
In that Native Messaging Manifest, delete the
allowed_origins
key and insert instead
"allowed_extensions" : [ "myextension@mycompany.com" ]
-
Test in Firefox Developer Edition 51.0a2 using Load Temporary Add-On.
Result
The extension seems to load OK – its button appears in the toolbar. And if I put a syntax error in the Native Messaging Manifest, I get a complaint in the Debug Console – so I know that Firefox is reading my Native Messaging Manifest. But when I click my extension’s button, and it attempts to open its Native Messaging connection, the Debug Console says:
This extension does not have permission to use native application com.mycompany.chromessenger [NativeMessaging.jsm:192]
I could not find in the documentation a clear statement of how WebExtensions are identified, so as you can see I presumed that the extension identifier is only the name of the parent folder, e.g. myextension.mycompany.com
. Is that correct? If so, what might be wrong here? Has anyone successfully used Native Messaging in their macOS extension yet? Is there a demo?