Bug 1486938: Remove login-manager-storage category entry. r=MattN

This is an unused feature, with a strange implementation. If we need such an
override in the future, it can be accomplished by just overriding a contract
ID.

This patch also changes the implementation to simply define a contract ID for
the appropriate default implementation at registration time rather than adding
a duplicate platform check at runtime.

--HG--
extra : rebase_source : 35df540be55d9b1d023b3a6ec11d5c4cb4efbead
This commit is contained in:
Kris Maglione 2018-08-28 14:58:51 -07:00
Родитель 662b703835
Коммит 2fe4e50195
4 изменённых файлов: 10 добавлений и 18 удалений

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

@ -106,22 +106,8 @@ LoginManager.prototype = {
_initStorage() {
let contractID;
if (AppConstants.platform == "android") {
contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
} else {
contractID = "@mozilla.org/login-manager/storage/json;1";
}
try {
contractID = Services.catMan.getCategoryEntry("login-manager-storage",
"nsILoginManagerStorage");
log.debug("Found alternate nsILoginManagerStorage with contract ID:", contractID);
} catch (e) {
log.debug("No alternate nsILoginManagerStorage registered");
}
this._storage = Cc[contractID].
createInstance(Ci.nsILoginManagerStorage);
this._storage = Cc["@mozilla.org/login-manager/storage/default;1"]
.createInstance(Ci.nsILoginManagerStorage);
this.initializationPromise = this._storage.initialize();
},

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

@ -9,9 +9,11 @@ contract @mozilla.org/login-manager/loginInfo;1 {0f2f347c-1e4f-40cc-8efd-792dea7
#ifdef ANDROID
component {8c2023b9-175c-477e-9761-44ae7b549756} storage-mozStorage.js
contract @mozilla.org/login-manager/storage/mozStorage;1 {8c2023b9-175c-477e-9761-44ae7b549756}
contract @mozilla.org/login-manager/storage/default;1 {8c2023b9-175c-477e-9761-44ae7b549756}
#else
component {c00c432d-a0c9-46d7-bef6-9c45b4d07341} storage-json.js
contract @mozilla.org/login-manager/storage/json;1 {c00c432d-a0c9-46d7-bef6-9c45b4d07341}
contract @mozilla.org/login-manager/storage/default;1 {c00c432d-a0c9-46d7-bef6-9c45b4d07341}
#endif
component {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} crypto-SDR.js
contract @mozilla.org/login-manager/crypto/SDR;1 {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}

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

@ -30,6 +30,8 @@ this.LoginManagerStorage_json.prototype = {
classID: Components.ID("{c00c432d-a0c9-46d7-bef6-9c45b4d07341}"),
QueryInterface: ChromeUtils.generateQI([Ci.nsILoginManagerStorage]),
_xpcom_factory: XPCOMUtils.generateSingletonFactory(this.LoginManagerStorage_json),
__crypto: null, // nsILoginManagerCrypto service
get _crypto() {
if (!this.__crypto)

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

@ -44,10 +44,12 @@ Transaction.prototype = {
function LoginManagerStorage_mozStorage() { }
LoginManagerStorage_mozStorage.prototype = {
classID: Components.ID("{8c2023b9-175c-477e-9761-44ae7b549756}"),
QueryInterface: ChromeUtils.generateQI([Ci.nsILoginManagerStorage,
Ci.nsIInterfaceRequestor]),
_xpcom_factory: XPCOMUtils.generateSingletonFactory(this.LoginManagerStorage_mozStorage),
getInterface(aIID) {
if (aIID.equals(Ci.nsIVariant)) {
// Allows unwrapping the JavaScript object for regression tests.