我正在编写一个 Firefox 扩展。它应该拦截对
eval
或 innerHTML
等函数的调用。
目前,我无法执行此操作,因为 Firefox 会阻止覆盖这些属性。尽管甚至使用 XPCNativeWrapper.unwrap 或 window.wrappedJSObject 方法。 我如何才能实现我所需要的,可能以任何其他方式?
mozilla 文档说内容脚本可能会在目标页面内执行一些代码。为此,需要:
window.eval(`
<here goes the code that will have access to the page's window and objects>
`);