Bug 957184 - Replace |.getService() .QueryInterface(iid)| by |.getService(iid)| in comm-central. r=florian, r=Neil, r=mkmelin
authorHessam Salehi <hessamms@gmail.com>
Tue, 01 Apr 2014 07:57:32 -0400
changeset 15955 11cd943edd27fe9f7f4f9090418ba361ea2c8ecc
parent 15954 9afe71c06fa39310a931f3926c439f82787bf02f
child 15956 dd60d59f9f2b62caf9d46e4bf5614fc0e079dadb
push id9997
push userryanvm@gmail.com
push dateTue, 01 Apr 2014 11:58:27 +0000
treeherdercomm-central@86ee54b4f7bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, Neil, mkmelin
bugs957184
Bug 957184 - Replace |.getService() .QueryInterface(iid)| by |.getService(iid)| in comm-central. r=florian, r=Neil, r=mkmelin
editor/ui/composer/content/ComposerCommands.js
editor/ui/dialogs/content/EdImageOverlay.js
im/content/engineManager.js
mail/components/compose/content/addressingWidgetOverlay.js
mailnews/import/content/fieldMapImport.js
suite/common/directory/directory.js
suite/common/permissions/cookieViewer.js
suite/common/sidebar/customize-panel.js
suite/common/sidebar/customize.js
suite/common/sidebar/sidebarOverlay.js
suite/mailnews/addrbook/abSelectAddressesDialog.js
suite/mailnews/compose/addressingWidgetOverlay.js
suite/mailnews/mailWindow.js
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -712,18 +712,18 @@ var nsPublishAsCommand =
 
 // ------- output utilites   ----- //
 
 // returns a fileExtension string
 function GetExtensionBasedOnMimeType(aMIMEType)
 {
   try {
     var mimeService = null;
-    mimeService = Components.classes["@mozilla.org/mime;1"].getService();
-    mimeService = mimeService.QueryInterface(Components.interfaces.nsIMIMEService);
+    mimeService = Components.classes["@mozilla.org/mime;1"]
+                            .getService(Components.interfaces.nsIMIMEService);
 
     var fileExtension = mimeService.getPrimaryExtension(aMIMEType, null);
 
     // the MIME service likes to give back ".htm" for text/html files,
     // so do a special-case fix here.
     if (fileExtension == "htm")
       fileExtension = "html";
 
--- a/editor/ui/dialogs/content/EdImageOverlay.js
+++ b/editor/ui/dialogs/content/EdImageOverlay.js
@@ -287,18 +287,18 @@ function LoadPreviewImage()
     // We must have an absolute URL to preview it or remove it from the cache
     imageSrc = MakeAbsoluteUrl(imageSrc);
 
     if (GetScheme(imageSrc))
     {
       let uri = Services.io.newURI(imageSrc, null, null);
       if (uri)
       {
-        let imgCacheService = Components.classes["@mozilla.org/image/cache;1"].getService();
-        let imgCache = imgCacheService.QueryInterface(Components.interfaces.imgICache);
+        let imgCache = Components.classes["@mozilla.org/image/cache;1"]
+                                 .getService(Components.interfaces.imgICache);
 
         // This returns error if image wasn't in the cache; ignore that
         imgCache.removeEntry(uri);
       }
     }
   } catch(e) {}
 
   if (gDialog.PreviewImage)
--- a/im/content/engineManager.js
+++ b/im/content/engineManager.js
@@ -420,18 +420,18 @@ EngineView.prototype = {
     this.tree.invalidate();
   },
 
   ensureRowIsVisible: function (index) {
     this.tree.ensureRowIsVisible(index);
   },
 
   getSourceIndexFromDrag: function () {
-    var dragService = Cc["@mozilla.org/widget/dragservice;1"].
-                      getService().QueryInterface(Ci.nsIDragService);
+    var dragService = Cc["@mozilla.org/widget/dragservice;1"]
+                      .getService(Ci.nsIDragService);
     var dragSession = dragService.getCurrentSession();
     var transfer = Cc["@mozilla.org/widget/transferable;1"].
                    createInstance(Ci.nsITransferable);
 
     transfer.addDataFlavor(ENGINE_FLAVOR);
     dragSession.getData(transfer, 0);
 
     var dataObj = {};
--- a/mail/components/compose/content/addressingWidgetOverlay.js
+++ b/mail/components/compose/content/addressingWidgetOverlay.js
@@ -9,18 +9,18 @@ Components.utils.import("resource:///mod
 top.MAX_RECIPIENTS = 1; /* for the initial listitem created in the XUL */
 
 var inputElementType = "";
 var selectElementType = "";
 var selectElementIndexTable = null;
 
 var gNumberOfCols = 0;
 
-var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"].getService();
-gDragService = gDragService.QueryInterface(Components.interfaces.nsIDragService);
+var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"]
+                             .getService(Components.interfaces.nsIDragService);
 
 var test_addresses_sequence = false;
 
 try {
   if (sPrefs)
     test_addresses_sequence = sPrefs.getBoolPref("mail.debug.test_addresses_sequence");
 }
 catch (ex) {}
--- a/mailnews/import/content/fieldMapImport.js
+++ b/mailnews/import/content/fieldMapImport.js
@@ -11,18 +11,18 @@ var gPreviousButton;
 var gNextButton;
 var gMoveUpButton;
 var gMoveDownButton;
 var gListbox;
 var gSkipFirstRecordButton;
 
 function OnLoadFieldMapImport()
 {
-  top.importService = Components.classes["@mozilla.org/import/import-service;1"].getService();
-  top.importService = top.importService.QueryInterface(Components.interfaces.nsIImportService);
+  top.importService = Components.classes["@mozilla.org/import/import-service;1"]
+                                .getService(Components.interfaces.nsIImportService);
 
   // We need a field map object...
   // assume we have one passed in? or just make one?
   if (window.arguments && window.arguments[0]) {
     top.fieldMap = window.arguments[0].fieldMap;
     top.addInterface = window.arguments[0].addInterface;
     top.dialogResult = window.arguments[0].result;
   }
--- a/suite/common/directory/directory.js
+++ b/suite/common/directory/directory.js
@@ -129,18 +129,18 @@ function Init()
   if (baseURI && (baseURI.indexOf("file://") != 0)) {
     // Note: DON'T add the HTTPIndex datasource into the tree
     // for file URLs, only do it for other URLs; the "rdf:files"
     // datasources handles file URLs
     tree.database.AddDataSource(HTTPIndex);
   }
 
   // Note: set encoding BEFORE setting "ref" (important!)
-  var RDF = Components.classes[RDFSERVICE_CONTRACTID].getService();
-  if (RDF) RDF = RDF.QueryInterface(nsIRDFService);
+  var RDF = Components.classes[RDFSERVICE_CONTRACTID]
+                      .getService(nsIRDFService);
   if (RDF) {
     loadingArc = RDF.GetResource(NC_LOADING, true);
 
     var httpDS = HTTPIndex.DataSource;
     if (httpDS) httpDS = httpDS.QueryInterface(nsIHTTPIndex);
     if (httpDS) {
       httpDS.encoding = "ISO-8859-1";
 
--- a/suite/common/permissions/cookieViewer.js
+++ b/suite/common/permissions/cookieViewer.js
@@ -26,22 +26,22 @@ var cookieBundle;
 var gUpdatingBatch = "";
 
 function Startup() {
 
   // arguments passed to this routine:
   //   cookieManager 
  
   // xpconnect to cookiemanager/permissionmanager/promptservice interfaces
-  cookiemanager = Components.classes["@mozilla.org/cookiemanager;1"].getService();
-  cookiemanager = cookiemanager.QueryInterface(Components.interfaces.nsICookieManager);
-  permissionmanager = Components.classes["@mozilla.org/permissionmanager;1"].getService();
-  permissionmanager = permissionmanager.QueryInterface(Components.interfaces.nsIPermissionManager);
-  promptservice = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
-  promptservice = promptservice.QueryInterface(Components.interfaces.nsIPromptService);
+  cookiemanager = Components.classes["@mozilla.org/cookiemanager;1"]
+                            .getService(Components.interfaces.nsICookieManager);
+  permissionmanager = Components.classes["@mozilla.org/permissionmanager;1"]
+                                .getService(Components.interfaces.nsIPermissionManager);
+  promptservice = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+                            .getService(Components.interfaces.nsIPromptService);
 
   // intialize gDateService
   if (!gDateService) {
     const nsScriptableDateFormat_CONTRACTID = "@mozilla.org/intl/scriptabledateformat;1";
     const nsIScriptableDateFormat = Components.interfaces.nsIScriptableDateFormat;
     gDateService = Components.classes[nsScriptableDateFormat_CONTRACTID]
       .getService(nsIScriptableDateFormat);
   }
--- a/suite/common/sidebar/customize-panel.js
+++ b/suite/common/sidebar/customize-panel.js
@@ -1,17 +1,16 @@
 /* -*- Mode: Java -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // the rdf service
-var RDF = '@mozilla.org/rdf/rdf-service;1'
-RDF = Components.classes[RDF].getService();
-RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
+var RDF = Components.classes["@mozilla.org/rdf/rdf-service;"]
+                    .getService(Components.interfaces.nsIRDFService);
 
 var NC = "http://home.netscape.com/NC-rdf#";
 
 var sidebarObj = new Object;
 var customizeObj = new Object;
 
 function Init()
 {
--- a/suite/common/sidebar/customize.js
+++ b/suite/common/sidebar/customize.js
@@ -6,20 +6,18 @@
 //////////////////////////////////////////////////////////////
 // Global variables
 //////////////////////////////////////////////////////////////
 
 // Set to true for noise
 const CUST_DEBUG = false;
 
 // the rdf service
-var RDF = '@mozilla.org/rdf/rdf-service;1'
-RDF = Components.classes[RDF].getService();
-RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
-
+var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
+                    .getService(Components.interfaces.nsIRDFService);
 var NC = "http://home.netscape.com/NC-rdf#";
 
 var sidebarObj = new Object;
 var allPanelsObj = new Object;
 var original_panels = new Array();
 
 //////////////////////////////////////////////////////////////
 // Sidebar Init/Destroy
--- a/suite/common/sidebar/sidebarOverlay.js
+++ b/suite/common/sidebar/sidebarOverlay.js
@@ -40,19 +40,18 @@ function setBlank()
 // Uncomment for debug output
 const SB_DEBUG = false;
 
 // pref for limiting number of tabs in view
 // initialized in sidebar_overlay_init()
 var gNumTabsInViewPref;
 
 // The rdf service
-const RDF_URI = '@mozilla.org/rdf/rdf-service;1';
-var RDF = Components.classes[RDF_URI].getService();
-RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
+var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
+                    .getService(Components.interfaces.nsIRDFService);
 
 const NC = "http://home.netscape.com/NC-rdf#";
 
 // The directory services property to find panels.rdf
 const PANELS_RDF_FILE = "UPnls";
 const SIDEBAR_VERSION = "0.1";
 
 // The default sidebar:
--- a/suite/mailnews/addrbook/abSelectAddressesDialog.js
+++ b/suite/mailnews/addrbook/abSelectAddressesDialog.js
@@ -18,18 +18,18 @@ var prefixCc;
 var prefixBcc;
 
 var gToButton;
 var gCcButton;
 var gBccButton;
 
 var gActivatedButton;
 
-var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"].getService();
-gDragService = gDragService.QueryInterface(Components.interfaces.nsIDragService);
+var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"]
+                             .getService(Components.interfaces.nsIDragService);
 
 var gSelectAddressesAbViewListener = {
 	onSelectionChanged: function() {
     ResultsPaneSelectionChanged();
   },
   onCountChanged: function(total) {
     // do nothing
   }
--- a/suite/mailnews/compose/addressingWidgetOverlay.js
+++ b/suite/mailnews/compose/addressingWidgetOverlay.js
@@ -5,18 +5,19 @@
 top.MAX_RECIPIENTS = 1; /* for the initial listitem created in the XUL */
 
 var inputElementType = "";
 var selectElementType = "";
 var selectElementIndexTable = null;
 
 var gNumberOfCols = 0;
 
-var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"].getService();
-gDragService = gDragService.QueryInterface(Components.interfaces.nsIDragService);
+var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"]
+                             .getService(Components.interfaces.nsIDragService);
+
 var gMimeHeaderParser = null;
 
 /**
  * global variable inherited from MsgComposeCommands.js
  *
  var gMsgCompose;
  */
 
--- a/suite/mailnews/mailWindow.js
+++ b/suite/mailnews/mailWindow.js
@@ -216,18 +216,18 @@ function messagePaneOnClick(event)
   var needABrowser = /(^http(s)?:|^ftp:|^file:|^chrome:|^resource:|^about:)/i;
   if (href.search(needABrowser) == -1) 
     return true;
 
   // however, if the protocol should not be loaded internally, then we should
   // not put up a new browser window.  we should just let the usual processing
   // take place.
   try {
-    var extProtService = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].getService();
-    extProtService = extProtService.QueryInterface(Components.interfaces.nsIExternalProtocolService);
+    var extProtService = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
+                                   .getService(Components.interfaces.nsIExternalProtocolService);
     var scheme = href.substring(0, href.indexOf(":"));
     if (!extProtService.isExposedProtocol(scheme))
       return true;
   } 
   catch (ex) {} // ignore errors, and just assume that we can proceed.
 
   // if you get here, the user did a simple left click on a link
   // that we know should be in a browser window.