mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Remove trailing whitespace in service.js and util.js.
This commit is contained in:
parent
c9b2732fbe
commit
d368cdd88b
@ -398,8 +398,8 @@ WeaveSvc.prototype = {
|
||||
break;
|
||||
|
||||
case FIREFOX_ID:
|
||||
engines = ["Bookmarks", "Cookie", "Extension", "Form", "History",
|
||||
"Input", "MicroFormat", "Password", "Plugin", "Prefs", "Tab",
|
||||
engines = ["Bookmarks", "Cookie", "Extension", "Form", "History",
|
||||
"Input", "MicroFormat", "Password", "Plugin", "Prefs", "Tab",
|
||||
"Theme"];
|
||||
break;
|
||||
|
||||
@ -504,8 +504,8 @@ WeaveSvc.prototype = {
|
||||
this._log.debug("Error setting cluster for user " + username);
|
||||
return false;
|
||||
},
|
||||
|
||||
// update cluster if required. returns false if the update was not required
|
||||
|
||||
// update cluster if required. returns false if the update was not required
|
||||
updateCluster: function WeaveSvc_updateCluster(username) {
|
||||
let cTime = Date.now();
|
||||
let lastUp = parseFloat(Svc.Prefs.get("lastClusterUpdate"));
|
||||
@ -517,7 +517,7 @@ WeaveSvc.prototype = {
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
verifyLogin: function WeaveSvc_verifyLogin(username, password, passphrase, isLogin)
|
||||
this._catch(this._notify("verify-login", "", function() {
|
||||
this._log.debug("Verifying login for user " + username);
|
||||
@ -537,12 +537,12 @@ WeaveSvc.prototype = {
|
||||
return headers;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// login may fail because of cluster change
|
||||
try {
|
||||
res.get();
|
||||
} catch (e) {}
|
||||
|
||||
|
||||
try {
|
||||
switch (res.lastChannel.responseStatus) {
|
||||
case 200:
|
||||
@ -574,7 +574,7 @@ WeaveSvc.prototype = {
|
||||
this._log.debug("Verifying passphrase");
|
||||
this.username = username;
|
||||
ID.get("WeaveID").setTempPassword(password);
|
||||
|
||||
|
||||
try {
|
||||
let pubkey = PubKeys.getDefaultKey();
|
||||
let privkey = PrivKeys.get(pubkey.privateKeyUri);
|
||||
@ -593,7 +593,7 @@ WeaveSvc.prototype = {
|
||||
this._catch(this._notify("changepph", "", function() {
|
||||
let pubkey = PubKeys.getDefaultKey();
|
||||
let privkey = PrivKeys.get(pubkey.privateKeyUri);
|
||||
|
||||
|
||||
/* Re-encrypt with new passphrase.
|
||||
* FIXME: verifyPassphrase first!
|
||||
*/
|
||||
@ -601,17 +601,17 @@ WeaveSvc.prototype = {
|
||||
this.passphrase, privkey.payload.salt,
|
||||
privkey.payload.iv, newphrase);
|
||||
privkey.payload.keyData = newkey;
|
||||
|
||||
|
||||
new Resource(privkey.uri).put(privkey.serialize());
|
||||
this.passphrase = newphrase;
|
||||
|
||||
|
||||
return true;
|
||||
}))(),
|
||||
|
||||
|
||||
changePassword: function WeaveSvc_changePassword(newpass)
|
||||
this._catch(this._notify("changepwd", "", function() {
|
||||
function enc(x) encodeURIComponent(x);
|
||||
let message = "uid=" + enc(this.username) + "&password=" +
|
||||
let message = "uid=" + enc(this.username) + "&password=" +
|
||||
enc(this.password) + "&new=" + enc(newpass);
|
||||
let url = Svc.Prefs.get('tmpServerURL') + '0.3/api/register/chpwd';
|
||||
let res = new Weave.Resource(url);
|
||||
@ -624,35 +624,35 @@ WeaveSvc.prototype = {
|
||||
this._log.info("Password change failed: " + resp);
|
||||
throw "Could not change password";
|
||||
}
|
||||
|
||||
|
||||
this.password = newpass;
|
||||
return true;
|
||||
}))(),
|
||||
|
||||
|
||||
resetPassphrase: function WeaveSvc_resetPassphrase(newphrase)
|
||||
this._catch(this._notify("resetpph", "", function() {
|
||||
/* Make remote commands ready so we have a list of clients beforehand */
|
||||
this.prepCommand("logout", []);
|
||||
let clientsBackup = Clients._store.clients;
|
||||
|
||||
|
||||
/* Wipe */
|
||||
this.wipeServer();
|
||||
|
||||
|
||||
/* Set remote commands before syncing */
|
||||
Clients._store.clients = clientsBackup;
|
||||
let username = this.username;
|
||||
let password = this.password;
|
||||
this.logout();
|
||||
|
||||
|
||||
/* Set this so UI is updated on next run */
|
||||
this.passphrase = newphrase;
|
||||
|
||||
|
||||
/* Login in sync: this also generates new keys */
|
||||
this.login(username, password, newphrase);
|
||||
this.sync(true);
|
||||
return true;
|
||||
}))(),
|
||||
|
||||
|
||||
_autoConnectAttempts: 0,
|
||||
_autoConnect: function WeaveSvc__attemptAutoConnect() {
|
||||
try {
|
||||
@ -681,17 +681,17 @@ WeaveSvc.prototype = {
|
||||
this._autoConnect();
|
||||
}));
|
||||
this._autoConnectTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
|
||||
|
||||
// back off slowly, with some random fuzz to avoid repeated collisions
|
||||
var interval = Math.floor(Math.random() * SCHEDULED_SYNC_INTERVAL +
|
||||
let interval = Math.floor(Math.random() * SCHEDULED_SYNC_INTERVAL +
|
||||
SCHEDULED_SYNC_INTERVAL * this._autoConnectAttempts);
|
||||
this._autoConnectAttempts++;
|
||||
this._autoConnectTimer.initWithCallback(listener, interval,
|
||||
Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
this._log.debug("Scheduling next autoconnect attempt in " +
|
||||
this._log.debug("Scheduling next autoconnect attempt in " +
|
||||
interval / 1000 + " seconds.");
|
||||
},
|
||||
|
||||
|
||||
login: function WeaveSvc_login(username, password, passphrase)
|
||||
this._catch(this._lock(this._notify("login", "", function() {
|
||||
this._loggedIn = false;
|
||||
@ -790,7 +790,7 @@ WeaveSvc.prototype = {
|
||||
let remoteVersion = (meta && meta.payload.storageVersion)?
|
||||
meta.payload.storageVersion : "";
|
||||
|
||||
this._log.debug(["Weave Version:", WEAVE_VERSION, "Compatible:",
|
||||
this._log.debug(["Weave Version:", WEAVE_VERSION, "Compatible:",
|
||||
COMPATIBLE_VERSION, "Remote:", remoteVersion].join(" "));
|
||||
|
||||
if (!meta || !meta.payload.storageVersion || !meta.payload.syncID ||
|
||||
@ -969,14 +969,14 @@ WeaveSvc.prototype = {
|
||||
|
||||
/**
|
||||
* Call sync() on an idle timer
|
||||
*
|
||||
*
|
||||
*/
|
||||
syncOnIdle: function WeaveSvc_syncOnIdle() {
|
||||
this._log.debug("Idle timer created for sync, will sync after " +
|
||||
IDLE_TIME + " seconds of inactivity.");
|
||||
Svc.Idle.addIdleObserver(this, IDLE_TIME);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set a timer for the next sync
|
||||
*/
|
||||
@ -989,7 +989,7 @@ WeaveSvc.prototype = {
|
||||
this._syncTimer.cancel();
|
||||
else
|
||||
this._syncTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
|
||||
|
||||
let listener = new Utils.EventListener(Utils.bind2(this,
|
||||
function WeaveSvc__scheduleNextSyncCallback(timer) {
|
||||
this._syncTimer = null;
|
||||
@ -1006,7 +1006,7 @@ WeaveSvc.prototype = {
|
||||
*/
|
||||
_handleSyncError: function WeaveSvc__handleSyncError() {
|
||||
let shouldBackoff = false;
|
||||
|
||||
|
||||
let err = Weave.Service.detailedStatus.sync;
|
||||
// we'll assume the server is just borked a little for these
|
||||
switch (err) {
|
||||
@ -1018,7 +1018,7 @@ WeaveSvc.prototype = {
|
||||
|
||||
// specifcally handle 500, 502, 503, 504 errors
|
||||
// xxxmpc: what else should be in this list?
|
||||
// this is sort of pseudocode, need a way to get at the
|
||||
// this is sort of pseudocode, need a way to get at the
|
||||
if (!shouldBackoff) {
|
||||
try {
|
||||
shouldBackoff = Utils.checkStatus(Records.lastResource.lastChannel.responseStatus, null, [500,[502,504]]);
|
||||
@ -1028,11 +1028,11 @@ WeaveSvc.prototype = {
|
||||
shouldBackoff = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if this is a client error, do the next sync as normal and return
|
||||
if (!shouldBackoff) {
|
||||
this._scheduleNextSync();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// ok, something failed connecting to the server, rev the counter
|
||||
@ -1376,7 +1376,7 @@ WeaveSvc.prototype = {
|
||||
// Process each command in order
|
||||
for each ({command: command, args: args} in commands) {
|
||||
this._log.debug("Processing command: " + command + "(" + args + ")");
|
||||
|
||||
|
||||
let engines = [args[0]];
|
||||
switch (command) {
|
||||
case "resetAll":
|
||||
|
@ -633,16 +633,16 @@ let Utils = {
|
||||
win = win.activeWindow;
|
||||
win["open" + type].apply(win, Array.slice(arguments, 2));
|
||||
},
|
||||
|
||||
|
||||
_openChromeWindow: function Utils_openCWindow(name, uri, options, args) {
|
||||
Utils.openWindow(name, "chrome://weave/content/" + uri, options, args);
|
||||
},
|
||||
|
||||
|
||||
openWindow: function Utils_openWindow(name, uri, options, args) {
|
||||
Utils._openWin(name, "Window", null, uri, "",
|
||||
options || "centerscreen,chrome,dialog,resizable=yes", args);
|
||||
options || "centerscreen,chrome,dialog,resizable=yes", args);
|
||||
},
|
||||
|
||||
|
||||
openDialog: function Utils_openDialog(name, uri, options, args) {
|
||||
Utils._openWin(name, "Dialog", "chrome://weave/content/" + uri, "",
|
||||
options || "centerscreen,chrome,dialog,modal,resizable=no", args);
|
||||
@ -660,7 +660,7 @@ let Utils = {
|
||||
openShare: function Utils_openShare() {
|
||||
Utils.openDialog("Share", "share.xul");
|
||||
},
|
||||
|
||||
|
||||
openLog: function Utils_openLog() {
|
||||
Utils._openChromeWindow("Log", "log.xul");
|
||||
},
|
||||
@ -671,11 +671,11 @@ let Utils = {
|
||||
openSync: function Utils_openSync() {
|
||||
Utils._openChromeWindow("Sync", "pick-sync.xul");
|
||||
},
|
||||
|
||||
|
||||
openWizard: function Utils_openWizard() {
|
||||
Utils._openChromeWindow("Wizard", "wizard.xul");
|
||||
},
|
||||
|
||||
|
||||
// assumes an nsIConverterInputStream
|
||||
readStream: function Weave_readStream(is) {
|
||||
let ret = "", str = {};
|
||||
|
Loading…
Reference in New Issue
Block a user