Falkon Greasemonkey's GM_xmlhttpRequest doesn't function as expected

Myah Caron qsniyg at mail.com
Thu Jan 23 21:45:23 GMT 2020


Hi,

Here are a few issues I ran into with Falkon's GM_xmlhttpRequest implementation:

 * GM_XHR returns an XHR object, which doesn't the responseHeaders property (which is a property GM_xmlhttpRequest is expected to return). A quick fix for this could be to just add a small wrapper around the on* calls, such as something like:

oXhr.onload = function() {
	var resp = {
		readyState: oXhr.readyState,
		finalUrl: oXhr.responseURL,
		responseHeaders: oXhr.getAllResponseHeaders(),
		responseType: oXhr.responseType,
		status: oXhr.status,
		statusText: oXhr.statusText
	};

	resp.response = oXhr.response;

	try {
		resp.responseText = oXhr.responseText;
	} catch (e) {}

	details.onload(resp);
};

 * The onprogress event isn't supported.
 * Restricted headers (such as Referer) aren't allowed (as expected from running an XMLHttpRequest query within the browser). This is relatively important functionality, as it's one of the main reasons why GM_XHR is used over normal XHR calls (one of the others is being able to use HTTP requests on an HTTPS site, which I believe is also not allowed through this implementation).

I've temporarily worked around these issues by using the browser's XHR implementation instead of Falkon's if it detects Falkon as the userscript manager, but I'm reporting these issues in case you guys would like to fix them on your end :)

Thanks!


More information about the Falkon mailing list