Fix bug 1186547 - mReadOnly and mDisabled do not reflect readOnly and disabled properties. r=MakeMyDay,a=philipp
authorPhilipp Kewisch <mozilla@kewis.ch>
Wed, 22 Jul 2015 21:01:35 +0200
changeset 26190 18d4427d42034f71b24539482ae0b750aab47f62
parent 26189 b54342bc4cc56eb6b6f40573dec6c4288be00403
child 26191 3a6adf92dcac5b028aa1e013c8a7751aceaad6cf
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMakeMyDay, philipp
bugs1186547
Fix bug 1186547 - mReadOnly and mDisabled do not reflect readOnly and disabled properties. r=MakeMyDay,a=philipp
calendar/providers/caldav/calDavCalendar.js
calendar/providers/caldav/calDavRequestHandlers.js
--- a/calendar/providers/caldav/calDavCalendar.js
+++ b/calendar/providers/caldav/calDavCalendar.js
@@ -50,17 +50,16 @@ function caldavXPathFirst(aNode, aExpr, 
     return cal.xml.evalXPathFirst(aNode, aExpr, caldavNSResolver, aType);
 }
 
 function calDavCalendar() {
     this.initProviderBase();
     this.unmappedProperties = [];
     this.mUriParams = null;
     this.mItemInfoCache = {};
-    this.mDisabled = false;
     this.mCalHomeSet = null;
     this.mInboxUrl = null;
     this.mOutboxUrl = null;
     this.mCalendarUserAddress = null;
     this.mPrincipalUrl = null;
     this.mSenderAddress = null;
     this.mHrefIndex = {};
     this.mAuthScheme = null;
@@ -395,18 +394,16 @@ calDavCalendar.prototype = {
 
     //
     // calICalendar interface
     //
 
     // readonly attribute AUTF8String type;
     get type() { return "caldav"; },
 
-    mDisabled: true,
-
     mCalendarUserAddress: null,
     get calendarUserAddress() {
         return this.mCalendarUserAddress;
     },
 
     mPrincipalUrl: null,
     get principalUrl() {
         return this.mPrincipalUrl;
@@ -1397,17 +1394,17 @@ calDavCalendar.prototype = {
                         thisCalendar.name);
                 return notifyListener(Components.results.NS_OK);
             }
 
             if (request.responseStatus == 404) {
                 cal.LOG("CalDAV: Disabling calendar " + thisCalendar.name +
                         " due to 404");
                 return notifyListener(Components.results.NS_ERROR_FAILURE);
-            } else if (request.responseStatus == 207 && thisCalendar.mDisabled) {
+            } else if (request.responseStatus == 207 && thisCalendar.getProperty("disabled")) {
                 // Looks like the calendar is there again, check its resource
                 // type first.
                 thisCalendar.setupAuthentication(aChangeLogListener);
                 return;
              }
 
             let str = cal.convertByteArray(aResult, aResultLength);
             if (!str) {
@@ -1494,17 +1491,17 @@ calDavCalendar.prototype = {
      * @param aUri                  The uri to request the items from.
      *                                NOTE: This must be the uri without any uri
      *                                     params. They will be appended in this
      *                                     function.
      * @param aChangeLogListener    (optional) The listener to notify for cached
      *                                         calendars.
      */
     getUpdatedItems: function caldav_getUpdatedItems(aUri, aChangeLogListener) {
-        if (this.mDisabled) {
+        if (this.getProperty("disabled")) {
             // check if maybe our calendar has become available
             this.setupAuthentication(aChangeLogListener);
             return;
         }
 
         if (this.mHasWebdavSyncSupport) {
             webDavSync = new webDavSyncHandler(this,aUri,aChangeLogListener);
             webDavSync.doWebDAVSync();
@@ -1871,19 +1868,19 @@ calDavCalendar.prototype = {
                 cal.LOG("CalDAV: " + thisCalendar.name + " points to a DAV resource, but not a CalDAV calendar");
                 thisCalendar.completeCheckServerInfo(aChangeLogListener,
                                                      Components.interfaces.calIErrors.DAV_DAV_NOT_CALDAV);
                 return;
             }
 
             if (resourceType == kDavResourceTypeCalendar) {
                 // If this calendar was previously offline we want to recover
-                if (thisCalendar.mDisabled) {
-                    thisCalendar.mDisabled = false;
-                    thisCalendar.mReadOnly = false;
+                if (thisCalendar.getProperty("disabled")) {
+                    thisCalendar.setProperty("disabled", false);
+                    thisCalendar.readOnly = false;
                 }
                 thisCalendar.setCalHomeSet(true);
                 thisCalendar.checkServerCaps(aChangeLogListener);
             }
 
             // If we get here something must have gone wrong. Abort with a
             // general error to avoid an endless loop.
             thisCalendar.completeCheckServerInfo(aChangeLogListener, Components.results.NS_ERROR_FAILURE);
@@ -2325,18 +2322,18 @@ calDavCalendar.prototype = {
         var localizedMessage;
         var modificationError = mapModification[aErrNo];
 
         if (!message) {
             // Only notify if there is a message for this error
             return;
         }
         localizedMessage = cal.calGetString("calendar", message , [this.mUri.spec]);
-        this.mReadOnly = true;
-        this.mDisabled = true;
+        this.setProperty("disabled", true);
+        this.readOnly = true;
         this.notifyError(aErrNo, localizedMessage);
         this.notifyError(modificationError
                          ? Components.interfaces.calIErrors.MODIFICATION_FAILED
                          : Components.interfaces.calIErrors.READ_FAILED,
                          this.buildDetailedMessage(status, extraInfo));
     },
 
     buildDetailedMessage : function caldav_buildDetailedMessage(status, extraInfo) {
--- a/calendar/providers/caldav/calDavRequestHandlers.js
+++ b/calendar/providers/caldav/calDavRequestHandlers.js
@@ -313,17 +313,17 @@ webDavSyncHandler.prototype = {
     QueryInterface: XPCOMUtils.generateQI([
         Components.interfaces.nsISAXContentHandler,
         Components.interfaces.nsISAXErrorHandler,
         Components.interfaces.nsIRequestObserver,
         Components.interfaces.nsIStreamListener
     ]),
 
     doWebDAVSync: function doWebDAVSync() {
-        if (this.calendar.mDisabled) {
+        if (this.calendar.getProperty("disabled")) {
             // check if maybe our calendar has become available
             this.calendar.setupAuthentication(this.changeLogListener);
             return;
         }
 
 
         let syncTokenString = "<sync-token/>";
         if (this.calendar.mWebdavSyncToken && this.calendar.mWebdavSyncToken.length > 0) {
@@ -685,17 +685,17 @@ multigetSyncHandler.prototype = {
     QueryInterface: XPCOMUtils.generateQI([
         Components.interfaces.nsISAXContentHandler,
         Components.interfaces.nsISAXErrorHandler,
         Components.interfaces.nsIRequestObserver,
         Components.interfaces.nsIStreamListener
     ]),
 
     doMultiGet: function doMultiGet() {
-        if (this.calendar.mDisabled) {
+        if (this.calendar.getProperty("disabled")) {
             // check if maybe our calendar has become available
             this.calendar.setupAuthentication(this.changeLogListener);
             return;
         }
 
         let batchSize = Preferences.get("calendar.caldav.multigetBatchSize", 100);
         let hrefString = "";
         while (this.itemsNeedFetching.length && batchSize > 0) {