diff --git a/calendar/base/content/dialogs/calendar-migration-dialog.js b/calendar/base/content/dialogs/calendar-migration-dialog.js index 1402a392c9..c5f53c69d7 100644 --- a/calendar/base/content/dialogs/calendar-migration-dialog.js +++ b/calendar/base/content/dialogs/calendar-migration-dialog.js @@ -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) { diff --git a/calendar/base/modules/calXMLUtils.jsm b/calendar/base/modules/calXMLUtils.jsm index d026ad946c..a5ad4e3b13 100644 --- a/calendar/base/modules/calXMLUtils.jsm +++ b/calendar/base/modules/calXMLUtils.jsm @@ -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); diff --git a/mail/base/content/specialTabs.js b/mail/base/content/specialTabs.js index ab90bf382b..1fc471c30f 100644 --- a/mail/base/content/specialTabs.js +++ b/mail/base/content/specialTabs.js @@ -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; diff --git a/mail/base/modules/mailInstrumentation.js b/mail/base/modules/mailInstrumentation.js index e06368037c..579ed029ae 100644 --- a/mail/base/modules/mailInstrumentation.js +++ b/mail/base/modules/mailInstrumentation.js @@ -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; diff --git a/mail/components/cloudfile/nsBox.js b/mail/components/cloudfile/nsBox.js index 7138f28158..f0b29c4b53 100644 --- a/mail/components/cloudfile/nsBox.js +++ b/mail/components/cloudfile/nsBox.js @@ -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); diff --git a/mail/components/cloudfile/nsHightail.js b/mail/components/cloudfile/nsHightail.js index 13c6e565d3..a0034b603b 100644 --- a/mail/components/cloudfile/nsHightail.js +++ b/mail/components/cloudfile/nsHightail.js @@ -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); diff --git a/mailnews/extensions/newsblog/content/Feed.js b/mailnews/extensions/newsblog/content/Feed.js index 6c39a00f18..87be3b1e85 100755 --- a/mailnews/extensions/newsblog/content/Feed.js +++ b/mailnews/extensions/newsblog/content/Feed.js @@ -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); diff --git a/mailnews/extensions/newsblog/content/FeedUtils.jsm b/mailnews/extensions/newsblog/content/FeedUtils.jsm index cb2dc9afe8..cb7b2406a0 100644 --- a/mailnews/extensions/newsblog/content/FeedUtils.jsm +++ b/mailnews/extensions/newsblog/content/FeedUtils.jsm @@ -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();