【发布时间】:2015-08-15 05:09:15
【问题描述】:
我正在使用一个模仿 nodejs require 的 custom require 函数,它工作正常。
但是,在 electron 中,我得到了
SecurityError: An attempt was made to break through the security policy of the user agent.
在自定义所需代码中调用 window.addEventListener 时。
如果我能阅读 electron 的 'require' 函数的源代码,我可能会理解我的版本失败的原因。
【问题讨论】:
-
我在一些函数上使用了 toString() 来发现差异。唯一的变化与 Module._contextload 剥离有关。