Closed
Bug 1330223
Opened 7 years ago
Closed 7 years ago
Firefox Native Messaging runtime.LastError not giving any errors in case of no Native application installed on browser.runtime.connectNative
Categories
(WebExtensions :: General, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1299411
People
(Reporter: rohankapoor2907, Unassigned)
Details
Attachments
(1 file)
615 bytes,
application/javascript
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 Steps to reproduce: When Native app is not installed (Registry is not done for it) and then we install the web extension in browser and try to connect it to the native app using browser.runtime.connectNative. At that time as Native app is not present it gets disconnected and it calls to onDisconnect.addListener, However browser.runtime.lastError is null and it doesn't give any error message why connection was not established. It should provide some error message that why connection with Native app was not established. Steps to reproduce : 1. Install a web extension in browser , you can use example from https://github.com/mdn/webextensions-examples/tree/master/native-messaging also. In that example just add below listener in background.js (I have also atteched the file for reference). port.onDisconnect.addListener((msg)=>{ console.log("Received: " + JSON.stringify(browser.runtime.lastError)); console.log("Received: " + JSON.stringify(msg)); }); 2. Now check browser console, it will have following log entries : browser.runtime.lastError : null Ondisconnect Argument : {"name":"ping_pong","onDisconnect":{},"onMessage":{}} No such native application ping_pong Actual results: browser.runtime.lastError is null, In log we can see Error message that No such native application is present but lastError doesn't give any error message. Expected results: Ideally, When Native app is not installed , browser.runtime.lastError should give error message like "No such native application" which can be used in code to identify whether corresponding Native app is installed or not. However browser.runtime.lastError is null and it doesn't give any error message why connection was not established. It should provide some error message that why connection with Native app was not established. Currently there is no way we can find out whether the corresponding Native app is installed or not. In Chrome it specifically gives error in runtime.lasterror.message that native messaging host not found or native messaging host is forbidden So from that message we can confirm whether Native host is installed or not, But in firefox it is not giving any error which can be used in code, however in console it gives proper error messages.
Updated•7 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Reporter | ||
Comment 2•7 years ago
|
||
Hi Kris, As mentioned by you that this bug is duplicate of bug 1299411 , I checked bug 1299411 and from that I understood that in place of browser.runtime.lastError we can get error messages from port.error. for e.g : port.onDisconnect.addListener((p) => { if (p.error) { console.log(`Disconnected due to an error: ${p.error.message}`); } }); However currently I am on Firefox 51.0b13 (32-bit) and still I am not able to get any error message . Only in console I can see that it gives error message as "No such native application ping_pong" Can you please confirm in which version of Firefox, fix for bug 1299411 will be released on which I can test ?
Flags: needinfo?(kmaglione+bmo)
Comment 3•7 years ago
|
||
Rohan, as it says at https://bugzilla.mozilla.org/show_bug.cgi?id=1299411, that bug is fixed in Firefox 52.
Flags: needinfo?(kmaglione+bmo)
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•