mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-12 11:15:44 +01:00
Add redirect magic for HEAD XMLHttpRequests.
This commit is contained in:
@@ -783,6 +783,17 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
if (params.mimeType)
|
if (params.mimeType)
|
||||||
xmlhttp.overrideMimeType(params.mimeType);
|
xmlhttp.overrideMimeType(params.mimeType);
|
||||||
|
|
||||||
|
if (params.method == "HEAD" && !params.notificationCallbacks)
|
||||||
|
params.notificationCallbacks = Class(XPCOM([Ci.nsIChannelEventSink, Ci.nsIInterfaceRequestor]), {
|
||||||
|
getInterface: function getInterface(iid) this.QueryInterface(iid),
|
||||||
|
|
||||||
|
asyncOnChannelRedirect: function (oldChannel, newChannel, flags, callback) {
|
||||||
|
if (newChannel instanceof Ci.nsIHttpChannel)
|
||||||
|
newChannel.requestMethod = "HEAD";
|
||||||
|
callback.onRedirectVerifyCallback(Cr.NS_OK);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
let args = [params.method || "GET", url, async];
|
let args = [params.method || "GET", url, async];
|
||||||
if (params.user != null || params.pass != null)
|
if (params.user != null || params.pass != null)
|
||||||
args.push(params.user);
|
args.push(params.user);
|
||||||
|
|||||||
Reference in New Issue
Block a user