How to load Native Client Module manifest format (.nmf) in firefox extension background.js

262 Views Asked by At

I am developing an extension which supports native messaging for firefox, I want to encrypt my request/response while sending to native application, to achieve the same, I m trying to embed secureChannel.nmf (Native Client Manifest format) file in background.js file of the extension, but it does not work and the same works fine in chrome extension.

==========================================

SecureChannel.nmf file contains:

{
  "program": {
    "portable": {
      "pnacl-translate": {
        "url": "SecureChannel.pexe"
      },
      "pnacl-debug": {
        "url": "SecureChannel_unstripped.bc"
      }
    }
  }
}

=========================================

background.html

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

</head>
<body>
    <div id="listenser">
        <embed name="moto_native_cl" id="moto_native_cl" path="nacl" src="../nacl/SecureChannel.nmf" type="application/x-pnacl" />
    </div>

    <script src="../scripts/background.js"></script>
</body>
</html>

================================================================

I get this error: The character encoding of a framed document was not declared. The document may appear different if viewed without the document framing it.

I have a call in background.js var msg = NativeClient.naclModule.postMessageAndAwaitResponse(makeMessage('generateEcdhKey', ''));

for this call, it throws error as postMessageAndAwaitResponse is not function.

Can we use the same .nfm file which I m using for chrome extension, if not, let me know the alternative in firefox for the same.

0

There are 0 best solutions below