Replace old-style object properties in word-processor-plugin-installer

This commit is contained in:
Adomas Venčkauskas 2017-03-17 14:27:18 +02:00
parent eaf8d36963
commit 2d93b07220

View File

@ -43,7 +43,7 @@ var _runningTimers = [];
function setTimeout(func, ms) { function setTimeout(func, ms) {
var timer = Components.classes["@mozilla.org/timer;1"]. var timer = Components.classes["@mozilla.org/timer;1"].
createInstance(Components.interfaces.nsITimer); createInstance(Components.interfaces.nsITimer);
var timerCallback = {"notify":function() { var timerCallback = {notify: function() {
_runningTimers.splice(_runningTimers.indexOf(timer), 1); _runningTimers.splice(_runningTimers.indexOf(timer), 1);
func(); func();
}}; }};
@ -70,16 +70,16 @@ var ZoteroPluginInstaller = function(addon, failSilently, force) {
}; };
ZoteroPluginInstaller.prototype = { ZoteroPluginInstaller.prototype = {
"_errorDisplayed":false, _errorDisplayed: false,
"_addonInfoAvailable":function() { _addonInfoAvailable: function() {
try { try {
this._version = this._addons[0].version; this._version = this._addons[0].version;
try { try {
this._addon.verifyNotCorrupt(this); this._addon.verifyNotCorrupt(this);
} catch(e) { } catch(e) {
Zotero.debug("Not installing "+this._addon.EXTENSION_STRING+": "+e.toString()); Zotero.debug("Not installing +this._addon.EXTENSION_STRING+: "+e.toString());
return; return;
} }
@ -111,13 +111,13 @@ ZoteroPluginInstaller.prototype = {
} }
}, },
"isInstalled":function() { isInstalled: function() {
while(!this._version) Zotero.mainThread.processNextEvent(true); while(!this._version) Zotero.mainThread.processNextEvent(true);
return this.prefBranch.getCharPref("version") == this._version && return this.prefBranch.getCharPref("version") == this._version &&
this.prefBranch.getBoolPref("installed"); this.prefBranch.getBoolPref("installed");
}, },
"getAddonPath":function(addonID) { getAddonPath: function(addonID) {
if(AddonManager) { if(AddonManager) {
for (var addon of this._addons) { for (var addon of this._addons) {
if(addon && addon.id == addonID) { if(addon && addon.id == addonID) {
@ -133,15 +133,15 @@ ZoteroPluginInstaller.prototype = {
} }
}, },
"setProgressWindowLabel":function(value) { setProgressWindowLabel: function(value) {
if(this._progressWindow) this._progressWindowLabel.value = value; if(this._progressWindow) this._progressWindowLabel.value = value;
}, },
"closeProgressWindow":function(value) { closeProgressWindow: function(value) {
if(this._progressWindow) this._progressWindow.close(); if(this._progressWindow) this._progressWindow.close();
}, },
"success":function() { success: function() {
installationInProgress = false; installationInProgress = false;
this.closeProgressWindow(); this.closeProgressWindow();
this.prefBranch.setCharPref("version", this._version); this.prefBranch.setCharPref("version", this._version);
@ -158,7 +158,7 @@ ZoteroPluginInstaller.prototype = {
} }
}, },
"error":function(error, notFailure) { error: function(error, notFailure) {
installationInProgress = false; installationInProgress = false;
this.closeProgressWindow(); this.closeProgressWindow();
if(!notFailure) { if(!notFailure) {
@ -177,13 +177,13 @@ ZoteroPluginInstaller.prototype = {
}, 0); }, 0);
}, },
"cancelled":function(dontSkipInstallation) { cancelled: function(dontSkipInstallation) {
installationInProgress = false; installationInProgress = false;
this.closeProgressWindow(); this.closeProgressWindow();
if(!this.force && !dontSkipInstallation) this.prefBranch.setBoolPref("skipInstallation", true); if(!this.force && !dontSkipInstallation) this.prefBranch.setBoolPref("skipInstallation", true);
}, },
"showPreferences":function(document) { showPreferences: function(document) {
var isInstalled = this.isInstalled(), var isInstalled = this.isInstalled(),
groupbox = document.createElement("groupbox"); groupbox = document.createElement("groupbox");
groupbox.id = this._addon.EXTENSION_DIR; groupbox.id = this._addon.EXTENSION_DIR;
@ -224,7 +224,7 @@ ZoteroPluginInstaller.prototype = {
} }
}, },
"_firstRunListener":function() { _firstRunListener: function() {
this._progressWindowLabel = this._progressWindow.document.getElementById("progress-label"); this._progressWindowLabel = this._progressWindow.document.getElementById("progress-label");
this._progressWindowLabel.value = Zotero.getString('zotero.preferences.wordProcessors.installing', this._addon.EXTENSION_STRING); this._progressWindowLabel.value = Zotero.getString('zotero.preferences.wordProcessors.installing', this._addon.EXTENSION_STRING);
var me = this; var me = this;