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"]
|
let loginManager = Components.classes["@mozilla.org/login-manager;1"]
|
||||||
.getService(Components.interfaces.nsILoginManager);
|
.getService(Components.interfaces.nsILoginManager);
|
||||||
let logins = loginManager.findLogins({}, aHostName, null, aRealm);
|
let logins = loginManager.findLogins({}, aHostName, null, aRealm);
|
||||||
|
|
||||||
|
let newLoginInfo = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
|
||||||
|
.createInstance(Components.interfaces.nsILoginInfo);
|
||||||
|
newLoginInfo.init(aHostName, null, aRealm, aUsername, aPassword, "", "");
|
||||||
if (logins.length > 0) {
|
if (logins.length > 0) {
|
||||||
let loginInfo = logins[0].clone();
|
loginManager.modifyLogin(logins[0], newLoginInfo);
|
||||||
loginInfo.password = aPassword;
|
|
||||||
loginManager.modifyLogin(logins[0], loginInfo);
|
|
||||||
} else {
|
} else {
|
||||||
let loginInfo = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
|
loginManager.addLogin(newLoginInfo);
|
||||||
.createInstance(Components.interfaces.nsILoginInfo);
|
|
||||||
loginInfo.init(aHostName, null, aRealm, aUsername, aPassword, "", "");
|
|
||||||
loginManager.addLogin(loginInfo);
|
|
||||||
}
|
}
|
||||||
} catch (exc) {
|
} catch (exc) {
|
||||||
cal.ASSERT(false, exc);
|
cal.ASSERT(false, exc);
|
||||||
|
|
|
@ -477,7 +477,11 @@ calGoogleSession.prototype = {
|
||||||
// will be processed when the login is complete. Otherwise start
|
// will be processed when the login is complete. Otherwise start
|
||||||
// logging in.
|
// logging in.
|
||||||
if (!this.mLoggingIn && this.mAuthToken == null) {
|
if (!this.mLoggingIn && this.mAuthToken == null) {
|
||||||
this.loginAndContinue(aRequest.calendar);
|
// 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
|
* LOGitem
|
||||||
* Custom logging functions
|
* Custom logging functions
|
||||||
|
|
Загрузка…
Ссылка в новой задаче