Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Firefox] GM_xmlhttpRequest/GM.xmlHttpRequest regression in v2.12.12+ #1255

Closed
chocolateboy opened this issue Apr 12, 2021 · 1 comment · Fixed by #1256
Closed

[Firefox] GM_xmlhttpRequest/GM.xmlHttpRequest regression in v2.12.12+ #1255

chocolateboy opened this issue Apr 12, 2021 · 1 comment · Fixed by #1256
Assignees
Labels

Comments

@chocolateboy
Copy link

chocolateboy commented Apr 12, 2021

What is the problem?

GM_xmlhttpRequest and GM.xmlHttpRequest don't work in some cases in Violentmonkey >= v2.12.12, but work in v2.12.11 and v2.12.10.

How to reproduce it?

  1. Install the script below
  2. Run it on an IMDb movie page (e.g.) with no other scripts running on the page
  3. On the legacy/current site, an alert should appear showing details of the response
  4. On the new (React) site, the request is not executed and the alert is not shown

What is the expected result?

alert("response: 200 OK (1256 bytes)")

What is the actual result?

No alert. The request is not initiated; no progress, state-change, error or load events are fired; no error is logged.

Works in

  • Violentmonkey v2.12.11
  • Tampermonkey 4.12.6132
  • Greasemonkey 4.11 (just GM.xmlHttpRequest)

Doesn't work in

  • Violentmonkey 2.12.12 - 2.12.14

Script

// ==UserScript==
// @name          XHR Test
// @description   Test XHR regression in Violentmonkey on the new IMDb site
// @version       0.0.1
// @namespace     test
// @include       https://www.imdb.tld/title/*
// @grant         GM.xmlHttpRequest
// @noframes
// ==/UserScript==

const request = {
    method: 'GET',
    url: 'https://www.example.com/',
    onerror: console.error,
    onload (res) {
        const { length } = res.responseText
        alert(`response: ${res.status} ${res.statusText} (${length} bytes)`)
    },
}

GM.xmlHttpRequest(request)

Environment

  • Browser: Firefox 87.0
  • Violentmonkey: 2.12.14
  • OS: Linux (Arch)
@gera2ld gera2ld added the bug label Apr 13, 2021
@gera2ld
Copy link
Member

gera2ld commented Apr 13, 2021

Introduced by #1235 .

In Firefox with released version of Violentmonkey, the script is injected even before the page loading event is triggered, as a result, the initiated requests are immediately canceled when loading event is triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants