Manifest V3, Dynamic code execution

77 views
Skip to first unread message

Manish Golcha

unread,
Feb 25, 2025, 7:20:25 AMFeb 25
to Chromium Extensions

I'm planning to develop a Chrome extension, and since Manifest V2 will soon be deprecated, I'll be using Manifest V3. However, I have some specific requirements that I haven't been able to fully address yet. Here's a list of the items I need support with:

  1. Dynamic code execution: I need to execute code that will be received as a string from the server within the Chrome extension.
  2. DOM access: I need to interact with the DOM while executing the above code.


So far, here's what I've found:

  1. Dynamic code execution is not allowed, as mentioned here and here, due to policy violations.
  2. I can run dynamic code in a sandbox as suggested here, but I can't access the DOM from within the sandbox.
  3. DOM access is also unavailable in Service Workers, as noted in this Chrome documentation.
  4. I can access the DOM using user scripts, but I can't ask users to enable developer mode.


Is there any other way to achieve the tasks mentioned above?

Thanks and regards!

Oliver Dunk

unread,
Feb 25, 2025, 7:25:17 AMFeb 25
to Manish Golcha, Chromium Extensions
Hi Manish,

To clarify, are you saying you don't want to ask users to enable developer mode or that you are concerned about the policy implications?

Asking users to enable developer mode is completely fine and would be our recommended approach. We do appreciate that not all users will be comfortable doing so, and that having a single switch that applies to all extensions is unfortunate - that is something we are actively looking into.

Another approach allowed by our policy is using the debugger API - however this probably isn't the right choice. This is tricky to set up and shows a banner to users letting them know that an extension is controlling their browser.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
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 visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/70cd1965-329e-443d-aed3-3b56da6086cdn%40chromium.org.
Reply all
Reply to author
Forward
0 new messages