1

I am developing new webextension using openpgpjs. The problem is, they use AsmJS for some of their JS functions and I am unable to develop it on firefox.

I have encountered problem only on firefox. I tried different versions, but it only changes the error message (sometimes, it is only warning message and it fails when I try to call functions using AsmJS. On chrome, it works fine. The error message from firefox v69.0 is Error: AsmJS modules do not yet support cloning. and nor line in code nor module name is provided. Error is displayed in JS console every time openpgpjs module is loaded with my webextension.

Is there some way, how I can force browsers to not use AsmJS and just "fall back" into "native" javascript? Or maybe somehow disable debugging for library script? Include script different way in manifest file, so browser will not try to run debugger on it? (I want to disable debugging because I belive, that debugger is unable to debug code translated via AsmJS).

This is how I load both my JS script and library in manifest file. There are no background scripts.

{
"content_scripts" : [
        {
            "matches" : [ "*://*.testdomain.cz/*" ],
            "js": [
                "/src/js/openpgp.min.js",
                "/src/js/pgpDecryptor.js"
            ]
        }
    ]
}
Tehryn
  • 57
  • 1
  • 10
  • 1
    Not sure why you mention debugging; you can disable asm.js by removing [`"use asm"`](https://stackoverflow.com/a/44697111/1026) from the library you include or by [disabling asm.js in your browser altogether](https://vincentdelft.be/post/post_20181001) via `javascript.options.asmjs`. – Nickolay Sep 11 '19 at 13:21
  • @Nickolay Sure I can remove "use asm", but that is not the solution I am asking for (but it is the only solution for me so far). AsmJS is disabled and because of that, I am unable to use those functions. And if I enable it, I cannot debug my extenstions and as long aa there are functions with "use asm". I guess I will remove "use asm" until I figure something else out. – Tehryn Sep 12 '19 at 17:28
  • You're hitting an [unimplemented code path](https://searchfox.org/mozilla-central/rev/878bbf3cb8897a208454df27535f3522ab482cf2/js/src/vm/JSScript.cpp#4534). If want the JS engine to fall back to "native" JavaScript *upon hitting such a situation*, I'm afraid you'll find that it's not implemented. It's curious that you mention you're "unable to use" the functions with asm.js disabled (via the pref, I assume). I'd expect them to run as regular JS with asm.js disabled. – Nickolay Sep 12 '19 at 18:51

1 Answers1

1

Since I was unable to find better solution, I deleted "use asm" from library functions (as meintioned in comments by @Nickolay).

Tehryn
  • 57
  • 1
  • 10