I try to use the "sendNativeMessage" function: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/sendNativeMessage According to the documentation this should be available since Firefox 50. I have the "nativeMessaging" permission in my Addon and I could use "connectNative" (this is defined). For "sendNativeMessage", I get the message in the summary. For some reason it doesn't end in the browser console. I had to use "try catch" to get it...
Can you please attach a complete extension that exhibits this problem?
The extension, I try to create, is still in development and only consists of alerts and debug messages. I would have to create a simple testcase. I have the following in my extension: for (a in browser.runtime) alert(a); And "sendNativeMessage" is not listed with this, so it doesn't get defined. This is my "permission block": "permissions": [ "nativeMessaging", "<all_urls>" ] I can wrap both (permissions and the two lines code) into a small test extension if this helps.
Created attachment 8893877 [details] test.xpi Very simple test addon. I now finally give up. Sorry guys, but the error messages, created by the whole "Web Extensions" stuff, are total bu**sh*t. Not fun at all to track down such errors! If there already is a bug about the error message situation with WebExtensions (just undefined functions, no clear errors in browser console if permission is missing, ...) please tell me or directly add me to the CC list. Thanks.
Forgot to mention: This also affects "connectNative". I do not know what I'm doing wrong, but my Addon is not able to use the "nativeMessaging" stuff.
You are trying to use nativeMessaging inside a content script. What is available in a content script is documented here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts Try moving your calls into a background page.
Yes, that's documented here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#Communicating_with_background_scripts Closing this bug based on the use case presented in the test.xpi.
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.