Mozilla Firefox Native Messaging Error: No such native application

2.3k Views Asked by At

I am using Windows 10 64Bits, Mozilla Firefox 76.0.1 and building a native messaging plugin. Works perfect on Chrome, but not in Firefox.

Now after I hit this bugreport describing my issues with 64bits Windows and Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1494709 I found this documentation https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#Windows

So, I adjusted my register script to:

:: Change HKCU to HKLM if you want to install globally.
:: %~dp0 is the directory containing this bat script and ends with a backslash.
REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.testapp" /ve /t REG_SZ /d "%~dp0com.testapp.json" /f
REG ADD "HKCU\Software\Mozilla\NativeMessagingHosts\com.testapp" /ve /t REG_SZ /d "%~dp0com.testapp.json" /f
REG ADD "HKLM\Software\WOW6432Node\Mozilla\NativeMessagingHosts\com.testapp" /ve /t REG_SZ /d "%~dp0com.testapp.json" /f

I checked the values in my registry and they are correct. The have the correct name and pointing to the manifest file with a full path and file extension. I use the below Native Messaging manifest:

{
    "name": "com.testapp",
    "description": "Test FF/Chrome plugin",
    "path": "C:\\Temp\\NativeHost.exe",
    "type": "stdio",
    "allowed_origins": [
        "chrome-extension://inommcgcdahcocksfinofjgoeaodehnbno/"
    ],
    "allowed_extensions": [
        "[email protected]"
    ]
}

For some reason Firefox is still giving me this error:

Error: "No such native application com.testapp"

What am I missing?

2

There are 2 best solutions below

0
Heitor Nereu On

You probably have comments in your host manifest json file.

Remove the comments and try, for me it was the solution...

0
thusimon On

I encountered the same issue on Mac, inspecting the Firefox browser console (Shift+CMD+J on mac), the error is

Value must either: match the pattern /^\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}$/i, not contain an unexpected "allowed_origins" property, or contain the required "data" property

Just remove the allowed_origins in the host app's manifest, only keep the allowed_extensions, then it works for me