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