Bug 400278 CalDAV provider issues requests to unselected caldav accounts at startup, r=dbo

This commit is contained in:
browning%uwalumni.com 2008-04-21 00:34:14 +00:00
Родитель 745579a587
Коммит 4e866b7a7a
1 изменённых файлов: 25 добавлений и 6 удалений

Просмотреть файл

@ -73,6 +73,8 @@ function calDavCalendar() {
this.mAuthScheme = null;
this.mAuthRealm = null;
this.mObserver = null;
this.mFirstRefreshDone = false;
this.mQueuedQueries = [];
}
// some shorthand
@ -191,7 +193,6 @@ calDavCalendar.prototype = {
this.mUri = aUri;
this.initMemoryCalendar();
this.checkDavResourceType();
return aUri;
},
@ -229,6 +230,10 @@ calDavCalendar.prototype = {
mAuthRealm: null,
mFirstRefreshDone: false,
mQueuedQueries: null,
get authRealm() {
return this.mAuthRealm;
},
@ -924,6 +929,13 @@ calDavCalendar.prototype = {
aOperation, aClosure) {
LOG("refresh completed with status " + aStatusCode);
thisCalendar.mObservers.notify("onLoad", [thisCalendar]);
thisCalendar.mFirstRefreshDone = true;
while (thisCalendar.mQueuedQueries.length) {
var query = thisCalendar.mQueuedQueries.pop();
thisCalendar.mMemoryCalendar.getItems(query[0], query[1],
query[2], query[3],
query[4]);
}
};
// convert this into a form the WebDAV service can use
@ -951,9 +963,16 @@ calDavCalendar.prototype = {
getItems: function caldav_getItems(aItemFilter, aCount, aRangeStart,
aRangeEnd, aListener) {
this.mMemoryCalendar.getItems(aItemFilter, aCount, aRangeStart,
aRangeEnd, aListener);
if (!this.mFirstRefreshDone) {
if (!this.mQueuedQueries.length) {
this.checkDavResourceType();
}
var query = [aItemFilter, aCount, aRangeStart, aRangeEnd, aListener];
this.mQueuedQueries.push(query);
} else {
this.mMemoryCalendar.getItems(aItemFilter, aCount, aRangeStart,
aRangeEnd, aListener);
}
},
refresh: function caldav_refresh() {
@ -977,8 +996,8 @@ calDavCalendar.prototype = {
continue;
}
if (calendars[i].uri.prePath == this.uri.prePath &&
calendars[i].QueryInterface(calICalDavCalendar)
.authRealm == this.mAuthRealm) {
calendars[i].QueryInterface(calICalDavCalendar)
.authRealm == this.mAuthRealm) {
if (calendars[i].id == this.id) {
return true;
}