javascript - 从 Firefox 中的现有页面打开窗口出现安全错误

标签 javascript firefox firefox-addon

我正在开发一个 Firefox 扩展。在网页的客户端,我添加一个链接,单击该链接后,我打算打开一个窗口,允许用户在其中输入文本。当我单击链接时,它会打开窗口,但不允许我写入。

例如 ww.document.write('<div id = "textDiv">') ; 这里它给了我一个错误:

Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "chrome://googbar/content/googbar.js Line: 272"]

我使用以下命令打开窗口:

var ww = Components.classes[
    "@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher);
var wm =Components.classes["@mozilla.org/appshell/window-mediator;1"]

calWindow = ww.openWindow(null,'calendarWindow',null, 'left =500, top = 190, width = 230, height = 220,titlebar = no', null); 

打开的窗口不是空窗口,它包含父窗口的内容。例如,我从维基百科打开此窗口,打开的新窗口包含其上的维基页面。

最佳答案

我不完全清楚是什么原因造成的,但是这些 two pages MDC 表明这可能受到 Firefox 3.0 中加强一些安全问题的更改的影响。

虽然不是完整的答案,但这可能会让您走上解决问题的正确轨道。如果没有,请向我们提供有关您要执行的操作的更多详细信息。

关于javascript - 从 Firefox 中的现有页面打开窗口出现安全错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1605483/

相关文章:

css - 在 Firefox 的零高度元素中隐藏伪类内容

python - Selenium Webdriver 中的 Keys.ESCAPE(python)

javascript - document.URL 与 location.href > 无结果

javascript - Jquery-图片库-问题

javascript - 类型错误: null 不是对象(计算 'document.getElementById(x).style' )

python - 页面未在 Windows 上使用 Python 加载到 Selenium WebDriver 中

firefox-addon - 使用 Firefox 扩展存储

javascript - Mocha : Is there a scenario where a before hook would run after a test?

javascript - Promise 解析时 JSON 输入意外结束

javascript - 获取真正的 HTML5 视频宽度和高度