Bug 1307852 - Pass ID of calling add-on to native messaging app r=aswan

This allows native messaging binaries to identify the add-on that
invoked the native messaging app, in case more than one add-on is
allowed to launch the native messaging app.

MozReview-Commit-ID: GgjwfJDbBkW

--HG--
extra : rebase_source : b60d33e9f3936f26b8792ef5cd1f9fea304f29ae
This commit is contained in:
Rob Wu 2017-06-01 19:08:02 +02:00
parent 34fee886ae
commit 7802980fa2
2 changed files with 3 additions and 2 deletions

View File

@ -198,7 +198,7 @@ this.NativeApp = class extends EventEmitter {
let subprocessOpts = {
command: command,
arguments: [hostInfo.path],
arguments: [hostInfo.path, context.extension.id],
workdir: OS.Path.dirname(command),
stderr: "pipe",
};

View File

@ -435,8 +435,9 @@ add_task(async function test_child_process() {
await extension.startup();
let msg = await extension.awaitMessage("result");
equal(msg.args.length, 2, "Received one command line argument");
equal(msg.args.length, 3, "Received two command line arguments");
equal(msg.args[1], getPath("info.json"), "Command line argument is the path to the native host manifest");
equal(msg.args[2], ID, "Second command line argument is the ID of the calling extension");
equal(msg.cwd.replace(/^\/private\//, "/"), tmpDir.path,
"Working directory is the directory containing the native appliation");