javascript - 如何修复 Greasemonkey (GM_xmlhttpRequest) 上的 __exposedProps__ 错误?

标签 javascript firefox greasemonkey gm-xmlhttprequest

我已经为 Greasemonkey 编写了我的第一个脚本,它工作得很好,除了它在它正在处理的每个页面中返回 exposedProps 错误。我已经修复了所有其他错误,但这个错误仍然存​​在,并且基于网络上的一些文章(如 this )它会在未来发布 Firefox 17 时破坏我的脚本。 (现在我正在使用 Firefox 15.0,幸运的是它只是返回一个警告错误!)

我在脚本中使用 GM_xmlhttpRequest:

function doProcess(id, in_process_type){

    var set_id = GM_getValue("pid"+id);

    GM_xmlhttpRequest({
        method: "POST",
        url: "https://website_address/return_params.php",
        data: "pid="+set_id,
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        onload: function(response) {
    --->    var params = response.responseText;
            params = params.replace(/(\r\n|\n|\r|\s)/gm,"");

            ..........
        }
    });
}

这是错误消息,指的是我在它前面放了一个箭头的行:

Error: Exposing chrome JS objects to content without __exposedProps__ is insecure and deprecated. See https://developer.mozilla.org/en/XPConnect_wrappers for more information.
Source File: file:///Users/Mona/Library/Application%20Support/Firefox/Profiles/tonfd656.default/gm_scripts/MonaTest/MonaTest.user.js
Line: 133 

我找到了这个 page ,它提供了解决此错误的方法,但老实说,我不知道如何在这里使用它!

非常感谢您提前提供的所有帮助... 感谢您的宝贵时间!

最佳答案

这是 Greasemonkey 本身的一个问题/潜在错误。见:

您可能想要权衡并跟踪这些错误报告。

如果您链接到您的完整脚本,我们可能会提供解决方法,但很可能只能在 Greasemonkey 本身内修复。

关于javascript - 如何修复 Greasemonkey (GM_xmlhttpRequest) 上的 __exposedProps__ 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12187805/

相关文章:

javascript - 在 JavaScript 中创建嵌套对象值的 SUM

Javascript 基础知识 : variable scope

php - 通过 PHP 从 javascript 计数器中提取信息

javascript - 如何使用简单的 html 解析器或其他东西获取值

javascript - 如何在 JavaScript 和 FireFox 中获取 innerXml 或 outerXml

javascript - Greasemonkey 代码将 Youtube iFrame 放入剧透中

javascript - 从 firefox 侧边栏监视选定选项卡中的页面加载事件

javascript - 在 Firefox 中动态设置 style.overflow 的问题

javascript - 如何填写表单并在页面加载时按提交

javascript - 如何在 greasemonkey 中更新用户脚本