author Rob Lemley <>
Mon, 05 Nov 2018 15:29:22 -0500
changeset 32811 d3c5b1d085805fd54890be3cf65a16d0c704541d
parent 31640 9ae99c6bd8b53dc6556fcee68dcf911ca48905a0
child 33541 6e514874b3267dcff87456dff8620f7c51dc1f5c
permissions -rw-r--r--
Bug 1499590 - Backed out changeset 089769dbf256 to remove periodic-file-updates cron task. a=backout This removes the periodic-file-updates (pfu) cron task from comm-* repositories, resetting the status quo so that nightly builds can be run while continuing to debug the issues with the pfu tasks.

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

 * Backwards compat for calUtils migration.


/* exported injectCalUtilsCompat */

this.EXPORTED_SYMBOLS = ["injectCalUtilsCompat"];

 * Migration data for backwards compatibility, will be used with
 * injectCalUtilsCompat.
var migrations = {
    acl: {
        isCalendarWritable: "isCalendarWritable",
        userCanAddItemsToCalendar: "userCanAddItemsToCalendar",
        userCanDeleteItemsFromCalendar: "userCanDeleteItemsFromCalendar",
        userCanModifyItem: "userCanModifyItem"
    category: {
        setupDefaultCategories: "setupDefaultCategories",
        getPrefCategoriesArray: "fromPrefs",
        categoriesStringToArray: "stringToArray",
        categoriesArrayToString: "arrayToString"
    data: {
        binarySearch: "binarySearch",
        binaryInsertNode: "binaryInsertNode",
        binaryInsert: "binaryInsert",
        compareObjects: "compareObjects",
        // isPropertyValueSame has been removed, it can simply be done with Array every()
    dtz: {
        now: "now",
        ensureDateTime: "ensureDateTime",
        getRecentTimezones: "getRecentTimezones",
        saveRecentTimezone: "saveRecentTimezone",
        getDefaultStartDate: "getDefaultStartDate",
        setDefaultStartEndHour: "setDefaultStartEndHour",
        calGetStartDateProp: "startDateProp",
        calGetEndDateProp: "endDateProp",
        sameDay: "sameDay",
        jsDateToDateTime: "jsDateToDateTime",
        dateTimeToJsDate: "dateTimeToJsDate",
        fromRFC3339: "fromRFC3339",
        toRFC3339: "toRFC3339",

        // The following are now getters
        calendarDefaultTimezone: "defaultTimezone",
        floating: "floating",
        UTC: "UTC"
    email: {
        sendMailTo: "sendMailTo",
        calIterateEmailIdentities: "iterateIdentities",
        prependMailTo: "prependMailTo",
        removeMailTo: "removeMailTo",
        getRecipientList: "createRecipientList",
        getAttendeeEmail: "getAttendeeEmail",
        validateRecipientList: "validateRecipientList",
        attendeeMatchesAddresses: "attendeeMatchesAddresses"
    item: {
        // ItemDiff also belongs here, but is separately migrated in
        // calItemUtils.jsm
        isItemSupported: "isItemSupported",
        isEventCalendar: "isEventCalendar",
        isTaskCalendar: "isTaskCalendar",
        isEvent: "isEvent",
        isToDo: "isToDo",
        checkIfInRange: "checkIfInRange",
        setItemProperty: "setItemProperty",
        getEventDefaultTransparency: "getEventDefaultTransparency"
    iterate: {
        itemIterator: "items",
        forEach: "forEach",
        ical: {
            calendarComponentIterator: "items",
            subcomponentIterator: "icalSubcomponent",
            propertyIterator: "icalProperty",
            paramIterator: "icalParameter"
    itip: {
        getPublishLikeItemCopy: "getPublishLikeItemCopy",
        isInvitation: "isInvitation",
        isOpenInvitation: "isOpenInvitation",
        resolveDelegation: "resolveDelegation",
        getInvitedAttendee: "getInvitedAttendee",
        getAttendeesBySender: "getAttendeesBySender"
    provider: {
        prepHttpChannel: "prepHttpChannel",
        sendHttpRequest: "sendHttpRequest",
        createStreamLoader: "createStreamLoader",
        convertByteArray: "convertByteArray",
        InterfaceRequestor_getInterface: "InterfaceRequestor_getInterface",
        getImipTransport: "getImipTransport",
        getEmailIdentityOfCalendar: "getEmailIdentityOfCalendar",
        promptOverwrite: "promptOverwrite",
        getCalendarDirectory: "getCalendarDirectory"
    unifinder: {
        sortEntryComparer: "sortEntryComparer",
        getItemSortKey:  "getItemSortKey",
        // compareNative*, compareNumber, sortEntry, sortEntryItem, sortEntryKey and
        // getSortTypeForSortKey are no longer available. There is a new
        // cal.unifinder.sortItems though that should do everything necessary.
    view: {
        isMouseOverBox: "isMouseOverBox",
        // calRadioGroupSelectItem and applyAttributeToMenuChildren are no longer available.
        removeChildElementsByAttribute: "removeChildElementsByAttribute",
        getParentNodeOrThis: "getParentNodeOrThis",
        getParentNodeOrThisByAttribute: "getParentNodeOrThisByAttribute",
        formatStringForCSSRule: "formatStringForCSSRule",
        getCompositeCalendar: "getCompositeCalendar",
        hashColor: "hashColor",
        getContrastingTextColor: "getContrastingTextColor"
    window: {
        openCalendarWizard: "openCalendarWizard",
        openCalendarProperties: "openCalendarProperties",
        calPrint: "openPrintDialog",
        getCalendarWindow: "getCalendarWindow"

 * Generate a forward function on the given global, for the namespace from the
 * migrations data.
 * @param global        The global object to inject on.
 * @param namespace     The new namespace in the cal object.
 * @param from          The function/property name being migrated from
 * @param to            The function/property name being migrated to
function generateForward(global, namespace, from, to, targetGlobal=null) {
    // Protect from footguns
    if (typeof global[from] != "undefined") {
        throw new Error(from + " is already defined on the cal. namespace!");

    global[from] = function(...args) {
        let suffix = "";
        let target = (targetGlobal || global)[namespace][to];
        if (typeof target == "function") {
            target = target(...args);
            suffix = "()";

        Deprecated.warning(`calUtils' cal.${from}() has changed to cal.${namespace}.${to}${suffix}`,

        return target;

 * Inject the backwards compatibility functions using above migration data
 * @param global        The global object to inject on.
function injectCalUtilsCompat(global) {
    for (let [namespace, nsdata] of Object.entries(migrations)) {
        for (let [from, to] of Object.entries(nsdata)) {
            if (typeof to == "object") {
                global[from] = {};
                for (let [frominner, toinner] of Object.entries(to)) {
                    generateForward(global[from], namespace, frominner, toinner, global);
            } else {
                generateForward(global, namespace, from, to);

    // calGetString is special, as the argument order and kind has changed as well
    global.calGetString = function(aBundleName, aStringName, aParams, aComponent="calendar") {
        Deprecated.warning("calUtils' cal.calGetString() has changed to cal.l10n.get*String()" +
                           " and the parameter order has changed",
        return global.l10n.getAnyString(aComponent, aBundleName, aStringName, aParams);

    global.ProviderBase = class extends global.provider.BaseClass {
        initProviderBase() {
            Deprecated.warning("calProviderUtils' cal.ProviderBase() has changed to cal.provider.BaseClass()",

    global.BadCertHandler = class extends global.provider.BadCertHandler {
        constructor() {
            Deprecated.warning("calProviderUtils' cal.BadCertHandler() has changed to cal.provider.BadCertHandler()",

    global.FreeBusyInterval = class extends global.provider.FreeBusyInterval {
        constructor() {
            Deprecated.warning("calProviderUtils' cal.FreeBusyInterval() has changed to cal.provider.FreeBusyInterval()",