wasm with Manifest v3

5,312 views
Skip to first unread message

Cameron Taggart

unread,
Jan 31, 2021, 2:22:13 PM1/31/21
to Chromium Extensions
I wrote my Chrome extension primarily using Rust compiled to WebAssembly. How do I allow the wasm module to be loaded using the Manifest v3 format? With Manifest v2, I have this:

  "content_security_policy": "script-src 'self' 'wasm-eval'; object-src 'self'",

With Manifest v3, I get an error with this:

  "content_security_policy": {
    "extension_pages": "script-src 'self' 'wasm-eval'; object-src 'self'"
  },

Error
'content_security_policy.extension_pages': Insecure CSP value "'wasm-eval'" in directive 'script-src'.
Could not load manifest.

Without wasm-eval, I get this error:

Uncaught (in promise) CompileError: WebAssembly.instantiateStreaming(): Wasm code generation disallowed by embedder

What can I do to load wasm modules using the Manifest v3 format?

Deco

unread,
Jan 31, 2021, 2:40:27 PM1/31/21
to Cameron Taggart, Chromium Extensions
As per the Manifest V3 documentation, it is not directly possible to load WASM files with V3.
image.png
See the MV3 migration guide for instructions on how to implement remote configurations.

Thanks,
Deco

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/CAABik%3DupZxNqAwzWvLOjK552%3D_jryE9wYwBSJvRwdM%2BQjuabtw%40mail.gmail.com.

Cameron Taggart

unread,
Jan 31, 2021, 2:54:28 PM1/31/21
to Deco, Chromium Extensions
The wasm module is not remotely hosted.

Jackie Han

unread,
Feb 1, 2021, 12:15:34 AM2/1/21
to Cameron Taggart, Chromium Extensions
The key problem is that the browser disallows various 'eval' in Manifest v3.


PS: I am not very familiar with wasm, but the problem should be this.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/CAABik%3DupZxNqAwzWvLOjK552%3D_jryE9wYwBSJvRwdM%2BQjuabtw%40mail.gmail.com.


--
Jackie Han

wOxxOm

unread,
Feb 1, 2021, 9:29:26 AM2/1/21
to Chromium Extensions, Jackie Han, Chromium Extensions, cameron...@gmail.com
There's https://crbug.com/948834 but I think you should open a new issue on https://crbug.com/  specifically about ManifestV3 because it's pretty likely Chromium developers are unaware they broke this feature.

Maksim Ivanov

unread,
Feb 1, 2021, 12:03:48 PM2/1/21
to cameron...@gmail.com, Chromium Extensions, Jackie Han, wOxxOm

Simeon Vincent

unread,
Feb 1, 2021, 3:35:17 PM2/1/21
to Chromium Extensions, Maksim Ivanov, Chromium Extensions, Jackie Han, wOxxOm, cameron...@gmail.com
+1 to the bug report request. More specially, please file a bug for adding Wasm support to MV3. This may be caused by a technical limitation of what's possible in in Chrome rather than a MV3 specific oversight, but regardless having an issue to specifically track this use case will help us chase it down.

Cheers,

Simeon - @dotproto
Chrome Extensions DevRel

Cameron Taggart

unread,
Feb 1, 2021, 11:12:37 PM2/1/21
to Simeon Vincent, Chromium Extensions, Maksim Ivanov, Jackie Han, wOxxOm

ULViDO

unread,
Mar 17, 2021, 7:48:33 AM3/17/21
to Chromium Extensions, sim...@chromium.org, em...@chromium.org, han.g...@gmail.com, wox...@gmail.com
thank you for opening this post. I have the exact same issue. I have a local .wasm file crated with rust but can't be able to run in mv3. any luck?
Reply all
Reply to author
Forward
0 new messages