rem: var format = document.getElementById('calendar-format').selectedItem.value; if (format == 'webdav') provider = 'ics'; else provider = 'caldav'; 
add: provider = document.getElementById('calendar-format').selectedItem.value; 
context: function doCreateCalendar(){    var cal_name = document.getElementById("calendar-name").value;    var cal_color = document.getElementById('calendar-color').color;    var type = document.getElementById('calendar-type').selectedItem.value;    var provider;    var uri;    if (type == 'local') {        provider = 'storage';        uri = 'moz-profile-calendar://?id=2';    } else {        uri = document.getElementById("calendar-uri").value;        var format = document.getElementById('calendar-format').selectedItem.value;        if (format == 'webdav')            provider = 'ics';        else            provider = 'caldav';    }            var calManager = getCalendarManager();    var cals = calManager.getCalendars({});    do {        var already = cals.filter(function (c) { return c.uri.spec == uri; })        if (already.length) {            if (type != 'local') {                // signalError("Already have calendar at this URI.");                Components.utils.reportError("Already have calendar with URI " + uri);                return false;            }            uri = uri.replace(/id=(\d+)/,                              function (s, id) { return "id=" + (Number(id) + 1); });        }    } while (already.length);    dump(cal_name + "\n");    dump(cal_color + "\n");    dump(uri + "\n");    dump(provider + "\n");    try {        var newCalendar = calManager.createCalendar(provider, makeURL(uri));    } catch (ex) {        dump(ex);        return false;    }    calManager.registerCalendar(newCalendar);        newCalendar.name = cal_name;    calManager.setCalendarPref(newCalendar, 'color', cal_color);    return true;}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/5fc64db25458a4137fc58d324befffbea0b68db6/calendarCreation.js/clean/calendar/resources/content/calendarCreation.js