[Pale-Moon] Issue MoonchildProductions/UXP#516 - Remove named function syntax from palemoon/components/sync.

This commit is contained in:
athenian200 2020-02-06 06:55:13 -06:00 • committed by Roy Tam
commit fcab070621
5 changed files with 43 additions and 43 deletions

View file

@ -17,7 +17,7 @@ const DEVICE_CONNECTED_PAGE = 2;
var gSyncAddDevice = { var gSyncAddDevice = {
init: function init() { init: function () {
this.pin1.setAttribute("maxlength", PIN_PART_LENGTH); this.pin1.setAttribute("maxlength", PIN_PART_LENGTH);
this.pin2.setAttribute("maxlength", PIN_PART_LENGTH); this.pin2.setAttribute("maxlength", PIN_PART_LENGTH);
this.pin3.setAttribute("maxlength", PIN_PART_LENGTH); this.pin3.setAttribute("maxlength", PIN_PART_LENGTH);
@ -34,7 +34,7 @@ var gSyncAddDevice = {
Weave.Service.scheduler.scheduleNextSync(0); Weave.Service.scheduler.scheduleNextSync(0);
}, },
onPageShow: function onPageShow() { onPageShow: function () {
this.wizard.getButton("back").hidden = true; this.wizard.getButton("back").hidden = true;
switch (this.wizard.pageIndex) { switch (this.wizard.pageIndex) {
@ -60,7 +60,7 @@ var gSyncAddDevice = {
} }
}, },
onWizardAdvance: function onWizardAdvance() { onWizardAdvance: function () {
switch (this.wizard.pageIndex) { switch (this.wizard.pageIndex) {
case ADD_DEVICE_PAGE: case ADD_DEVICE_PAGE:
this.startTransfer(); this.startTransfer();
@ -72,21 +72,21 @@ var gSyncAddDevice = {
return true; return true;
}, },
startTransfer: function startTransfer() { startTransfer: function () {
this.errorRow.hidden = true; this.errorRow.hidden = true;
// When onAbort is called, Weave may already be gone. // When onAbort is called, Weave may already be gone.
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT; const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
let self = this; let self = this;
let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({ let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({
onPaired: function onPaired() { onPaired: function () {
let credentials = {account: Weave.Service.identity.account, let credentials = {account: Weave.Service.identity.account,
password: Weave.Service.identity.basicPassword, password: Weave.Service.identity.basicPassword,
synckey: Weave.Service.identity.syncKey, synckey: Weave.Service.identity.syncKey,
serverURL: Weave.Service.serverURL}; serverURL: Weave.Service.serverURL};
jpakeclient.sendAndComplete(credentials); jpakeclient.sendAndComplete(credentials);
}, },
onComplete: function onComplete() { onComplete: function () {
delete self._jpakeclient; delete self._jpakeclient;
self.wizard.pageIndex = DEVICE_CONNECTED_PAGE; self.wizard.pageIndex = DEVICE_CONNECTED_PAGE;
@ -94,7 +94,7 @@ var gSyncAddDevice = {
// device with which we just paired. // device with which we just paired.
Weave.Service.scheduler.scheduleNextSync(Weave.Service.scheduler.activeInterval); Weave.Service.scheduler.scheduleNextSync(Weave.Service.scheduler.activeInterval);
}, },
onAbort: function onAbort(error) { onAbort: function (error) {
delete self._jpakeclient; delete self._jpakeclient;
// Aborted by user, ignore. // Aborted by user, ignore.
@ -118,7 +118,7 @@ var gSyncAddDevice = {
jpakeclient.pairWithPIN(pin, expectDelay); jpakeclient.pairWithPIN(pin, expectDelay);
}, },
onWizardBack: function onWizardBack() { onWizardBack: function () {
if (this.wizard.pageIndex != SYNC_KEY_PAGE) if (this.wizard.pageIndex != SYNC_KEY_PAGE)
return true; return true;
@ -126,7 +126,7 @@ var gSyncAddDevice = {
return false; return false;
}, },
onWizardCancel: function onWizardCancel() { onWizardCancel: function () {
if (this._jpakeclient) { if (this._jpakeclient) {
this._jpakeclient.abort(); this._jpakeclient.abort();
delete this._jpakeclient; delete this._jpakeclient;
@ -134,7 +134,7 @@ var gSyncAddDevice = {
return true; return true;
}, },
onTextBoxInput: function onTextBoxInput(textbox) { onTextBoxInput: function (textbox) {
if (textbox && textbox.value.length == PIN_PART_LENGTH) if (textbox && textbox.value.length == PIN_PART_LENGTH)
this.nextFocusEl[textbox.id].focus(); this.nextFocusEl[textbox.id].focus();
@ -143,7 +143,7 @@ var gSyncAddDevice = {
&& this.pin3.value.length == PIN_PART_LENGTH); && this.pin3.value.length == PIN_PART_LENGTH);
}, },
goToSyncKeyPage: function goToSyncKeyPage() { goToSyncKeyPage: function () {
this.wizard.pageIndex = SYNC_KEY_PAGE; this.wizard.pageIndex = SYNC_KEY_PAGE;
} }

View file

@ -29,7 +29,7 @@ var Change = {
return this._dialogType == "UpdatePassphrase"; return this._dialogType == "UpdatePassphrase";
}, },
onLoad: function Change_onLoad() { onLoad: function () {
/* Load labels */ /* Load labels */
let introText = document.getElementById("introText"); let introText = document.getElementById("introText");
let introText2 = document.getElementById("introText2"); let introText2 = document.getElementById("introText2");
@ -112,16 +112,16 @@ var Change = {
.setAttribute("label", document.title); .setAttribute("label", document.title);
}, },
_clearStatus: function _clearStatus() { _clearStatus: function () {
this._status.value = ""; this._status.value = "";
this._statusIcon.removeAttribute("status"); this._statusIcon.removeAttribute("status");
}, },
_updateStatus: function Change__updateStatus(str, state) { _updateStatus: function (str, state) {
this._updateStatusWithString(this._str(str), state); this._updateStatusWithString(this._str(str), state);
}, },
_updateStatusWithString: function Change__updateStatusWithString(string, state) { _updateStatusWithString: function (string, state) {
this._statusRow.hidden = false; this._statusRow.hidden = false;
this._status.value = string; this._status.value = string;
this._statusIcon.setAttribute("status", state); this._statusIcon.setAttribute("status", state);
@ -154,7 +154,7 @@ var Change = {
this._dialog.getButton("finish").disabled = false; this._dialog.getButton("finish").disabled = false;
}, },
doChangePassphrase: function Change_doChangePassphrase() { doChangePassphrase: function () {
let pp = Weave.Utils.normalizePassphrase(this._passphraseBox.value); let pp = Weave.Utils.normalizePassphrase(this._passphraseBox.value);
if (this._updatingPassphrase) { if (this._updatingPassphrase) {
Weave.Service.identity.syncKey = pp; Weave.Service.identity.syncKey = pp;
@ -179,7 +179,7 @@ var Change = {
return false; return false;
}, },
doChangePassword: function Change_doChangePassword() { doChangePassword: function () {
if (this._currentPasswordInvalid) { if (this._currentPasswordInvalid) {
Weave.Service.identity.basicPassword = this._firstBox.value; Weave.Service.identity.basicPassword = this._firstBox.value;
if (Weave.Service.login()) { if (Weave.Service.login()) {
@ -228,7 +228,7 @@ var Change = {
this._dialog.getButton("finish").disabled = !valid; this._dialog.getButton("finish").disabled = !valid;
}, },
_str: function Change__string(str) { _str: function (str) {
return this._stringBundle.GetStringFromName(str); return this._stringBundle.GetStringFromName(str);
} }
}; };

View file

@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/DownloadUtils.jsm");
var gSyncQuota = { var gSyncQuota = {
init: function init() { init: function () {
this.bundle = document.getElementById("quotaStrings"); this.bundle = document.getElementById("quotaStrings");
let caption = document.getElementById("treeCaption"); let caption = document.getElementById("treeCaption");
caption.firstChild.nodeValue = this.bundle.getString("quota.treeCaption.label"); caption.firstChild.nodeValue = this.bundle.getString("quota.treeCaption.label");
@ -24,7 +24,7 @@ var gSyncQuota = {
this.loadData(); this.loadData();
}, },
loadData: function loadData() { loadData: function () {
this._usage_req = Weave.Service.getStorageInfo(Weave.INFO_COLLECTION_USAGE, this._usage_req = Weave.Service.getStorageInfo(Weave.INFO_COLLECTION_USAGE,
function (error, usage) { function (error, usage) {
delete gSyncQuota._usage_req; delete gSyncQuota._usage_req;
@ -57,7 +57,7 @@ var gSyncQuota = {
}); });
}, },
onCancel: function onCancel() { onCancel: function () {
if (this._usage_req) { if (this._usage_req) {
this._usage_req.abort(); this._usage_req.abort();
} }
@ -67,7 +67,7 @@ var gSyncQuota = {
return true; return true;
}, },
onAccept: function onAccept() { onAccept: function () {
let engines = gUsageTreeView.getEnginesToDisable(); let engines = gUsageTreeView.getEnginesToDisable();
for each (let engine in engines) { for each (let engine in engines) {
Weave.Service.engineManager.get(engine).enabled = false; Weave.Service.engineManager.get(engine).enabled = false;
@ -80,7 +80,7 @@ var gSyncQuota = {
return this.onCancel(); return this.onCancel();
}, },
convertKB: function convertKB(value) { convertKB: function (value) {
return DownloadUtils.convertByteUnits(value * 1024); return DownloadUtils.convertByteUnits(value * 1024);
} }
@ -98,7 +98,7 @@ var gUsageTreeView = {
_collections: [], _collections: [],
_byname: {}, _byname: {},
init: function init() { init: function () {
let retrievingLabel = gSyncQuota.bundle.getString("quota.retrieving.label"); let retrievingLabel = gSyncQuota.bundle.getString("quota.retrieving.label");
for each (let engine in Weave.Service.engineManager.getEnabled()) { for each (let engine in Weave.Service.engineManager.getEnabled()) {
if (this._ignored[engine.name]) if (this._ignored[engine.name])
@ -122,7 +122,7 @@ var gUsageTreeView = {
} }
}, },
_collectionTitle: function _collectionTitle(engine) { _collectionTitle: function (engine) {
try { try {
return gSyncQuota.bundle.getString( return gSyncQuota.bundle.getString(
"collection." + engine.prefName + ".label"); "collection." + engine.prefName + ".label");
@ -134,7 +134,7 @@ var gUsageTreeView = {
/* /*
* Process the quota information as returned by info/collection_usage. * Process the quota information as returned by info/collection_usage.
*/ */
displayUsageData: function displayUsageData(data) { displayUsageData: function (data) {
for each (let coll in this._collections) { for each (let coll in this._collections) {
coll.size = 0; coll.size = 0;
// If we couldn't retrieve any data, just blank out the label. // If we couldn't retrieve any data, just blank out the label.
@ -157,7 +157,7 @@ var gUsageTreeView = {
/* /*
* Handle click events on the tree. * Handle click events on the tree.
*/ */
onTreeClick: function onTreeClick(event) { onTreeClick: function (event) {
if (event.button == 2) if (event.button == 2)
return; return;
@ -169,7 +169,7 @@ var gUsageTreeView = {
/* /*
* Toggle enabled state of an engine. * Toggle enabled state of an engine.
*/ */
toggle: function toggle(row) { toggle: function (row) {
// Update the tree // Update the tree
let collection = this._collections[row]; let collection = this._collections[row];
collection.enabled = !collection.enabled; collection.enabled = !collection.enabled;
@ -180,7 +180,7 @@ var gUsageTreeView = {
* Return a list of engines (or rather their pref names) that should be * Return a list of engines (or rather their pref names) that should be
* disabled. * disabled.
*/ */
getEnginesToDisable: function getEnginesToDisable() { getEnginesToDisable: function () {
// Tycho: return [coll.name for each (coll in this._collections) if (!coll.enabled)]; // Tycho: return [coll.name for each (coll in this._collections) if (!coll.enabled)];
let engines = []; let engines = [];
for each (let coll in this._collections) { for each (let coll in this._collections) {
@ -216,7 +216,7 @@ var gUsageTreeView = {
return this._collections[row].enabled; return this._collections[row].enabled;
}, },
getCellText: function getCellText(row, col) { getCellText: function (row, col) {
let collection = this._collections[row]; let collection = this._collections[row];
switch (col.id) { switch (col.id) {
case "collection": case "collection":
@ -228,7 +228,7 @@ var gUsageTreeView = {
} }
}, },
setTree: function setTree(tree) { setTree: function (tree) {
this.treeBox = tree; this.treeBox = tree;
}, },

View file

@ -138,7 +138,7 @@ var gSyncSetup = {
} }
}, },
resetPassphrase: function resetPassphrase() { resetPassphrase: function () {
// Apply the existing form fields so that // Apply the existing form fields so that
// Weave.Service.changePassphrase() has the necessary credentials. // Weave.Service.changePassphrase() has the necessary credentials.
Weave.Service.identity.account = document.getElementById("existingAccountName").value; Weave.Service.identity.account = document.getElementById("existingAccountName").value;
@ -595,7 +595,7 @@ var gSyncSetup = {
return false; return false;
}, },
startPairing: function startPairing() { startPairing: function () {
this.pairDeviceErrorRow.hidden = true; this.pairDeviceErrorRow.hidden = true;
// When onAbort is called, Weave may already be gone. // When onAbort is called, Weave may already be gone.
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT; const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
@ -605,11 +605,11 @@ var gSyncSetup = {
onPaired: function onPaired() { onPaired: function onPaired() {
self.wizard.pageIndex = INTRO_PAGE; self.wizard.pageIndex = INTRO_PAGE;
}, },
onComplete: function onComplete() { onComplete: function () {
// This method will never be called since SendCredentialsController // This method will never be called since SendCredentialsController
// will take over after the wizard completes. // will take over after the wizard completes.
}, },
onAbort: function onAbort(error) { onAbort: function (error) {
delete self._jpakeclient; delete self._jpakeclient;
// Aborted by user, ignore. The window is almost certainly going to close // Aborted by user, ignore. The window is almost certainly going to close
@ -636,7 +636,7 @@ var gSyncSetup = {
jpakeclient.pairWithPIN(pin, expectDelay); jpakeclient.pairWithPIN(pin, expectDelay);
}, },
completePairing: function completePairing() { completePairing: function () {
if (!this._jpakeclient) { if (!this._jpakeclient) {
// The channel was aborted while we were setting up the account // The channel was aborted while we were setting up the account
// locally. XXX TODO should we do anything here, e.g. tell // locally. XXX TODO should we do anything here, e.g. tell
@ -660,15 +660,15 @@ var gSyncSetup = {
let self = this; let self = this;
this._jpakeclient = new Weave.JPAKEClient({ this._jpakeclient = new Weave.JPAKEClient({
displayPIN: function displayPIN(pin) { displayPIN: function (pin) {
document.getElementById("easySetupPIN1").value = pin.slice(0, 4); document.getElementById("easySetupPIN1").value = pin.slice(0, 4);
document.getElementById("easySetupPIN2").value = pin.slice(4, 8); document.getElementById("easySetupPIN2").value = pin.slice(4, 8);
document.getElementById("easySetupPIN3").value = pin.slice(8); document.getElementById("easySetupPIN3").value = pin.slice(8);
}, },
onPairingStart: function onPairingStart() {}, onPairingStart: function () {},
onComplete: function onComplete(credentials) { onComplete: function (credentials) {
Weave.Service.identity.account = credentials.account; Weave.Service.identity.account = credentials.account;
Weave.Service.identity.basicPassword = credentials.password; Weave.Service.identity.basicPassword = credentials.password;
Weave.Service.identity.syncKey = credentials.synckey; Weave.Service.identity.syncKey = credentials.synckey;
@ -676,7 +676,7 @@ var gSyncSetup = {
gSyncSetup.wizardFinish(); gSyncSetup.wizardFinish();
}, },
onAbort: function onAbort(error) { onAbort: function (error) {
delete self._jpakeclient; delete self._jpakeclient;
// Ignore if wizard is aborted. // Ignore if wizard is aborted.
@ -1017,7 +1017,7 @@ var gSyncSetup = {
this._setFeedback(element, success, str); this._setFeedback(element, success, str);
}, },
loadCaptcha: function loadCaptcha() { loadCaptcha: function () {
let captchaURI = Weave.Service.miscAPI + "captcha_html"; let captchaURI = Weave.Service.miscAPI + "captcha_html";
// First check for NoScript and whitelist the right sites. // First check for NoScript and whitelist the right sites.
this._handleNoScript(true); this._handleNoScript(true);

View file

@ -30,13 +30,13 @@ var gSyncUtils = {
openUILinkIn(url, "tab"); openUILinkIn(url, "tab");
}, },
changeName: function changeName(input) { changeName: function (input) {
// Make sure to update to a modified name, e.g., empty-string -> default // Make sure to update to a modified name, e.g., empty-string -> default
Weave.Service.clientsEngine.localName = input.value; Weave.Service.clientsEngine.localName = input.value;
input.value = Weave.Service.clientsEngine.localName; input.value = Weave.Service.clientsEngine.localName;
}, },
openChange: function openChange(type, duringSetup) { openChange: function (type, duringSetup) {
// Just re-show the dialog if it's already open // Just re-show the dialog if it's already open
let openedDialog = Services.wm.getMostRecentWindow("Sync:" + type); let openedDialog = Services.wm.getMostRecentWindow("Sync:" + type);
if (openedDialog != null) { if (openedDialog != null) {