Bug 1187670 - AUDIO alarms without attachments are rejected although valid. r=redDragon
authorPhilipp Kewisch <mozilla@kewis.ch>
Sun, 26 Jul 2015 09:06:30 +0200
changeset 22848 0c4d96a60e8792dd4aa9bf516fcc52902367b350
parent 22847 b57fa117d0389abd9835a21dbafa5d5cb241f273
child 22849 46f923a77f83e2c49ef6d9d19e9cd7f3b91af419
push id1443
push usermbanner@mozilla.com
push dateMon, 10 Aug 2015 18:31:17 +0000
treeherdercomm-beta@8fe07d686c22 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersredDragon
bugs1187670
Bug 1187670 - AUDIO alarms without attachments are rejected although valid. r=redDragon
calendar/base/src/calAlarm.js
calendar/test/unit/test_alarm.js
--- a/calendar/base/src/calAlarm.js
+++ b/calendar/base/src/calAlarm.js
@@ -422,22 +422,16 @@ calAlarm.prototype = {
         /* TODO should we be strict here?
         if (this.action == "EMAIL" && !this.getAttendees({}).length) {
             throw Components.results.NS_ERROR_NOT_INITIALIZED;
         } */
         for each (let attendee in this.getAttendees({})) {
             comp.addProperty(attendee.icalProperty);
         }
 
-        // Set up attachments (REQUIRED for AUDIO and EMAIL types, there MUST
-        // NOT be more than one for AUDIO.
-        if (this.action == "AUDIO" && this.getAttachments({}).length != 1) {
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
-        }
-
         /* TODO should we be strict here?
         if (this.action == "EMAIL" && !this.attachments.length) {
             throw Components.results.NS_ERROR_NOT_INITIALIZED;
         } */
 
         for each (let attachment in this.getAttachments({})) {
             comp.addProperty(attachment.icalProperty);
         }
--- a/calendar/test/unit/test_alarm.js
+++ b/calendar/test/unit/test_alarm.js
@@ -142,21 +142,16 @@ function test_audio_alarm() {
     let attendee = cal.createAttendee();
     attendee.id = "mailto:horst";
 
     try {
         alarm.addAttendee(attendee);
         do_throw("AUDIO alarm should not be able to save attendees");
     } catch (e) {}
 
-    // No attendee yet, should not be initialized
-    throws(function() {
-        alarm.icalComponent;
-    }, /Component not initialized/);
-
     // Test attachments
     let sound = cal.createAttachment();
     sound.uri = makeURL("file:///sound.wav");
     let sound2 = cal.createAttachment();
     sound2.uri = makeURL("file:///sound2.wav");
 
     // Adding an attachment should work
     alarm.addAttachment(sound);
@@ -168,17 +163,17 @@ function test_audio_alarm() {
     // Adding twice shouldn't change anything
     alarm.addAttachment(sound);
     addedAttachments = alarm.getAttachments({});
     equal(addedAttachments.length, 1);
     equal(addedAttachments[0], sound);
 
     try {
         alarm.addAttachment(sound2);
-        do_throw("Adding a second alarm should fail for type AUDIO");
+        do_throw("Adding a second attachment should fail for type AUDIO");
     } catch (e) {}
 
     // Deleting should work
     alarm.deleteAttachment(sound);
     addedAttachments = alarm.getAttachments({});
     equal(addedAttachments.length, 0);
 
     // As well as clearing