Bug 1296097 - Use new XMLHttpRequest() instead of nsIXMLHttpRequest.
authorRobert Strong <robert.bugzilla@gmail.com>
Thu, 18 Aug 2016 12:03:38 -0700
changeset 353663 bbbadfa14ef1611937db1311afa33f3a02030338
parent 353662 eb88d96de254a14ee5e7d90c0ea1b20822fd3d6e
child 353664 2d4a3ed753407f210a3a0268691e1be38280420a
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1296097
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1296097 - Use new XMLHttpRequest() instead of nsIXMLHttpRequest.
toolkit/mozapps/update/nsIUpdateService.idl
toolkit/mozapps/update/nsUpdateService.js
--- a/toolkit/mozapps/update/nsIUpdateService.idl
+++ b/toolkit/mozapps/update/nsIUpdateService.idl
@@ -6,17 +6,16 @@
 #include "nsISupports.idl"
 
 interface nsIDOMDocument;
 interface nsIDOMElement;
 interface nsIDOMWindow;
 interface nsIRequest;
 interface nsIRequestObserver;
 interface nsISimpleEnumerator;
-interface nsIXMLHttpRequest;
 interface nsIFile;
 
 /**
  * An interface that describes an object representing a patch file that can
  * be downloaded and applied to a version of this application so that it
  * can be updated.
  */
 [scriptable, uuid(dc8fb8a9-3a53-4031-9469-2a5197ea30e7)]
@@ -276,35 +275,35 @@ interface nsIUpdate : nsISupports
  * and if it has an error.
  */
 [scriptable, uuid(4aa2b4bb-39ea-407b-98ff-89f19134d4c0)]
 interface nsIUpdateCheckListener : nsISupports
 {
   /**
    * The update check was completed.
    * @param   request
-   *          The nsIXMLHttpRequest handling the update check.
+   *          The XMLHttpRequest handling the update check.
    * @param   updates
    *          An array of nsIUpdate objects listing available updates.
    * @param   updateCount
    *          The size of the |updates| array.
    */
-  void onCheckComplete(in nsIXMLHttpRequest request,
+  void onCheckComplete(in jsval request,
                        [array, size_is(updateCount)] in nsIUpdate updates,
                        in unsigned long updateCount);
 
   /**
    * An error occurred while loading the remote update service file.
    * @param   request
-   *          The nsIXMLHttpRequest handling the update check.
+   *          The XMLHttpRequest handling the update check.
    * @param   update
    *          A nsIUpdate object that contains details about the
    *          error in its |statusText| property.
    */
-  void onError(in nsIXMLHttpRequest request,
+  void onError(in jsval request,
                in nsIUpdate update);
 };
 
 /**
  * An interface describing an object that knows how to check for updates.
  */
 [scriptable, uuid(877ace25-8bc5-452a-8586-9c1cf2871994)]
 interface nsIUpdateChecker : nsISupports
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -9,16 +9,17 @@
 const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
 Cu.import("resource://gre/modules/FileUtils.jsm", this);
 Cu.import("resource://gre/modules/Services.jsm", this);
 Cu.import("resource://gre/modules/ctypes.jsm", this);
 Cu.import("resource://gre/modules/UpdateTelemetry.jsm", this);
 Cu.import("resource://gre/modules/AppConstants.jsm", this);
+Cu.importGlobalProperties(["XMLHttpRequest"]);
 
 const UPDATESERVICE_CID = Components.ID("{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}");
 const UPDATESERVICE_CONTRACTID = "@mozilla.org/updates/update-service;1";
 
 const PREF_APP_UPDATE_ALTWINDOWTYPE        = "app.update.altwindowtype";
 const PREF_APP_UPDATE_AUTO                 = "app.update.auto";
 const PREF_APP_UPDATE_BACKGROUNDINTERVAL   = "app.update.download.backgroundInterval";
 const PREF_APP_UPDATE_BACKGROUNDERRORS     = "app.update.backgroundErrors";
@@ -3356,18 +3357,17 @@ Checker.prototype = {
       throw Cr.NS_ERROR_NULL_POINTER;
 
     Services.obs.notifyObservers(null, "update-check-start", null);
 
     var url = this.getUpdateURL(force);
     if (!url || (!this.enabled && !force))
       return;
 
-    this._request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
-                    createInstance(Ci.nsIXMLHttpRequest);
+    this._request = new XMLHttpRequest();
     this._request.open("GET", url, true);
     var allowNonBuiltIn = !getPref("getBoolPref",
                                    PREF_APP_UPDATE_CERT_REQUIREBUILTIN, true);
     this._request.channel.notificationCallbacks = new gCertUtils.BadCertHandler(allowNonBuiltIn);
     // Prevent the request from reading from the cache.
     this._request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
     // Prevent the request from writing to the cache.
     this._request.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;