Bug 824423 - Unhandled exception NS_ERROR_NOT_AVAILABLE on write failure to WebDAV calendar. r=philipp
authorMatthew Mecca <matthew.mecca@gmail.com>
Thu, 18 Jul 2013 10:40:59 -0400
changeset 12772 839e3d7acdb1f25e88ee658ed0750540b3a9e8bf
parent 12771 3efb0311a21c7d8c7f2c754e8005f2b1f5bcc5fa
child 12773 835b680fda7ea39111f440e0fd80aa9c824e5c6c
push id9345
push userryanvm@gmail.com
push dateThu, 18 Jul 2013 14:48:41 +0000
treeherdercomm-central@17f6b3acfc77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs824423
Bug 824423 - Unhandled exception NS_ERROR_NOT_AVAILABLE on write failure to WebDAV calendar. r=philipp
calendar/providers/ics/calICSCalendar.js
--- a/calendar/providers/ics/calICSCalendar.js
+++ b/calendar/providers/ics/calICSCalendar.js
@@ -399,23 +399,28 @@ calICSCalendar.prototype = {
                        .createInstance(Components.interfaces.nsIScriptableInputStream);
          scriptableInputStream.init(inStream);
          scriptableInputStream.read(-1);
     },
     onStopRequest: function(request, ctxt, status, errorMsg)
     {
         ctxt = ctxt.wrappedJSObject;
         let httpChannel;
+        let requestSucceeded = false;
         try {
             httpChannel = request.QueryInterface(Components.interfaces.nsIHttpChannel);
-            cal.LOG("[calICSCalendar] channel.requestSucceeded: " + httpChannel.requestSucceeded);
+            requestSucceeded = httpChannel.requestSucceeded;
         } catch(e) {
         }
 
-        if ((httpChannel && !httpChannel.requestSucceeded) ||
+        if (httpChannel) {
+            cal.LOG("[calICSCalendar] channel.requestSucceeded: " + requestSucceeded);
+        }
+
+        if ((httpChannel && !requestSucceeded) ||
             (!httpChannel && !Components.isSuccessCode(request.status))) {
             ctxt.mObserver.onError(this.superCalendar,
                                    Components.isSuccessCode(request.status)
                                    ? calIErrors.DAV_PUT_ERROR
                                    : request.status,
                                    "Publishing the calendar file failed\n" +
                                        "Status code: "+request.status.toString(16)+"\n");
             ctxt.mObserver.onError(this.superCalendar, calIErrors.MODIFICATION_FAILED, "");