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