rem: var calComp = icssrv.parseICS(str); var subComp = calComp.getFirstSubcomponent("ANY"); while (subComp) { switch (subComp.componentType) { case "VEVENT": var event = Components.classes["@mozilla.org/calendar/event;1"] .createInstance(Components.interfaces.calIEvent); event.icalComponent = subComp; items.push(event); break; case "VTODO": var todo = Components.classes["@mozilla.org/calendar/todo;1"] .createInstance(Components.interfaces.calITodo); todo.icalComponent = subComp; items.push(todo); break; default:  
add:  var rootComp = icssrv.parseICS(str); var calComp;     if (rootComp.componentType == 'VCALENDAR') { calComp = rootComp; } else { calComp = rootComp.getFirstSubcomponent('VCALENDAR'); }  while (calComp) { var subComp = calComp.getFirstSubcomponent("ANY"); while (subComp) { switch (subComp.componentType) { case "VEVENT": var event = Components.classes["@mozilla.org/calendar/event;1"] .createInstance(Components.interfaces.calIEvent); event.icalComponent = subComp; items.push(event); break; case "VTODO": var todo = Components.classes["@mozilla.org/calendar/todo;1"] .createInstance(Components.interfaces.calITodo); todo.icalComponent = subComp; items.push(todo); break; default:  } subComp = calComp.getNextSubcomponent("ANY"); 
context: function ics_importFromStream(aStream, aCount) {    var items = new Array();    // Interpret the byte-array as an utf8 string, and convert into a    // javascript string.    var convStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]                               .getService(Components.interfaces.nsIConverterInputStream);    convStream.init(aStream, 'UTF-8', 0, 0x0000);    var tmpStr = {};    var str = "";    while (convStream.readString(-1, tmpStr)) {        str += tmpStr.value;    }    icssrv = Components.classes["@mozilla.org/calendar/ics-service;1"]                       .getService(Components.interfaces.calIICSService);    var calComp = icssrv.parseICS(str);    var subComp = calComp.getFirstSubcomponent("ANY");    while (subComp) {        switch (subComp.componentType) {        case "VEVENT":            var event = Components.classes["@mozilla.org/calendar/event;1"]                                  .createInstance(Components.interfaces.calIEvent);            event.icalComponent = subComp;            items.push(event);            break;        case "VTODO":            var todo = Components.classes["@mozilla.org/calendar/todo;1"]                                 .createInstance(Components.interfaces.calITodo);            todo.icalComponent = subComp;            items.push(todo);            break;        default:            // Nothing        }        subComp = calComp.getNextSubcomponent("ANY");    }    aCount.value = items.length;    return items;};
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/297db7e01f1fe01b4e26f5c7fcaea045f33e2acd/calIcsImportExport.js/buggy/calendar/import-export/calIcsImportExport.js