There seems to be an issue with the executeScript_Sandbox in the new Firefox version released yesterday. Simple scripts (with no ES6 methods) that ran fine in the prior Firefox version, and run correctly in the current Chrome version, are now returning “undefined”.
In the current version of Chrome and Firefox version 6.2.8, this will return “8495” as expected. In the new Firefox version, Sandbox returns “undefined”. If I change it to just “executeScript” in the new Firefox version, it returns “8495”.
So after some more research it turns out that we cannot process REGEX in Firefox Manifest V3 with the JS-interpreter library that we are using. The reason is explained here:
Firefox MV3 doesn’t allow ‘unsafe-eval’ or blob: for script-src. But the JS-interpreter is using Worker that uses blob which is not permitted for Firefox MV3. In fact, for evaluating regex they use some kind of vm (browser/node-server) environment. We have also not been able to find another JS library that manages to work around this restriction (yet). If anyone has a suggestion, please let us know.
Technical details aside, this means that executeScript_Sandbox works fine in Firefox except that it can not process any regular expression. If you have regular expression in your Javascript, you will get the error E501.
Thank you for the suggestion. Looks like executeScript is the only immediate solution as I have well beyond a thousand regex expressions throughout my macros. While rewriting the scripts would certainly be good practice for my JS skills , hopefully there will eventually be a JS interpreter that handles regex (and ES6+) in a way that is V3-compliant for all browsers. Thanks again for the help.
A hint for those that can not use executeScript: ChatGPT solved the “rewrite” problem for me. It translated the old executeScript_sandbox code with regex into perfect executeScript_sandbox code without regex.