mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
[Basilisk] Issue MoonchildProductions/UXP#516 - Remove named function syntax from basilisk/components/sync.
This commit is contained in:
parent
645127d522
commit
06905b4207
5 changed files with 43 additions and 43 deletions
|
|
@ -34,7 +34,7 @@ var gSyncAddDevice = {
|
|||
Weave.Service.scheduler.scheduleNextSync(0);
|
||||
},
|
||||
|
||||
onPageShow: function onPageShow() {
|
||||
onPageShow: function() {
|
||||
this.wizard.getButton("back").hidden = true;
|
||||
|
||||
switch (this.wizard.pageIndex) {
|
||||
|
|
@ -60,7 +60,7 @@ var gSyncAddDevice = {
|
|||
}
|
||||
},
|
||||
|
||||
onWizardAdvance: function onWizardAdvance() {
|
||||
onWizardAdvance: function() {
|
||||
switch (this.wizard.pageIndex) {
|
||||
case ADD_DEVICE_PAGE:
|
||||
this.startTransfer();
|
||||
|
|
@ -72,21 +72,21 @@ var gSyncAddDevice = {
|
|||
return true;
|
||||
},
|
||||
|
||||
startTransfer: function startTransfer() {
|
||||
startTransfer: function() {
|
||||
this.errorRow.hidden = true;
|
||||
// When onAbort is called, Weave may already be gone.
|
||||
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
|
||||
|
||||
let self = this;
|
||||
let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({
|
||||
onPaired: function onPaired() {
|
||||
onPaired: function() {
|
||||
let credentials = {account: Weave.Service.identity.account,
|
||||
password: Weave.Service.identity.basicPassword,
|
||||
synckey: Weave.Service.identity.syncKey,
|
||||
serverURL: Weave.Service.serverURL};
|
||||
jpakeclient.sendAndComplete(credentials);
|
||||
},
|
||||
onComplete: function onComplete() {
|
||||
onComplete: function() {
|
||||
delete self._jpakeclient;
|
||||
self.wizard.pageIndex = DEVICE_CONNECTED_PAGE;
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ var gSyncAddDevice = {
|
|||
// device with which we just paired.
|
||||
Weave.Service.scheduler.scheduleNextSync(Weave.Service.scheduler.activeInterval);
|
||||
},
|
||||
onAbort: function onAbort(error) {
|
||||
onAbort: function(error) {
|
||||
delete self._jpakeclient;
|
||||
|
||||
// Aborted by user, ignore.
|
||||
|
|
@ -118,7 +118,7 @@ var gSyncAddDevice = {
|
|||
jpakeclient.pairWithPIN(pin, expectDelay);
|
||||
},
|
||||
|
||||
onWizardBack: function onWizardBack() {
|
||||
onWizardBack: function() {
|
||||
if (this.wizard.pageIndex != SYNC_KEY_PAGE)
|
||||
return true;
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ var gSyncAddDevice = {
|
|||
return false;
|
||||
},
|
||||
|
||||
onWizardCancel: function onWizardCancel() {
|
||||
onWizardCancel: function() {
|
||||
if (this._jpakeclient) {
|
||||
this._jpakeclient.abort();
|
||||
delete this._jpakeclient;
|
||||
|
|
@ -134,7 +134,7 @@ var gSyncAddDevice = {
|
|||
return true;
|
||||
},
|
||||
|
||||
onTextBoxInput: function onTextBoxInput(textbox) {
|
||||
onTextBoxInput: function(textbox) {
|
||||
if (textbox && textbox.value.length == PIN_PART_LENGTH)
|
||||
this.nextFocusEl[textbox.id].focus();
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ var gSyncAddDevice = {
|
|||
&& this.pin3.value.length == PIN_PART_LENGTH);
|
||||
},
|
||||
|
||||
goToSyncKeyPage: function goToSyncKeyPage() {
|
||||
goToSyncKeyPage: function() {
|
||||
this.wizard.pageIndex = SYNC_KEY_PAGE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ var Change = {
|
|||
return this._dialogType == "UpdatePassphrase";
|
||||
},
|
||||
|
||||
onLoad: function Change_onLoad() {
|
||||
onLoad: function() {
|
||||
/* Load labels */
|
||||
let introText = document.getElementById("introText");
|
||||
let introText2 = document.getElementById("introText2");
|
||||
|
|
@ -112,16 +112,16 @@ var Change = {
|
|||
.setAttribute("label", document.title);
|
||||
},
|
||||
|
||||
_clearStatus: function _clearStatus() {
|
||||
_clearStatus: function() {
|
||||
this._status.value = "";
|
||||
this._statusIcon.removeAttribute("status");
|
||||
},
|
||||
|
||||
_updateStatus: function Change__updateStatus(str, state) {
|
||||
_updateStatus: function(str, state) {
|
||||
this._updateStatusWithString(this._str(str), state);
|
||||
},
|
||||
|
||||
_updateStatusWithString: function Change__updateStatusWithString(string, state) {
|
||||
_updateStatusWithString: function(string, state) {
|
||||
this._statusRow.hidden = false;
|
||||
this._status.value = string;
|
||||
this._statusIcon.setAttribute("status", state);
|
||||
|
|
@ -154,7 +154,7 @@ var Change = {
|
|||
this._dialog.getButton("finish").disabled = false;
|
||||
},
|
||||
|
||||
doChangePassphrase: function Change_doChangePassphrase() {
|
||||
doChangePassphrase: function() {
|
||||
let pp = Weave.Utils.normalizePassphrase(this._passphraseBox.value);
|
||||
if (this._updatingPassphrase) {
|
||||
Weave.Service.identity.syncKey = pp;
|
||||
|
|
@ -179,7 +179,7 @@ var Change = {
|
|||
return false;
|
||||
},
|
||||
|
||||
doChangePassword: function Change_doChangePassword() {
|
||||
doChangePassword: function() {
|
||||
if (this._currentPasswordInvalid) {
|
||||
Weave.Service.identity.basicPassword = this._firstBox.value;
|
||||
if (Weave.Service.login()) {
|
||||
|
|
@ -228,7 +228,7 @@ var Change = {
|
|||
this._dialog.getButton("finish").disabled = !valid;
|
||||
},
|
||||
|
||||
_str: function Change__string(str) {
|
||||
_str: function(str) {
|
||||
return this._stringBundle.GetStringFromName(str);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/DownloadUtils.jsm");
|
|||
|
||||
var gSyncQuota = {
|
||||
|
||||
init: function init() {
|
||||
init: function() {
|
||||
this.bundle = document.getElementById("quotaStrings");
|
||||
let caption = document.getElementById("treeCaption");
|
||||
caption.firstChild.nodeValue = this.bundle.getString("quota.treeCaption.label");
|
||||
|
|
@ -24,7 +24,7 @@ var gSyncQuota = {
|
|||
this.loadData();
|
||||
},
|
||||
|
||||
loadData: function loadData() {
|
||||
loadData: function() {
|
||||
this._usage_req = Weave.Service.getStorageInfo(Weave.INFO_COLLECTION_USAGE,
|
||||
function (error, usage) {
|
||||
delete gSyncQuota._usage_req;
|
||||
|
|
@ -57,7 +57,7 @@ var gSyncQuota = {
|
|||
});
|
||||
},
|
||||
|
||||
onCancel: function onCancel() {
|
||||
onCancel: function() {
|
||||
if (this._usage_req) {
|
||||
this._usage_req.abort();
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ var gSyncQuota = {
|
|||
return true;
|
||||
},
|
||||
|
||||
onAccept: function onAccept() {
|
||||
onAccept: function() {
|
||||
let engines = gUsageTreeView.getEnginesToDisable();
|
||||
for each (let engine in engines) {
|
||||
Weave.Service.engineManager.get(engine).enabled = false;
|
||||
|
|
@ -80,7 +80,7 @@ var gSyncQuota = {
|
|||
return this.onCancel();
|
||||
},
|
||||
|
||||
convertKB: function convertKB(value) {
|
||||
convertKB: function(value) {
|
||||
return DownloadUtils.convertByteUnits(value * 1024);
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ var gUsageTreeView = {
|
|||
_collections: [],
|
||||
_byname: {},
|
||||
|
||||
init: function init() {
|
||||
init: function() {
|
||||
let retrievingLabel = gSyncQuota.bundle.getString("quota.retrieving.label");
|
||||
for each (let engine in Weave.Service.engineManager.getEnabled()) {
|
||||
if (this._ignored[engine.name])
|
||||
|
|
@ -122,7 +122,7 @@ var gUsageTreeView = {
|
|||
}
|
||||
},
|
||||
|
||||
_collectionTitle: function _collectionTitle(engine) {
|
||||
_collectionTitle: function(engine) {
|
||||
try {
|
||||
return gSyncQuota.bundle.getString(
|
||||
"collection." + engine.prefName + ".label");
|
||||
|
|
@ -134,7 +134,7 @@ var gUsageTreeView = {
|
|||
/*
|
||||
* Process the quota information as returned by info/collection_usage.
|
||||
*/
|
||||
displayUsageData: function displayUsageData(data) {
|
||||
displayUsageData: function(data) {
|
||||
for each (let coll in this._collections) {
|
||||
coll.size = 0;
|
||||
// If we couldn't retrieve any data, just blank out the label.
|
||||
|
|
@ -157,7 +157,7 @@ var gUsageTreeView = {
|
|||
/*
|
||||
* Handle click events on the tree.
|
||||
*/
|
||||
onTreeClick: function onTreeClick(event) {
|
||||
onTreeClick: function(event) {
|
||||
if (event.button == 2)
|
||||
return;
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ var gUsageTreeView = {
|
|||
/*
|
||||
* Toggle enabled state of an engine.
|
||||
*/
|
||||
toggle: function toggle(row) {
|
||||
toggle: function(row) {
|
||||
// Update the tree
|
||||
let collection = this._collections[row];
|
||||
collection.enabled = !collection.enabled;
|
||||
|
|
@ -180,7 +180,7 @@ var gUsageTreeView = {
|
|||
* Return a list of engines (or rather their pref names) that should be
|
||||
* disabled.
|
||||
*/
|
||||
getEnginesToDisable: function getEnginesToDisable() {
|
||||
getEnginesToDisable: function() {
|
||||
// Tycho: return [coll.name for each (coll in this._collections) if (!coll.enabled)];
|
||||
let engines = [];
|
||||
for each (let coll in this._collections) {
|
||||
|
|
@ -228,7 +228,7 @@ var gUsageTreeView = {
|
|||
}
|
||||
},
|
||||
|
||||
setTree: function setTree(tree) {
|
||||
setTree: function(tree) {
|
||||
this.treeBox = tree;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ var gSyncSetup = {
|
|||
}
|
||||
},
|
||||
|
||||
resetPassphrase: function resetPassphrase() {
|
||||
resetPassphrase: function() {
|
||||
// Apply the existing form fields so that
|
||||
// Weave.Service.changePassphrase() has the necessary credentials.
|
||||
Weave.Service.identity.account = document.getElementById("existingAccountName").value;
|
||||
|
|
@ -281,7 +281,7 @@ var gSyncSetup = {
|
|||
return true;
|
||||
},
|
||||
|
||||
onPINInput: function onPINInput(textbox) {
|
||||
onPINInput: function(textbox) {
|
||||
if (textbox && textbox.value.length == PIN_PART_LENGTH) {
|
||||
this.nextFocusEl[textbox.id].focus();
|
||||
}
|
||||
|
|
@ -595,21 +595,21 @@ var gSyncSetup = {
|
|||
return false;
|
||||
},
|
||||
|
||||
startPairing: function startPairing() {
|
||||
startPairing: function() {
|
||||
this.pairDeviceErrorRow.hidden = true;
|
||||
// When onAbort is called, Weave may already be gone.
|
||||
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
|
||||
|
||||
let self = this;
|
||||
let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({
|
||||
onPaired: function onPaired() {
|
||||
onPaired: function() {
|
||||
self.wizard.pageIndex = INTRO_PAGE;
|
||||
},
|
||||
onComplete: function onComplete() {
|
||||
onComplete: function() {
|
||||
// This method will never be called since SendCredentialsController
|
||||
// will take over after the wizard completes.
|
||||
},
|
||||
onAbort: function onAbort(error) {
|
||||
onAbort: function(error) {
|
||||
delete self._jpakeclient;
|
||||
|
||||
// Aborted by user, ignore. The window is almost certainly going to close
|
||||
|
|
@ -636,7 +636,7 @@ var gSyncSetup = {
|
|||
jpakeclient.pairWithPIN(pin, expectDelay);
|
||||
},
|
||||
|
||||
completePairing: function completePairing() {
|
||||
completePairing: function() {
|
||||
if (!this._jpakeclient) {
|
||||
// The channel was aborted while we were setting up the account
|
||||
// locally. XXX TODO should we do anything here, e.g. tell
|
||||
|
|
@ -660,15 +660,15 @@ var gSyncSetup = {
|
|||
|
||||
let self = this;
|
||||
this._jpakeclient = new Weave.JPAKEClient({
|
||||
displayPIN: function displayPIN(pin) {
|
||||
displayPIN: function(pin) {
|
||||
document.getElementById("easySetupPIN1").value = pin.slice(0, 4);
|
||||
document.getElementById("easySetupPIN2").value = pin.slice(4, 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.basicPassword = credentials.password;
|
||||
Weave.Service.identity.syncKey = credentials.synckey;
|
||||
|
|
@ -676,7 +676,7 @@ var gSyncSetup = {
|
|||
gSyncSetup.wizardFinish();
|
||||
},
|
||||
|
||||
onAbort: function onAbort(error) {
|
||||
onAbort: function(error) {
|
||||
delete self._jpakeclient;
|
||||
|
||||
// Ignore if wizard is aborted.
|
||||
|
|
@ -1017,7 +1017,7 @@ var gSyncSetup = {
|
|||
this._setFeedback(element, success, str);
|
||||
},
|
||||
|
||||
loadCaptcha: function loadCaptcha() {
|
||||
loadCaptcha: function() {
|
||||
let captchaURI = Weave.Service.miscAPI + "captcha_html";
|
||||
// First check for NoScript and whitelist the right sites.
|
||||
this._handleNoScript(true);
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ var gSyncUtils = {
|
|||
openUILinkIn(url, "tab");
|
||||
},
|
||||
|
||||
changeName: function changeName(input) {
|
||||
changeName: function(input) {
|
||||
// Make sure to update to a modified name, e.g., empty-string -> default
|
||||
Weave.Service.clientsEngine.localName = input.value;
|
||||
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
|
||||
let openedDialog = Services.wm.getMostRecentWindow("Sync:" + type);
|
||||
if (openedDialog != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue