如何显示其中包含动态内容 (HTML) 的面板

How to show panel with dynamic content (HTML) in it

我想在用户按下浏览器工具栏上我的插件按钮时显示包含 HTML 内容的下拉菜单。

看来我需要按照文档中的建议使用 panel,但问题是我的内容是动态的,并且在插件工作时可能会随时间变化。 AFAIK panel 只能使用预定义的 HTML 文件并通过 contentScript 属性 提供的脚本更改其内容,但即便如此,文档中也明确指出它可以导致对于未批准的插件:

Warning: Unless your content script is extremely simple and consists only of a static string, don't use contentScript: if you do, you may have problems getting your add-on approved on AMO.

Instead, keep the script in a separate file and load it using contentScriptFile. This makes your code easier to maintain, secure, debug and review.

那我该怎么办?

您引用的段落是指使用 contentScript 参数定义复杂脚本。如果您使用 contentScriptFile 加载脚本,然后修改 HTML 应该没问题。