Skip to content

[BUG] data: URLs fail in GMxhr since upload API #2421

@qsniyg

Description

@qsniyg

Sequence of actions:

Install this userscript:

// ==UserScript==
// @name        GMxhr upload crash on data urls
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @grant       GM_xmlhttpRequest
// @version     1.0
// @author      -
// ==/UserScript==

(() => {
  GM_xmlhttpRequest({
    url: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
    onload: function(resp) {
      console.log("Loaded", resp);
    }
  })
})();

Problem:

injected-web.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'load')
    at Boolean.HttpRequested (injected-web.js:1:6608)
    at Object.onHandle (injected-web.js:1:3313)
    at injected-web.js:1:4151
HttpRequested	@	injected-web.js:1
onHandle	@	injected-web.js:1
(anonymous)	@	injected-web.js:1
await in (anonymous)		
qe	@	injected-web.js:1
He.n.post	@	injected-web.js:1
Ie	@	injected-web.js:1
st	@	injected-web.js:1
St.GM_xmlhttpRequest.Ct.xmlHttpRequest	@	injected-web.js:1
(anonymous)	@	GMxhr upload crash o…ata urls.user.js:11
(anonymous)	@	GMxhr upload crash o…ata urls.user.js:17
VM3vg2im3w0y	@	GMxhr upload crash o…ata urls.user.js:18
ln	@	injected-web.js:1
(anonymous)	@	GMxhr upload crash o…data urls.user.js:1

This commit seems to be the problem: 41fb13f#diff-58daed437882cc34742b2ce6fb14ef38d77858bb3cc5bb6a209c1db56aeab0ccR62-R64

Expected result:

It shouldn't crash.

Devtools console contents:

Environment:

  • OS: Linux
  • Browser: Chromium 143
  • Violentmonkey Version: 2.32.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions