0

I'm having trouble executing eval() and friends for alasql, it is not supported to manifest v3 migration for chrome extension. Based from their Manifest V3 migration checklist:

You can no longer execute external logic using chrome.scripting.executeScript({code: '...'}), eval(), and new Function().

And got this error:

Uncaught (in promise) EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

Alasql is using the 'new Function()' class/method thingy, and it causes error in manifest v3.

Does anyone have encountered the same issue?

  • You will have to run this code inside the [page context](/a/9517879). – wOxxOm Mar 07 '22 at 05:33
  • I did have the same issue with a node_module in my extension. I think it's due to this: https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/#remotely-hosted-code. The second bullet point under the remotely hosted code header states that a code string passed into eval at runtime is not allowed. Not sure about the `new Function` issue – mikey Mar 21 '22 at 04:14

0 Answers0