Permalink
Browse files

Bug 1484957 - Port bug 1484466: remove uses of XPCOMUtils.generateCI(…

…); rs=bustage
  • Loading branch information...
darktrojan committed Aug 22, 2018
1 parent b641cb0 commit 798e6c122fc5c7e73d274448a715d3383ef39fe9
@@ -4,7 +4,6 @@

var { ICAL, unwrapSetter, unwrapSingle, wrapGetter } = ChromeUtils.import("resource://calendar/modules/ical.js", null);
var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

function calRecurrenceRule(innerObject) {
this.innerObject = innerObject || new ICAL.Recur();
@@ -19,7 +18,7 @@ var calRecurrenceRuleClassID = Components.ID("{df19281a-5389-4146-b941-798cb93a7
calRecurrenceRule.prototype = {
QueryInterface: cal.generateQI(calRecurrenceRuleInterfaces),
classID: calRecurrenceRuleClassID,
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
contractID: "@mozilla.org/calendar/recurrence-rule;1",
classDescription: "Calendar Recurrence Rule",
classID: calRecurrenceRuleClassID,
@@ -201,6 +201,42 @@ var cal = {
}
},

/**
* Generate a ClassInfo implementation for a component. The returned object
* must be assigned to the 'classInfo' property of a JS object. The first and
* only argument should be an object that contains a number of optional
* properties: "interfaces", "contractID", "classDescription", "classID" and
* "flags". The values of the properties will be returned as the values of the
* various properties of the nsIClassInfo implementation.
*/
generateCI: function(classInfo) {
if (QueryInterface in classInfo) {
throw Error("In generateCI, don't use a component for generating classInfo");
}
/* Note that Ci[Ci.x] == Ci.x for all x */
let _interfaces = [];
for (let i = 0; i < classInfo.interfaces.length; i++) {
let iface = classInfo.interfaces[i];
if (Ci[iface]) {
_interfaces.push(Ci[iface]);
}
}
return {
getInterfaces: function(countRef) {
countRef.value = _interfaces.length;
return _interfaces;
},
getScriptableHelper: function() {
return null;
},
contractID: classInfo.contractID,
classDescription: classInfo.classDescription,
classID: classInfo.classID,
flags: classInfo.flags,
QueryInterface: ChromeUtils.generateQI([Ci.nsIClassInfo])
};
},

/**
* Schedules execution of the passed function to the current thread's queue.
*/
@@ -4,7 +4,6 @@

var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Preferences.jsm");

function peekAlarmWindow() {
@@ -42,7 +41,7 @@ calAlarmMonitor.prototype = {

classID: calAlarmMonitorClassID,
QueryInterface: cal.generateQI(calAlarmMonitorInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
contractID: "@mozilla.org/calendar/alarm-monitor;1",
classDescription: "Calendar Alarm Monitor",
classID: calAlarmMonitorClassID,
@@ -4,7 +4,6 @@

var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Preferences.jsm");
ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");

@@ -111,7 +110,7 @@ calAlarmService.prototype = {

classID: calAlarmServiceClassID,
QueryInterface: cal.generateQI(calAlarmServiceInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calAlarmServiceClassID,
contractID: "@mozilla.org/calendar/alarm-service;1",
classDescription: "Calendar Alarm Service",
@@ -27,7 +27,7 @@ var calCalendarManagerInterfaces = [
calCalendarManager.prototype = {
classID: calCalendarManagerClassID,
QueryInterface: cal.generateQI(calCalendarManagerInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calCalendarManagerClassID,
contractID: "@mozilla.org/calendar/manager;1",
classDescription: "Calendar Manager",
@@ -58,7 +58,7 @@ calCalendarSearchService.prototype = {

classID: calCalendarSearchServiceClassID,
QueryInterface: cal.generateQI(calCalendarSearchServiceInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calCalendarSearchServiceClassID,
contractID: "@mozilla.org/calendar/calendarsearch-service;1",
classDescription: "Calendar Search Service",
@@ -4,7 +4,6 @@

var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");

/**
@@ -34,7 +33,7 @@ calDeletedItems.prototype = {

classID: calDeletedItemsClassID,
QueryInterface: cal.generateQI(calDeletedItemsInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calDeletedItemsClassID,
contractID: "@mozilla.org/calendar/deleted-items-manager;1",
classDescription: "Database containing information about deleted items",
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

//
// constructor
@@ -28,7 +27,7 @@ calEvent.prototype = {

classID: calEventClassID,
QueryInterface: cal.generateQI(calEventInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calEventClassID,
contractID: "@mozilla.org/calendar/event;1",
classDescription: "Calendar Event",
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);

function calRecurrenceDate() {
@@ -22,12 +21,13 @@ calRecurrenceDate.prototype = {

classID: calRecurrenceDateClassID,
QueryInterface: cal.generateQI(calRecurrenceDateInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calRecurrenceDateClassID,
contractID: "@mozilla.org/calendar/recurrence-date;1",
classDescription: "The date of an occurrence of a recurring item",
interfaces: calRecurrenceDateInterfaces
}),

makeImmutable: function() {
this.isMutable = false;
},
@@ -48,7 +48,7 @@ calTimezoneService.prototype = {

classID: calTimezoneServiceClassID,
QueryInterface: cal.generateQI(calTimezoneServiceInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calTimezoneServiceClassID,
contractID: "@mozilla.org/calendar/timezone-service;1",
classDescription: "Calendar Timezone Service",
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

//
// constructor
@@ -31,7 +30,7 @@ calTodo.prototype = {

classID: calTodoClassID,
QueryInterface: cal.generateQI(calTodoInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calTodoClassID,
contractID: "@mozilla.org/calendar/todo;1",
classDescription: "Calendar Todo",
@@ -84,12 +84,6 @@ var calTransactionInterfaces = [
calTransaction.prototype = {
classID: calTransactionClassID,
QueryInterface: ChromeUtils.generateQI(calTransactionInterfaces),
classInfo: XPCOMUtils.generateCI({
classID: calTransactionClassID,
classDescription: "Calendar Transaction",
contractID: "mozilla.org/calendar/transaction;1",
interfaces: calTransactionInterfaces,
}),

mAction: null,
mCalendar: null,
@@ -103,7 +103,7 @@ calDavCalendar.prototype = {
__proto__: cal.provider.BaseClass.prototype,
classID: calDavCalendarClassID,
QueryInterface: cal.generateQI(calDavCalendarInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calDavCalendarClassID,
contractID: "@mozilla.org/calendar/calendar;1?type=caldav",
classDescription: "Calendar CalDAV back-end",
@@ -90,12 +90,6 @@ var calCompositeCalendarInterfaces = [
calCompositeCalendar.prototype = {
classID: calCompositeCalendarClassID,
QueryInterface: ChromeUtils.generateQI(calCompositeCalendarInterfaces),
classInfo: XPCOMUtils.generateCI({
classID: calCompositeCalendarClassID,
contractID: "@mozilla.org/calendar/calendar;1?type=composite",
classDescription: "Composite Calendar Provider",
interfaces: calCompositeCalendarInterfaces,
}),

//
// calICalendarProvider interface
@@ -55,7 +55,7 @@ calGoogleCalendar.prototype = {

classID: calGoogleCalendarClassID,
QueryInterface: cal.generateQI(calGoogleCalendarInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classDescription: "Google Calendar Provider",
contractID: "@mozilla.org/calendar/calendar;1?type=gdata",
classID: calGoogleCalendarClassID,
@@ -52,7 +52,7 @@ calICSCalendar.prototype = {
__proto__: cal.provider.BaseClass.prototype,
classID: calICSCalendarClassID,
QueryInterface: cal.generateQI(calICSCalendarInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calICSCalendarClassID,
contractID: "@mozilla.org/calendar/calendar;1?type=ics",
classDescription: "Calendar ICS provider",
@@ -28,7 +28,7 @@ calMemoryCalendar.prototype = {
__proto__: cal.provider.BaseClass.prototype,
classID: calMemoryCalendarClassID,
QueryInterface: cal.generateQI(calMemoryCalendarInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calMemoryCalendarClassID,
contractID: "@mozilla.org/calendar/calendar;1?type=memory",
classDescription: "Calendar Memory Provider",
@@ -39,7 +39,7 @@ calStorageCalendar.prototype = {
__proto__: cal.provider.BaseClass.prototype,
classID: calStorageCalendarClassID,
QueryInterface: cal.generateQI(calStorageCalendarInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calStorageCalendarClassID,
contractID: "@mozilla.org/calendar/calendar;1?type=storage",
classDescription: "Calendar Storage Provider",
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

/**
* The calendar provider class for WCAP calendars. Usually instanciated through
@@ -30,7 +29,7 @@ calWcapCalendar.prototype = {
__proto__: cal.provider.BaseClass.prototype,
classID: calWcapCalendarClassID,
QueryInterface: cal.generateQI(calWcapCalendarInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calWcapCalendarClassID,
contractID: "@mozilla.org/calendar/calendar;1?type=wcap",
classDescription: "Sun Java System Calendar Server WCAP Provider",
@@ -20,7 +20,6 @@
/* exported issueNetworkRequest, getWcapRequestStatusString, stringToIcal, stringToXml */

ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);

function generateRequestId() {
@@ -208,7 +207,7 @@ calWcapNetworkRequest.prototype = {

classID: calWcapNetworkRequestClassID,
QueryInterface: cal.generateQI(calWcapNetworkRequestInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calWcapNetworkRequestClassID,
contractID: "@mozilla.org/calendar/wcap/network-request;1",
classDescription: "Sun Java System Calendar Server WCAP Network Request",
@@ -6,7 +6,6 @@

ChromeUtils.import("resource://gre/modules/Preferences.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);

@@ -115,7 +114,7 @@ var calWcapSessionInterfaces = [
calWcapSession.prototype = {
classID: calWcapSessionClassID,
QueryInterface: cal.generateQI(calWcapSessionInterfaces),
classInfo: XPCOMUtils.generateCI({
classInfo: cal.generateCI({
classID: calWcapSessionClassID,
contractID: "@mozilla.org/calendar/wcap/session;1",
classDescription: "Sun Java System Calendar Server WCAP Session",

0 comments on commit 798e6c1

Please sign in to comment.