Bug 1682939 - Remove nsISimpleEnumerator from imICoreService. r=clokep
--- a/chat/components/public/imICoreService.idl
+++ b/chat/components/public/imICoreService.idl
@@ -1,29 +1,28 @@
/* 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/. */
#include "nsISupports.idl"
#include "imIUserStatusInfo.idl"
-#include "nsISimpleEnumerator.idl"
#include "prplIProtocol.idl"
[scriptable, uuid(205d4b2b-1ccf-4879-9ef1-f08942566151)]
interface imICoreService: nsISupports {
readonly attribute boolean initialized;
// This will emit a prpl-init notification. After this point the 'initialized'
// attribute will be 'true' and it's safe to access the services for accounts,
// contacts, conversations and commands.
void init();
// This will emit a prpl-quit notification. This is the last opportunity to
// use the aforementioned services before they are uninitialized.
void quit();
- // returns an enumerator on a pplIProtocol array
- nsISimpleEnumerator getProtocols();
+ // Returns the available protocols.
+ Array<prplIProtocol> getProtocols();
prplIProtocol getProtocolById(in AUTF8String aProtocolId);
readonly attribute imIUserStatusInfo globalUserStatus;
};
--- a/chat/components/src/imCore.jsm
+++ b/chat/components/src/imCore.jsm
@@ -1,21 +1,18 @@
/* 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/. */
var EXPORTED_SYMBOLS = ["CoreService"];
var { Services } = ChromeUtils.import("resource:///modules/imServices.jsm");
-var {
- XPCOMUtils,
- ClassInfo,
- initLogModule,
- nsSimpleEnumerator,
-} = ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+var { XPCOMUtils, ClassInfo, initLogModule } = ChromeUtils.import(
+ "resource:///modules/imXPCOMUtils.jsm"
+);
XPCOMUtils.defineLazyServiceGetter(
this,
"categoryManager",
"@mozilla.org/categorymanager;1",
"nsICategoryManager"
);
@@ -363,17 +360,17 @@ CoreService.prototype = {
continue;
}
let proto = this.getProtocolById(id);
if (proto) {
protocols.push(proto);
}
}
- return new nsSimpleEnumerator(protocols);
+ return protocols;
},
getProtocolById(aPrplId) {
if (!this._initialized) {
throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
if (this._protos.hasOwnProperty(aPrplId)) {
--- a/mail/components/im/content/imAccountWizard.js
+++ b/mail/components/im/content/imAccountWizard.js
@@ -43,20 +43,17 @@ var accountWizard = {
);
// Ensure the im core is initialized before we get a list of protocols.
Services.core.init();
accountWizard.setGetMoreProtocols();
var protoList = document.getElementById("protolist");
- var protos = [];
- for (let proto of this.getProtocols()) {
- protos.push(proto);
- }
+ var protos = Services.core.getProtocols();
protos.sort((a, b) => {
if (a.name < b.name) {
return -1;
}
return a.name > b.name ? 1 : 0;
});
protos.forEach(function(proto) {
let image = document.createXULElement("image");
@@ -433,19 +430,16 @@ var accountWizard = {
return undefined;
},
*getIter(aEnumerator) {
for (let iter of aEnumerator) {
yield iter;
}
},
- getProtocols() {
- return this.getIter(Services.core.getProtocols());
- },
getProtoOptions() {
return this.getIter(this.proto.getOptions());
},
getProtoUserSplits() {
return this.getIter(this.proto.getUsernameSplit());
},
/* Check for correctness and set URL for the "Get more protocols..."-link