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 doesn't report connection errors #1008
Comments
The problem seems to arise from this xmlhttprequester.js chunk, part of setupRequestEvent():
setupRequestEvent() is actually building our handlers for onload, onerror and onreadystatechange events from a single "prototype" function. The above code assumes that, when readyState==4 (operation is complete) there will be a usable getAllResponseHeaders(), which does not seem to be the case:
Fixing it raises a similar issue with statusText:
I'm not sure whether it's a mozilla bug or not. Documentation does not talk about it, afaict. I reckon though that it does not make much sense to read headers or the HTTP status response when the connection has failed... Beside that (unless there's more hiding and waiting to be exposed) the fix is trivial:
|
I'd say we apply that; hurts less than not to. (I do see how you think, though, if you're considering it sort of a layering violation fixing bugs in the underlying mozilla layer, but I'm not convinced it is an example of that -- as you note, there wouldn't be any headers to get in an error case, and we're probably the better place to catch it.) |
FYI everything above I copy/pasted from DevjaVu just so it wouldn't get lost. I personally haven't looked at this much yet, but it seems very reasonable. |
Yes, that was my prose. :-p |
Patch available, no obvious backwards compatibility issues. Tagged for v.next |
Originally: DevjaVu ticket 100
GM_xmlhttpRequest doesn't call onerror callback function when some connection error occurs (cannot find address in DNS, server refuses connections, timeout, etc.)
The text was updated successfully, but these errors were encountered: