Bug 735219 - Fix conflict between BigFile and Twitter's http.jsm files, r=bienvenu.
This commit is contained in:
Родитель
3f030dc0ba
Коммит
924d2d5972
|
@ -42,7 +42,6 @@ VPATH = @srcdir@
|
|||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
EXTRA_JS_MODULES = \
|
||||
http.jsm \
|
||||
imContentSink.jsm \
|
||||
imServices.jsm \
|
||||
imSmileys.jsm \
|
||||
|
@ -53,6 +52,10 @@ EXTRA_JS_MODULES = \
|
|||
socket.jsm \
|
||||
$(NULL)
|
||||
|
||||
ifndef MOZ_THUNDERBIRD
|
||||
EXTRA_JS_MODULES += http.jsm
|
||||
endif
|
||||
|
||||
EXTRA_PP_JS_MODULES = \
|
||||
hiddenWindow.jsm \
|
||||
imTextboxUtils.jsm \
|
||||
|
|
|
@ -6,11 +6,11 @@ var EXPORTED_SYMBOLS = ["doXHRequest"];
|
|||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
function doXHRequest(aUrl, aHeaders, aMethod, aPOSTData, aOnLoad, aOnError, aThis) {
|
||||
function doXHRequest(aUrl, aHeaders, aPOSTData, aOnLoad, aOnError, aThis, aMethod) {
|
||||
var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
xhr.mozBackgroundRequest = true; // no error dialogs
|
||||
xhr.open(aMethod, aUrl);
|
||||
xhr.open(aMethod || (aPOSTData ? "POST" : "GET"), aUrl);
|
||||
xhr.channel.loadFlags = Ci.nsIChannel.LOAD_ANONYMOUS | // don't send cookies
|
||||
Ci.nsIChannel.LOAD_BYPASS_CACHE |
|
||||
Ci.nsIChannel.INHIBIT_CACHING;
|
||||
|
@ -56,6 +56,14 @@ function doXHRequest(aUrl, aHeaders, aMethod, aPOSTData, aOnLoad, aOnError, aThi
|
|||
});
|
||||
}
|
||||
|
||||
xhr.send(aPOSTData);
|
||||
let POSTData = aPOSTData || "";
|
||||
if (Array.isArray(POSTData)) {
|
||||
xhr.setRequestHeader("Content-Type",
|
||||
"application/x-www-form-urlencoded; charset=utf-8");
|
||||
POSTData = aPOSTData.map(function(p) p[0] + "=" + encodeURIComponent(p[1]))
|
||||
.join("&");
|
||||
}
|
||||
|
||||
xhr.send(POSTData);
|
||||
return xhr;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ OAuth.prototype = {
|
|||
let authorization =
|
||||
"OAuth " + params.map(function (p) p[0] + "=\"" + p[1] + "\"").join(", ");
|
||||
let headers = (aHeaders || []).concat([["Authorization", authorization]]);
|
||||
return doXHRequest(url, headers, aMethod, aPOSTData, aOnLoad, aOnError, aThis);
|
||||
return doXHRequest(url, headers, aPOSTData, aOnLoad, aOnError, aThis, aMethod);
|
||||
},
|
||||
_parseURLData: function(aData) {
|
||||
let result = {};
|
||||
|
|
Загрузка…
Ссылка в новой задаче