Skip to content

[BUG] 夸克 后台脚本GM_xmlhttpRequest 报错 #939

Description

@ChitaGideon

问题描述

Image
// ==UserScript==
// @name         New Userscript2222
// @namespace    https://bbs.tampermonkey.net.cn/
// @version      0.1.0
// @description  try to take over the world!
// @author       You
// @crontab      * * once * *
// @grant        GM_log
// @grant    GM.xmlHttpRequest
// @grant        GM_xmlhttpRequest
// @connect baidu.com
// @connect httpbin.org
// ==/UserScript==
console.log = (...arg) => {
    GM_log(arg.map(it => typeof it == 'string' ? it : JSON.stringify(it)).join(","))
}

return new Promise((resolve, reject) => {
    // Your code here...
    // downloadImg('http://httpbin.org/image/jpeg').then(resolve);
    GM.xmlHttpRequest(
        {
            method: 'GET',
            url: 'http://httpbin.org/image/jpeg',
            // headers: { 'Content-Type': 'text/xml', "Accept": "text/xml" },
            responseType: "blob",
            // data: xmlstring,
            onload: function (response) { console.log('load');resolve() },
            onreadystatechange: function (response) { console.log('statechange', response) },
        }
    )
});

重现步骤

1.点击执行上述代码
2.日志报错。

脚本猫版本

v1.2.0-beta.3

操作系统以及浏览器信息

mac quark 4.6.5.581

补充信息 (选填)

2025-11-11 18:41:00 GM_xmlhttpRequest error {"env":"sandbox","code":-1,"message":"Cannot read properties of undefined (reading 'getAll')"}
2025-11-11 18:41:00 connectHandle error {"env":"service_worker","service":"messageServer","error":"Cannot read properties of undefined (reading 'getAll')"}
2025-11-11 18:40:43 GM_xmlhttpRequest error {"env":"sandbox","code":-1,"message":"Cannot read properties of undefined (reading 'getAll')"}
2025-11-11 18:40:43 connectHandle error {"env":"service_worker","service":"messageServer","error":"Cannot read properties of undefined (reading 'getAll')"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions