SCENARIO
I'm on Windows 10 x64 with Firefox v51.0, and I'm completely newbie on the Mozilla's extension development world (and also with JavaScript lang.)
For writing my very first "Hello world" extension I followed the Borderify example on Mozilla's website, which worked fine on my side.
PROBLEM
Now I'm trying to modify the original sample to write a simple script that must run a external application when the user is on a mozilla.org
webpage. To accomplish this task I'm trying to use the nsiProcess interface. The problem is that the application doesn't execute.
manifest.json
{
"manifest_version": 2,
"name": "Test",
"version": "1.0",
"description": "Runs a external application.",
"icons": {
"48": "icons/border-48.png"
},
"content_scripts": [
{
"matches": ["*://*.mozilla.org/*"],
"js": ["test.js"]
}
]
}
test.js
// create an nsIFile for the executable
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsIFile);
file.initWithPath("c:\\myapp.exe");
// create an nsIProcess
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
// Run the process.
process.run(false);
myapp.exe
(which yes, it is located in C:\
root) is an application that just has an empty/default form, it is developed in .NET platform (C#), targetting .NET Framework 4.5 on WinForms technology. I also tried to run other applications like Notepad (specifying the full filepath) with no results. I also tried to change the "://.mozilla.org/*" pattern to match other websites.
QUESTION
I'm doing something wrong?, how can I run that executable?.
Additionally and optionally, I will apreciate so much if someone could explain me how could I debug what is happening in my code (to discover errors/exceptions) after the script is loaded in Firefox, because I'm totally blind in that manner, I just can say the script "does nothing" (because it does not run the external execuaable) but I have no control over the code at all because I'm missing where to find the debugging instrumental.