Fix bug 474552 - Error: Assert failed: TypeError: logins[0].clone is not a function. r=Standard8
This commit is contained in:
Родитель
6090e63d90
Коммит
49ccc4aab3
|
@ -126,15 +126,14 @@ cal.auth = {
|
|||
let loginManager = Components.classes["@mozilla.org/login-manager;1"]
|
||||
.getService(Components.interfaces.nsILoginManager);
|
||||
let logins = loginManager.findLogins({}, aHostName, null, aRealm);
|
||||
if (logins.length > 0) {
|
||||
let loginInfo = logins[0].clone();
|
||||
loginInfo.password = aPassword;
|
||||
loginManager.modifyLogin(logins[0], loginInfo);
|
||||
} else {
|
||||
let loginInfo = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
|
||||
|
||||
let newLoginInfo = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
|
||||
.createInstance(Components.interfaces.nsILoginInfo);
|
||||
loginInfo.init(aHostName, null, aRealm, aUsername, aPassword, "", "");
|
||||
loginManager.addLogin(loginInfo);
|
||||
newLoginInfo.init(aHostName, null, aRealm, aUsername, aPassword, "", "");
|
||||
if (logins.length > 0) {
|
||||
loginManager.modifyLogin(logins[0], newLoginInfo);
|
||||
} else {
|
||||
loginManager.addLogin(newLoginInfo);
|
||||
}
|
||||
} catch (exc) {
|
||||
cal.ASSERT(false, exc);
|
||||
|
|
|
@ -477,7 +477,11 @@ calGoogleSession.prototype = {
|
|||
// will be processed when the login is complete. Otherwise start
|
||||
// logging in.
|
||||
if (!this.mLoggingIn && this.mAuthToken == null) {
|
||||
// We need to do this on a timeout, otherwise the UI thread will
|
||||
// block when the password prompt is shown.
|
||||
setTimeout(function() {
|
||||
this.loginAndContinue(aRequest.calendar);
|
||||
}, 0, this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1061,6 +1061,25 @@ syncSetter.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function to create a timer in a context where window.setTimeout is not
|
||||
* available
|
||||
*
|
||||
* @param aFunc The function to call when the timer fires
|
||||
* @param aTimeout The timeout in milliseconds.
|
||||
* @param aThis (optional) The |this| object to call the function with.
|
||||
*/
|
||||
function setTimeout(aFunc, aTimeout, aThis) {
|
||||
let timerCallback = {
|
||||
notify: function setTimeout_notify() {
|
||||
aFunc.call(aThis);
|
||||
}
|
||||
};
|
||||
let timer = Components.classes["@mozilla.org/timer;1"]
|
||||
.createInstance(Components.interfaces.nsITimer);
|
||||
timer.initWithCallback(timerCallback, aTimeout, timer.TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
/**
|
||||
* LOGitem
|
||||
* Custom logging functions
|
||||
|
|
Загрузка…
Ссылка в новой задаче