Ensure Services.jsm shorthands are used in translate_item.js

This commit is contained in:
Adomas Venčkauskas 2018-08-28 15:03:08 +03:00
parent 87c4eec3ef
commit 5c7b4019d9

View file

@ -64,8 +64,7 @@ Zotero.Translate.ItemSaver = function(options) {
} else {
// try to convert to a URI
try {
this._baseURI = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService).newURI(options.baseURI, null, null);
this._baseURI = Services.io.newURI(options.baseURI, null, null);
} catch(e) {};
}
this._saveOptions = options.saveOptions || {};
@ -581,8 +580,7 @@ Zotero.Translate.ItemSaver.prototype = {
}
attachment.url = url;
url = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
url = Services.io
.newURI(url, null, null); // This cannot fail, since we check above
// see if this is actually a file URL
@ -791,8 +789,7 @@ Zotero.Translate.ItemSaver.prototype = {
if (!cleanURI) {
throw new Error("Translate: Invalid attachment URL specified <" + url + ">");
}
url = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
url = Services.io
.newURI(cleanURI, null, null); // This cannot fail, since we check above
// Only HTTP/HTTPS links are allowed