Bug 1402755 - Stop using nsIXMLHttpRequest constructor; use the regular XMLHttpRequest one instead. r=aceman,philipp

--HG--
extra : rebase_source : 544e2ca8b17971816823cc80cf1765ce63a17cff
This commit is contained in:
Thomas Wisniewski 2017-09-25 17:08:28 -04:00
Родитель 1b4a7d6b86
Коммит 5257b69670
8 изменённых файлов: 30 добавлений и 38 удалений

Просмотреть файл

@ -10,6 +10,8 @@ Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/Preferences.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.importGlobalProperties(["XMLHttpRequest"]);
//
// The front-end wizard bits.
//
@ -232,8 +234,7 @@ var gDataMigrator = {
// Let this be a lesson to anyone designing APIs. The RDF API is so
// impossibly confusing that it's actually simpler/cleaner/shorter
// to simply parse as XML and use the better DOM APIs.
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Components.interfaces.nsIXMLHttpRequest);
var req = new XMLHttpRequest();
req.open('GET', "file://" + dataSource.path, true);
req.onreadystatechange = function calext_onreadychange() {
if (req.readyState == 4) {

Просмотреть файл

@ -6,6 +6,8 @@
Components.utils.import("resource://calendar/modules/calUtils.jsm");
Components.utils.importGlobalProperties(["XMLHttpRequest"]);
this.EXPORTED_SYMBOLS = ["cal"];
cal.xml = {} || cal.xml;
@ -132,9 +134,7 @@ cal.xml.parseString = function(str, docUri, baseUri) {
* @return The DOM Document resulting from the file.
*/
cal.xml.parseFile = function(uri) {
let req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Components.interfaces.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
req.open("GET", uri, false);
req.overrideMimeType("text/xml");
req.send(null);

Просмотреть файл

@ -549,8 +549,7 @@ var specialTabs = {
iconUri.spec);
});
let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let request = new XMLHttpRequest();
request.open("GET", url, true);
request.responseType = "document";
request.onload = onDownload;

Просмотреть файл

@ -20,6 +20,8 @@ Cu.import("resource:///modules/errUtils.js");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/mailServices.js");
Cu.importGlobalProperties(["XMLHttpRequest"]);
/* :::::::: The Module ::::::::::::::: */
var mailInstrumentationManager =
@ -159,8 +161,7 @@ var mailInstrumentationManager =
},
_postData: function minst_postData() {
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
let url = Services.prefs.getCharPref("mail.instrumentation.postUrl");
if (!url.length)
return;

Просмотреть файл

@ -17,7 +17,7 @@ Cu.import("resource:///modules/cloudFileAccounts.js");
Cu.import("resource:///modules/OAuth2.jsm");
Cu.import("resource://gre/modules/Http.jsm");
Cu.importGlobalProperties(["File"]);
Cu.importGlobalProperties(["File", "XMLHttpRequest"]);
var gServerUrl = "https://api.box.com/2.0/";
var gUploadUrl = "https://upload.box.com/api/2.0/";
@ -698,8 +698,7 @@ nsBoxFileUploader.prototype = {
this.box._uploadInfo[this.file.path] = {};
this.box._uploadInfo[this.file.path].uploadUrl = requestUrl;
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
let curDate = Date.now().toString();
this.log.info("upload url = " + requestUrl);

Просмотреть файл

@ -15,6 +15,8 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/gloda/log4moz.js");
Cu.import("resource:///modules/cloudFileAccounts.js");
Cu.importGlobalProperties(["XMLHttpRequest"]);
var gServerUrl = "https://dpi.yousendit.com"; // Production url
// test url var gServerUrl = "https://test2-api.yousendit.com";
@ -324,8 +326,7 @@ nsHightail.prototype = {
this.log.info("getting user info");
let args = "?email=" + this._userName + "&";
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
req.open("GET", gServerUrl + kUserInfoPath + args + kUrlTail, true);
req.onload = function() {
@ -448,8 +449,7 @@ nsHightail.prototype = {
let args = "?email=" + aEmailAddress + "&password=" + aPassword + "&firstname="
+ aFirstName + "&lastname=" + aLastName + "&";
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
req.open("POST", gServerUrl + kUserInfoPath + args + kUrlTail, true);
@ -529,8 +529,7 @@ nsHightail.prototype = {
let args = "?includeFiles=false&includeFolders=true&";
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
req.open("GET",
gServerUrl + kFolderPath + aFolderId + args + kUrlTail,
@ -579,8 +578,7 @@ nsHightail.prototype = {
let args = "?name=" + aName + "&parentId=" + aParent + "&";
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
req.open("POST", gServerUrl + kFolderPath.replace(/\/$/, '') + args + kUrlTail, true);
@ -681,8 +679,7 @@ nsHightail.prototype = {
throw Cr.NS_ERROR_FAILURE;
}
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
let args = kFolderFilePath + uploadInfo.fileId + "?";
@ -814,8 +811,7 @@ nsHightail.prototype = {
this._password = this.getPassword(this._userName, !aWithUI);
let args = "?email=" + this._userName + "&password=" + this._password + "&";
this.log.info("Sending login information...");
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
let curDate = Date.now().toString();
req.open("POST", gServerUrl + kAuthPath + args + kUrlTail, true);
@ -917,8 +913,7 @@ nsHightailFileUploader.prototype = {
* @param failureCallback the callback fired if getting the URL fails
*/
_prepareToSend: function(successCallback, failureCallback) {
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
req.open("POST", gServerUrl + kFolderInitUploadPath + "?" + kUrlTail, true);
@ -958,8 +953,7 @@ nsHightailFileUploader.prototype = {
* the upload of the file to Hightail.
*/
_uploadFile: function() {
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
let curDate = Date.now().toString();
this.log.info("upload url = " + this._urlInfo.uploadUrl[0]);
@ -1008,7 +1002,7 @@ nsHightailFileUploader.prototype = {
// Since js doesn't like binary data in strings, we're going to create
// a temp file consisting of the message preamble, the file contents, and
// the post script, and pass a stream based on that file to
// nsIXMLHttpRequest.send().
// XMLHttpRequest.send().
try {
this._tempFile = this.getTempFile(this.file.leafName);
@ -1049,7 +1043,7 @@ nsHightailFileUploader.prototype = {
this._bufStream = Cc["@mozilla.org/network/buffered-input-stream;1"]
.createInstance(Ci.nsIBufferedInputStream);
this._bufStream.init(this._fstream, 4096);
// nsIXMLHttpRequest's nsIVariant handling requires that we QI
// XMLHttpRequest's nsIVariant handling requires that we QI
// to nsIInputStream.
req.sendInputStream(this._bufStream.QueryInterface(Ci.nsIInputStream));
} catch (ex) {
@ -1082,8 +1076,7 @@ nsHightailFileUploader.prototype = {
*/
_commitSend: function() {
this.log.info("commit sending file " + this._urlInfo.fileId);
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
let args = "?name=" + this.file.leafName +
"&fileId=" + this._urlInfo.fileId +
"&parentId=" + this.hightail._folderId + "&";
@ -1160,8 +1153,7 @@ nsHightailFileUploader.prototype = {
* @param aFailureCallback called if url is not found
*/
_findDownloadUrl: function(aFileId, aSuccessCallback, aFailureCallback) {
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let req = new XMLHttpRequest();
req.open("GET", gServerUrl + kFolderFilePath + aFileId, true);

Просмотреть файл

@ -155,8 +155,7 @@ Feed.prototype =
}
}
this.request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsIXMLHttpRequest);
this.request = new XMLHttpRequest();
// Must set onProgress before calling open.
this.request.onprogress = this.onProgress;
this.request.open("GET", this.url, true);

Просмотреть файл

@ -15,6 +15,8 @@ Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.importGlobalProperties(["XMLHttpRequest"]);
Services.scriptloader.loadSubScript("chrome://messenger-newsblog/content/Feed.js");
Services.scriptloader.loadSubScript("chrome://messenger-newsblog/content/FeedItem.js");
Services.scriptloader.loadSubScript("chrome://messenger-newsblog/content/feed-parser.js");
@ -1414,8 +1416,7 @@ var FeedUtils = {
let fileUrl = Services.io.getProtocolHandler("file")
.QueryInterface(Ci.nsIFileProtocolHandler)
.getURLSpecFromFile(file);
let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
let request = new XMLHttpRequest();
request.open("GET", fileUrl, false);
request.responseType = "document";
request.send();