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
GM.xmlHttpRequest not reaching readyState==4 #2980
Comments
https://wiki.greasespot.net/Greasemonkey_Manual:Getting_Help#What_to_Say Exact version of everything involved? Exact script that produces this? |
https://github.com/greasemonkey/greasemonkey/blob/master/test/scripts/api-xhr.user.js We didn't have one (!) so I just added a test script, which for me logs:
I.e. it works. |
On Mon, 2 Jul 2018, arantius wrote:
gm_xhr onprogress total: 1081 GM.xmlhttpRequest() test.:509:5
GM_xmlhttpRequest works: <!DOCTYPE HTML PUBLIC "-//W3C/ GM.xmlhttpRequest() test.:504:5
I.e. it works.
Thank you. I'll dig a bit deeper to try an make a minimal test case for
the problem.
Peter
|
On Mon, 2 Jul 2018, arantius wrote:
https://github.com/greasemonkey/greasemonkey/blob/master/test/scripts/api-xhr.user.js
We didn't have one (!) so I just added a test script, which for me logs:
Hi,
I've done a few quick tests, and have got the test case down to:
/ ==UserScript==
// @name testpjb
// @Version 1
// @grant GM.xmlHttpRequest
// @include http://(my-desktop).eng.cam.ac.uk/~pjb1008/
// ==/UserScript==
var xmlstring = '<requests><request reqtype="lookup_po" po_number="123456"/></requests>';
var server_url='https://(my-server).eng.cam.ac.uk/my-cgi-script';
GM.xmlHttpRequest({
method: 'POST',
url: server_url,
headers: {'Content-Type': 'text/xml', "Accept": "text/xml" },
data: xmlstring,
onload: function(response) { console.log('load', response) },
onreadystatechange: function(response) { console.log('statechange', response) },
});
I've obscured a few private details, but you get the idea.
If I set server_url to something that returns an ordinary web page, it
just works as expected.
If I set server_url to something that returns an XML document, is stops in
state 3 and never calls onload.
This is the XML document that the server returned:
Content-Type: text/xml; charset=utf8
<?xml version=\"1.0\"?>
<requests>
<request reqtype="lookup_po" po_number="123456" warn="Can't find PO"/>
</requests>
This was visible and complete in the responseText with readyState 3.
If I change the server so that it claims Content-Type: text/plain instead
of text/xml then it gets all the way through to state 4.
Peter
|
@pjb1008 You have not provided the information mentioned in the What to Say link. Specifically, Operating System and Firefox version. I mention this because I'm tracking down an issue in a script I support that is also related to |
On Tue, 3 Jul 2018, Makyen wrote:
@pjb1008 You have not provided the information mentioned in the What to Say
link. Specifically, Operating System and Firefox version.
I mention this because I'm tracking down an issue in a script I support that
is also related to GM.xmlHttpRequest(), but which I haven't been able to
duplicate in all environments. Thus, to know if the problem is the same as
this one, it would be helpful to have those details from you.
Hi,
My issue was on Firefox 60 on SuSE Linux 13.1. The firefox is the version
downloaded from mozilla.org, not one packaged by SuSE or its contributors.
I have the following extensions:
- FoxyProxy Standard
- Disable JavaScript
- Stylish
- GreaseMonkey (obviously)
The problem was reported to me by a Windows user - I shall check the
version they were using tomorrow.
Peter
|
On Wed, 4 Jul 2018, P. Benie wrote:
The problem was reported to me by a Windows user - I shall check the version
they were using tomorrow.
The Windows machine exhibiting the same problem was FF60 on Windows 10 version 1803.
Peter
|
@pjb1008 Hmm if you could add in a real url, then people could test it more easily. Would it be possible to replace the censored url with some other, real url that testers can access? |
This script directly reproduces the failure; onprogress fires but onload does not, when response is XML. |
Finally found a traceback of the error:
The true failure seems to be in passing the message. I "fixed" a bug that copied the |
This should be fixed in the latest nightly build ( https://arantius.com/misc/gm-nightly/greasemonkey-2018.07.09.nightly.33eca3f6.xpi ). Confirmation would be great! |
Hi,
I am using GM.xmlHttpRequest to send and receive XML documents. (They're actually just strings as far as GM is concerned - I serialise and parse them myself.)
This worked in GM 4.4, but with GM 4.5 the onload function is never called so my program stops at that point. onreadystatechange is called with readyState 3, but the readyState never gets to 4.
I can't see anything in the changelog that looks like a relevant change. Any help would be appreciated.
Peter
The text was updated successfully, but these errors were encountered: