--- a/calendar/base/backend/icaljs/calRecurrenceRule.js
+++ b/calendar/base/backend/icaljs/calRecurrenceRule.js
@@ -29,17 +29,17 @@ calRecurrenceRule.prototype = {
innerObject: null,
isMutable: true,
makeImmutable() {
this.isMutable = false;
},
ensureMutable() {
if (!this.isMutable) {
- throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
+ throw Components.Exception("", Cr.NS_ERROR_OBJECT_IS_IMMUTABLE);
}
},
clone() {
return new calRecurrenceRule(new ICAL.Recur(this.innerObject));
},
isNegative: false, // We don't support EXRULE anymore
get isFinite() {
@@ -53,17 +53,17 @@ calRecurrenceRule.prototype = {
},
getOccurrences(aStartTime, aRangeStart, aRangeEnd, aMaxCount) {
aStartTime = unwrapSingle(ICAL.Time, aStartTime);
aRangeStart = unwrapSingle(ICAL.Time, aRangeStart);
aRangeEnd = unwrapSingle(ICAL.Time, aRangeEnd);
if (!aMaxCount && !aRangeEnd && this.count == 0 && this.until == null) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let occurrences = [];
let rangeStart = aRangeStart.clone();
rangeStart.isDate = false;
let dtend = null;
@@ -145,17 +145,17 @@ calRecurrenceRule.prototype = {
},
set interval(val) {
this.ensureMutable();
this.innerObject.interval = val;
},
get count() {
if (!this.isByCount) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return this.innerObject.count || -1;
},
set count(val) {
this.ensureMutable();
this.innerObject.count = val && val > 0 ? val : null;
},
--- a/calendar/base/content/calendar-base-view.js
+++ b/calendar/base/content/calendar-base-view.js
@@ -808,17 +808,17 @@
}
/**
* Delete items from a calendar. Must be implemented in subclasses.
*
* @param {calICalendar|calICompositeCalendar} calendar A calendar object.
*/
deleteItemsFromCalendar(calendar) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
/**
* Create and fire an event.
*
* @param {string} eventName Name of the event.
* @param {Object} eventDetail The details to add to the event.
*/
--- a/calendar/base/content/calendar-event-column.js
+++ b/calendar/base/content/calendar-event-column.js
@@ -1844,17 +1844,17 @@
}
}
firstColumn.fgboxes.startlabel.setAttribute("value", startstr);
lastColumn.fgboxes.endlabel.setAttribute("value", endstr);
}
setDayStartEndMinutes(dayStartMin, dayEndMin) {
if (dayStartMin < this.mStartMin || dayStartMin > dayEndMin || dayEndMin > this.mEndMin) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (this.mDayStartMin != dayStartMin || this.mDayEndMin != dayEndMin) {
this.mDayStartMin = dayStartMin;
this.mDayEndMin = dayEndMin;
}
}
getClickedDateTime(event) {
--- a/calendar/base/content/calendar-item-editing.js
+++ b/calendar/base/content/calendar-item-editing.js
@@ -619,17 +619,17 @@ function promptOccurrenceModification(aI
}
switch (type) {
case MODIFY_PARENT:
pastItems = items.map(item => item.parentItem);
break;
case MODIFY_FOLLOWING:
// TODO tbd in a different bug
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
case MODIFY_OCCURRENCE:
pastItems = items;
break;
case CANCEL:
// Since we have not set past or futureItem, the return below will
// take care.
break;
}
--- a/calendar/base/content/calendar-management.js
+++ b/calendar/base/content/calendar-management.js
@@ -675,27 +675,27 @@ function openCalendarSubscriptionsDialog
/**
* Calendar Offline Manager
*/
var calendarOfflineManager = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
init() {
if (this.initialized) {
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
Services.obs.addObserver(this, "network:offline-status-changed");
this.updateOfflineUI(!this.isOnline());
this.initialized = true;
},
uninit() {
if (!this.initialized) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
Services.obs.removeObserver(this, "network:offline-status-changed");
this.initialized = false;
},
isOnline() {
return !Services.io.offline;
},
--- a/calendar/base/content/calendar-month-base-view.js
+++ b/calendar/base/content/calendar-month-base-view.js
@@ -402,17 +402,17 @@ var { cal } = ChromeUtils.import("resour
}
}
if (this.mSelectedItems.length) {
this.mSelectedItems = [];
}
if (!this.mStartDate || !this.mEndDate) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
// Days that are not in the main month on display are displayed with
// a gray background. Unless the month actually starts on a Sunday,
// this means that mStartDate.month is 1 month less than the main month.
let mainMonth = this.mStartDate.month;
if (this.mStartDate.day != 1) {
mainMonth++;
--- a/calendar/base/content/calendar-month-view.js
+++ b/calendar/base/content/calendar-month-view.js
@@ -127,17 +127,17 @@
} else {
this.setAttribute("value", this.mDate.day);
}
return val;
}
setDate(aDate) {
if (!aDate) {
- throw Cr.NS_ERROR_NULL_POINTER;
+ throw Components.Exception("", Cr.NS_ERROR_NULL_POINTER);
}
// Remove all the old events.
this.mItemHash = {};
removeChildren(this.dayItems);
if (this.mDate && this.mDate.compare(aDate) == 0) {
return;
--- a/calendar/base/content/calendar-multiday-base-view.js
+++ b/calendar/base/content/calendar-multiday-base-view.js
@@ -79,17 +79,17 @@
* @param {number} dayEndHour Hour when the day will end.
*/
setDayStartEndHours(dayStartHour, dayEndHour) {
if (
dayStartHour * 60 < this.mStartMin ||
dayStartHour > dayEndHour ||
dayEndHour * 60 > this.mEndMin
) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (this.mDayStartHour != dayStartHour || this.mDayEndHour != dayEndHour) {
this.mDayEndHour = dayEndHour;
this.mDayStartHour = dayStartHour;
const topbox = this.querySelector(".topbox");
if (topbox.children.length) {
@@ -1639,17 +1639,17 @@
this.timebar.addEventListener(
"bindingattached",
() => this.setDayStartEndMinutes(dayStartMin, dayEndMin),
{ once: true }
);
return;
}
if (dayStartMin < this.mStartMin || dayStartMin > dayEndMin || dayEndMin > this.mEndMin) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (this.mDayStartMin != dayStartMin || this.mDayEndMin != dayEndMin) {
this.mDayStartMin = dayStartMin;
this.mDayEndMin = dayEndMin;
// Also update on the time-bar.
this.timebar.setDayStartEndHours(this.mDayStartMin / 60, this.mDayEndMin / 60);
}
@@ -1658,17 +1658,17 @@
/**
* Set how many minutes are visible in the view.
*
* @param {number} minutes A number of visible minutes.
* @return {number} A number of visible minutes.
*/
setVisibleMinutes(minutes) {
if (minutes <= 0 || minutes > this.mEndMin - this.mStartMin) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (this.mVisibleMinutes != minutes) {
this.mVisibleMinutes = minutes;
}
return this.mVisibleMinutes;
}
}
--- a/calendar/base/content/calendar-tabs.js
+++ b/calendar/base/content/calendar-tabs.js
@@ -202,17 +202,17 @@ var calendarItemTabType = {
// Generate and set the tab title.
let strName;
if (aTab.mode.type == "calendarEvent") {
strName = aArgs.calendarEvent.title ? "editEventDialog" : "newEventDialog";
} else if (aTab.mode.type == "calendarTask") {
strName = aArgs.calendarEvent.title ? "editTaskDialog" : "newTaskDialog";
} else {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
// name is "New Event", "Edit Task", etc.
let name = cal.l10n.getCalString(strName);
aTab.title = name + ": " + (aArgs.calendarEvent.title || name);
// allowTabClose prevents the tab from being closed until we ask
// the user if they want to save any unsaved changes.
aTab.allowTabClose = false;
--- a/calendar/base/content/widgets/calendar-alarm-widget.js
+++ b/calendar/base/content/widgets/calendar-alarm-widget.js
@@ -109,17 +109,17 @@
dateLabel.value = cal.l10n.getCalString("alarmStarts", [
formatter.formatDateTime(startDate),
]);
} else {
// If the task has no start date, then format the alarm date.
dateLabel.value = formatter.formatDateTime(this.mAlarm.alarmDate);
}
} else {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
// Relative Date
this.updateRelativeDateLabel();
// Title, Location
titleLabel.value = this.mItem.title || "";
locationDescription.value = this.mItem.getProperty("LOCATION") || "";
--- a/calendar/base/modules/calUtils.jsm
+++ b/calendar/base/modules/calUtils.jsm
@@ -615,11 +615,11 @@ function makeQI(aInterfaces) {
return this.classInfo;
}
for (let i = 0; i < aInterfaces.length; i++) {
if (Ci[aInterfaces[i]].equals(iid)) {
return this;
}
}
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
};
}
--- a/calendar/base/modules/utils/calDateTimeUtils.jsm
+++ b/calendar/base/modules/utils/calDateTimeUtils.jsm
@@ -112,30 +112,30 @@ var caldtz = {
* event's start date or a task's entry date.
*/
startDateProp(aItem) {
if (cal.item.isEvent(aItem)) {
return "startDate";
} else if (cal.item.isToDo(aItem)) {
return "entryDate";
}
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**
* Returns the property name used for the end date of an item, ie either an
* event's end date or a task's due date.
*/
endDateProp(aItem) {
if (cal.item.isEvent(aItem)) {
return "endDate";
} else if (cal.item.isToDo(aItem)) {
return "dueDate";
}
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**
* Check if the two dates are on the same day (ignoring time)
*
* @param date1 The left date to compare
* @param date2 The right date to compare
* @return True, if dates are on the same day
--- a/calendar/base/modules/utils/calItemUtils.jsm
+++ b/calendar/base/modules/utils/calItemUtils.jsm
@@ -608,17 +608,17 @@ var calitem = {
*
* @param aIcalComponent The ical component to set the prodid and
* version on.
*/
setStaticProps(aIcalComponent) {
// Throw for an invalid parameter
aIcalComponent = cal.wrapInstance(aIcalComponent, Ci.calIIcalComponent);
if (!aIcalComponent) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
// Set the prodid and version
aIcalComponent.prodid = calitem.productId;
aIcalComponent.version = calitem.productVersion;
},
/**
* Search for already open item dialog.
--- a/calendar/base/modules/utils/calProviderUtils.jsm
+++ b/calendar/base/modules/utils/calProviderUtils.jsm
@@ -403,17 +403,17 @@ var calprovider = {
}
// attribute AUTF8String id;
get id() {
return this.mID;
}
set id(aValue) {
if (this.mID) {
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
this.mID = aValue;
let calMgr = cal.getCalendarManager();
// make all properties persistent that have been set so far:
for (let aName in this.mProperties) {
if (!this.constructor.mTransientProperties[aName]) {
--- a/calendar/base/src/CalAlarm.jsm
+++ b/calendar/base/src/CalAlarm.jsm
@@ -39,17 +39,17 @@ CalAlarm.prototype = {
mRepeat: 0,
/**
* calIAlarm
*/
ensureMutable() {
if (this.mImmutable) {
- throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
+ throw Components.Exception("", Cr.NS_ERROR_OBJECT_IS_IMMUTABLE);
}
},
get isMutable() {
return !this.mImmutable;
},
makeImmutable() {
@@ -174,34 +174,34 @@ CalAlarm.prototype = {
return (this.mSummary = aValue);
},
get offset() {
return this.mOffset;
},
set offset(aValue) {
if (aValue && !(aValue instanceof Ci.calIDuration)) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (this.related != ALARM_RELATED_START && this.related != ALARM_RELATED_END) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
this.ensureMutable();
return (this.mOffset = aValue);
},
get alarmDate() {
return this.mAbsoluteDate;
},
set alarmDate(aValue) {
if (aValue && !(aValue instanceof Ci.calIDateTime)) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (this.related != ALARM_RELATED_ABSOLUTE) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
this.ensureMutable();
return (this.mAbsoluteDate = aValue);
},
get repeat() {
if ((this.mRepeat != 0) ^ (this.mDuration != null)) {
return 0;
@@ -210,32 +210,32 @@ CalAlarm.prototype = {
},
set repeat(aValue) {
this.ensureMutable();
if (aValue === null) {
this.mRepeat = null;
} else {
this.mRepeat = parseInt(aValue, 10);
if (isNaN(this.mRepeat)) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
}
return aValue;
},
get repeatOffset() {
if ((this.mRepeat != 0) ^ (this.mDuration != null)) {
return null;
}
return this.mDuration;
},
set repeatOffset(aValue) {
this.ensureMutable();
if (aValue !== null && !(aValue instanceof Ci.calIDuration)) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
return (this.mDuration = aValue);
},
get repeatDate() {
if (
this.related != ALARM_RELATED_ABSOLUTE ||
!this.mAbsoluteDate ||
@@ -372,17 +372,17 @@ CalAlarm.prototype = {
} else if (this.related != ALARM_RELATED_ABSOLUTE && this.mOffset) {
triggerProp.valueAsIcalString = this.mOffset.icalString;
if (this.related == ALARM_RELATED_END) {
// An alarm related to the end of the event.
triggerProp.setParameter("RELATED", "END");
}
} else {
// No offset or absolute date is not valid.
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
comp.addProperty(triggerProp);
// Set up repeat and duration (OPTIONAL, but if one exists, the other
// MUST also exist)
if (this.repeat && this.repeatOffset) {
let repeatProp = icssvc.createIcalProperty("REPEAT");
let durationProp = icssvc.createIcalProperty("DURATION");
@@ -463,52 +463,52 @@ CalAlarm.prototype = {
comp.addProperty(icalprop);
}
return comp;
},
set icalComponent(aComp) {
this.ensureMutable();
if (!aComp || aComp.componentType != "VALARM") {
// Invalid Component
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let actionProp = aComp.getFirstProperty("ACTION");
let triggerProp = aComp.getFirstProperty("TRIGGER");
let repeatProp = aComp.getFirstProperty("REPEAT");
let durationProp = aComp.getFirstProperty("DURATION");
let summaryProp = aComp.getFirstProperty("SUMMARY");
let descriptionProp = aComp.getFirstProperty("DESCRIPTION");
let lastAckProp = aComp.getFirstProperty("X-MOZ-LASTACK");
if (actionProp) {
this.action = actionProp.value;
} else {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (triggerProp) {
if (triggerProp.getParameter("VALUE") == "DATE-TIME") {
this.mAbsoluteDate = triggerProp.valueAsDatetime;
this.related = ALARM_RELATED_ABSOLUTE;
} else {
this.mOffset = cal.createDuration(triggerProp.valueAsIcalString);
let related = triggerProp.getParameter("RELATED");
this.related = related == "END" ? ALARM_RELATED_END : ALARM_RELATED_START;
}
} else {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (durationProp && repeatProp) {
this.repeatOffset = cal.createDuration(durationProp.valueAsIcalString);
this.repeat = repeatProp.value;
} else if (durationProp || repeatProp) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
} else {
this.repeatOffset = null;
this.repeat = 0;
}
// Set up attendees
this.clearAttendees();
for (let attendeeProp of cal.iterate.icalProperty(aComp, "ATTENDEE")) {
--- a/calendar/base/src/CalAttachment.jsm
+++ b/calendar/base/src/CalAttachment.jsm
@@ -123,17 +123,17 @@ CalAttachment.prototype = {
get icalString() {
let comp = this.icalProperty;
return comp ? comp.icalString : "";
},
set icalString(val) {
let prop = cal.getIcsService().createIcalPropertyFromString(val);
if (prop.propertyName != "ATTACH") {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
this.icalProperty = prop;
return val;
},
getParameter(aName) {
return this.mProperties.get(aName);
},
--- a/calendar/base/src/CalAttendee.jsm
+++ b/calendar/base/src/CalAttendee.jsm
@@ -20,17 +20,17 @@ CalAttendee.prototype = {
mImmutable: false,
get isMutable() {
return !this.mImmutable;
},
modify() {
if (this.mImmutable) {
- throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
+ throw Components.Exception("", Cr.NS_ERROR_OBJECT_IS_IMMUTABLE);
}
},
makeImmutable() {
this.mImmutable = true;
},
clone() {
@@ -98,17 +98,17 @@ CalAttendee.prototype = {
let icalatt;
if (this.mIsOrganizer) {
icalatt = icssvc.createIcalProperty("ORGANIZER");
} else {
icalatt = icssvc.createIcalProperty("ATTENDEE");
}
if (!this.id) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
icalatt.valueAsIcalString = this.id;
for (let i = 0; i < this.icalAttendeePropMap.length; i++) {
let prop = this.icalAttendeePropMap[i];
if (this[prop.cal]) {
try {
icalatt.setParameter(prop.ics, this[prop.cal]);
} catch (e) {
@@ -140,17 +140,17 @@ CalAttendee.prototype = {
get icalString() {
let comp = this.icalProperty;
return comp ? comp.icalString : "";
},
set icalString(val) {
let prop = cal.getIcsService().createIcalPropertyFromString(val);
if (prop.propertyName != "ORGANIZER" && prop.propertyName != "ATTENDEE") {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
this.icalProperty = prop;
return val;
},
get properties() {
return this.mProperties.entries();
},
--- a/calendar/base/src/CalEvent.jsm
+++ b/calendar/base/src/CalEvent.jsm
@@ -136,17 +136,17 @@ CalEvent.prototype = {
eventPromotedProps: null,
set icalComponent(event) {
this.modify();
if (event.componentType != "VEVENT") {
event = event.getFirstSubcomponent("VEVENT");
if (!event) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
}
this.mEndDate = undefined;
this.setItemBaseFromICS(event);
this.mapPropsFromICS(event, this.icsEventPropMap);
this.importUnpromotedProperties(event, this.eventPromotedProps);
--- a/calendar/base/src/CalItipItem.jsm
+++ b/calendar/base/src/CalItipItem.jsm
@@ -38,17 +38,17 @@ CalItipItem.prototype = {
},
set receivedMethod(aMethod) {
return (this.mReceivedMethod = aMethod.toUpperCase());
},
mResponseMethod: "REPLY",
get responseMethod() {
if (!this.mIsInitialized) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
return this.mResponseMethod;
},
set responseMethod(aMethod) {
return (this.mResponseMethod = aMethod.toUpperCase());
},
mAutoResponse: null,
@@ -177,17 +177,17 @@ CalItipItem.prototype = {
},
/**
* This returns both the array and the number of items. An easy way to
* call it is: let itemArray = itipItem.getItemList();
*/
getItemList() {
if (!this.mIsInitialized) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
return this.mItemList;
},
/**
* Note that this code forces the user to respond to all items in the same
* way, which is a current limitation of the spec.
*/
--- a/calendar/base/src/CalRecurrenceDate.jsm
+++ b/calendar/base/src/CalRecurrenceDate.jsm
@@ -28,17 +28,17 @@ CalRecurrenceDate.prototype = {
}),
makeImmutable() {
this.isMutable = false;
},
ensureMutable() {
if (!this.isMutable) {
- throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
+ throw Components.Exception("", Cr.NS_ERROR_OBJECT_IS_IMMUTABLE);
}
},
clone() {
let other = new CalRecurrenceDate();
other.mDate = this.mDate ? this.mDate.clone() : null;
other.mIsNegative = this.mIsNegative;
return other;
@@ -85,17 +85,17 @@ CalRecurrenceDate.prototype = {
get icalString() {
let comp = this.icalProperty;
return comp ? comp.icalString : "";
},
set icalString(val) {
let prop = cal.getIcsService().createIcalPropertyFromString(val);
let propName = prop.propertyName;
if (propName != "RDATE" && propName != "EXDATE") {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
this.icalProperty = prop;
return val;
},
get icalProperty() {
let prop = cal.getIcsService().createIcalProperty(this.mIsNegative ? "EXDATE" : "RDATE");
--- a/calendar/base/src/CalRecurrenceInfo.jsm
+++ b/calendar/base/src/CalRecurrenceInfo.jsm
@@ -35,22 +35,22 @@ CalRecurrenceInfo.prototype = {
mNegativeRules: null,
mExceptionMap: null,
/**
* Helpers
*/
ensureBaseItem() {
if (!this.mBaseItem) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
},
ensureMutable() {
if (this.mImmutable) {
- throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
+ throw Components.Exception("", Cr.NS_ERROR_OBJECT_IS_IMMUTABLE);
}
},
ensureSortedRecurrenceRules() {
if (!this.mPositiveRules || !this.mNegativeRules) {
this.mPositiveRules = [];
this.mNegativeRules = [];
for (let ritem of this.mRecurrenceItems) {
if (ritem.isNegative) {
@@ -186,17 +186,17 @@ CalRecurrenceInfo.prototype = {
return this.mRecurrenceItems.length;
},
getRecurrenceItemAt(aIndex) {
this.ensureBaseItem();
if (aIndex < 0 || aIndex >= this.mRecurrenceItems.length) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
return this.mRecurrenceItems[aIndex];
},
appendRecurrenceItem(aItem) {
this.ensureBaseItem();
this.ensureMutable();
@@ -210,17 +210,17 @@ CalRecurrenceInfo.prototype = {
}
},
deleteRecurrenceItemAt(aIndex) {
this.ensureBaseItem();
this.ensureMutable();
if (aIndex < 0 || aIndex >= this.mRecurrenceItems.length) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (this.mRecurrenceItems[aIndex].isNegative) {
this.mNegativeRules = null;
} else {
this.mPositiveRules = null;
}
@@ -236,27 +236,27 @@ CalRecurrenceInfo.prototype = {
);
sip1.data = aItem;
sip1.dataIID = Ci.calIRecurrenceItem;
let pos;
if ((pos = this.mRecurrenceItems.indexOf(sip1.data)) > -1) {
this.deleteRecurrenceItemAt(pos);
} else {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
},
insertRecurrenceItemAt(aItem, aIndex) {
this.ensureBaseItem();
this.ensureMutable();
this.ensureSortedRecurrenceRules();
if (aIndex < 0 || aIndex > this.mRecurrenceItems.length) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (aItem.isNegative) {
this.mNegativeRules.push(aItem);
} else {
this.mPositiveRules.push(aItem);
}
@@ -643,17 +643,17 @@ CalRecurrenceInfo.prototype = {
let rdate = cal.wrapInstance(this.mRecurrenceItems[i], Ci.calIRecurrenceDate);
if (rdate) {
if (rdate.isNegative && rdate.date.compare(aRecurrenceId) == 0) {
return this.deleteRecurrenceItemAt(i);
}
}
}
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
},
//
// exceptions
//
//
// Some notes:
@@ -688,22 +688,22 @@ CalRecurrenceInfo.prototype = {
anItem = cal.unwrapInstance(anItem);
if (
anItem.parentItem.calendar != this.mBaseItem.calendar &&
anItem.parentItem.id != this.mBaseItem.id
) {
cal.ERROR("recurrenceInfo::addException: item parentItem != this.mBaseItem (calendar/id)!");
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (anItem.recurrenceId == null) {
cal.ERROR("recurrenceInfo::addException: item with null recurrenceId!");
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let itemtoadd;
if (aTakeOverOwnership && anItem.isMutable) {
itemtoadd = anItem;
itemtoadd.parentItem = this.mBaseItem;
} else {
itemtoadd = anItem.cloneShallow(this.mBaseItem);
--- a/calendar/base/src/CalRelation.jsm
+++ b/calendar/base/src/CalRelation.jsm
@@ -88,17 +88,17 @@ CalRelation.prototype = {
get icalString() {
let comp = this.icalProperty;
return comp ? comp.icalString : "";
},
set icalString(val) {
let prop = cal.getIcsService().createIcalPropertyFromString(val);
if (prop.propertyName != "RELATED-TO") {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
this.icalProperty = prop;
return val;
},
getParameter(aName) {
return this.mProperties.get(aName);
},
--- a/calendar/base/src/CalTimezoneService.jsm
+++ b/calendar/base/src/CalTimezoneService.jsm
@@ -23,17 +23,17 @@ calStringEnumerator.prototype = {
[Symbol.iterator]() {
return this.mStringArray.values();
},
hasMore() {
return this.mIndex < this.mStringArray.length;
},
getNext() {
if (!this.hasMore()) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
return this.mStringArray[this.mIndex++];
},
};
function CalTimezoneService() {
this.wrappedJSObject = this;
--- a/calendar/base/src/CalTodo.jsm
+++ b/calendar/base/src/CalTodo.jsm
@@ -172,17 +172,17 @@ CalTodo.prototype = {
todoPromotedProps: null,
set icalComponent(todo) {
this.modify();
if (todo.componentType != "VTODO") {
todo = todo.getFirstSubcomponent("VTODO");
if (!todo) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
}
this.mDueDate = undefined;
this.setItemBaseFromICS(todo);
this.mapPropsFromICS(todo, this.icsEventPropMap);
this.importUnpromotedProperties(todo, this.todoPromotedProps);
--- a/calendar/base/src/calCachedCalendar.js
+++ b/calendar/base/src/calCachedCalendar.js
@@ -132,17 +132,17 @@ calCachedCalendar.prototype = {
/* eslint-disable mozilla/use-chromeutils-generateqi */
QueryInterface(aIID) {
if (aIID.equals(Ci.calISchedulingSupport) && this.mUncachedCalendar.QueryInterface(aIID)) {
// check whether uncached calendar supports it:
return this;
} else if (aIID.equals(Ci.calICalendar) || aIID.equals(Ci.nsISupports)) {
return this;
}
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
/* eslint-enable mozilla/use-chromeutils-generateqi */
mCachedCalendar: null,
mCachedObserver: null,
mUncachedCalendar: null,
mObservers: null,
mSuperCalendar: null,
--- a/calendar/base/src/calItemBase.js
+++ b/calendar/base/src/calItemBase.js
@@ -123,17 +123,17 @@ calItemBase.prototype = {
},
// attribute calIItemBase parentItem;
get parentItem() {
return this.mParentItem || this;
},
set parentItem(value) {
if (this.mImmutable) {
- throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
+ throw Components.Exception("", Cr.NS_ERROR_OBJECT_IS_IMMUTABLE);
}
return (this.mParentItem = cal.unwrapInstance(value));
},
/**
* Initializes the base item to be an item proxy. Used by inheriting
* objects createProxy() method.
*
@@ -165,17 +165,17 @@ calItemBase.prototype = {
/**
* This function should be called by all members that modify the item. It
* checks if the item is immutable and throws accordingly, and sets the
* mDirty property.
*/
modify() {
if (this.mImmutable) {
- throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
+ throw Components.Exception("", Cr.NS_ERROR_OBJECT_IS_IMMUTABLE);
}
this.mDirty = true;
},
/**
* Makes sure the item is not dirty. If the item is dirty, properties like
* LAST-MODIFIED and DTSTAMP are set to now.
*/
@@ -659,17 +659,17 @@ calItemBase.prototype = {
get calendar() {
if (!this.mCalendar && this.parentItem != this) {
return this.parentItem.calendar;
}
return this.mCalendar;
},
set calendar(calendar) {
if (this.mImmutable) {
- throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
+ throw Components.Exception("", Cr.NS_ERROR_OBJECT_IS_IMMUTABLE);
}
this.mHashId = null; // recompute hashId
this.mCalendar = calendar;
},
// attribute calIAttendee organizer;
get organizer() {
if (this.mIsProxy && this.mOrganizer === undefined) {
@@ -696,20 +696,20 @@ calItemBase.prototype = {
// void setCategories(in Array<AString> aCategories);
setCategories(aCategories) {
this.modify();
this.mCategories = aCategories.concat([]);
},
// attribute AUTF8String icalString;
get icalString() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
set icalString(str) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
/**
* The map of promoted properties is a list of those properties that are
* represented directly by getters/setters.
* All of these property names must be in upper case isPropertyPromoted to
* function correctly. The has/get/set/deleteProperty interfaces
* are case-insensitive, but these are not.
@@ -914,20 +914,20 @@ calItemBase.prototype = {
// boolean isPropertyPromoted(in AString name);
isPropertyPromoted(name) {
return this.itemBasePromotedProps[name.toUpperCase()];
},
// attribute calIIcalComponent icalComponent;
get icalComponent() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
set icalComponent(val) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
// attribute PRUint32 generation;
get generation() {
let gen = this.getProperty("X-MOZ-GENERATION");
return gen ? parseInt(gen, 10) : 0;
},
set generation(aValue) {
@@ -1009,17 +1009,17 @@ calItemBase.prototype = {
* errors.
*/
addAlarm(aAlarm, aDoNotValidate) {
if (!aDoNotValidate) {
try {
// Trigger the icalComponent getter to make sure the alarm is valid.
aAlarm.icalComponent; // eslint-disable-line no-unused-expressions
} catch (e) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
}
this.modify();
this.mAlarms = this.getAlarms();
this.mAlarms.push(aAlarm);
},
--- a/calendar/itip/CalItipEmailTransport.jsm
+++ b/calendar/itip/CalItipEmailTransport.jsm
@@ -43,17 +43,17 @@ CalItipEmailTransport.prototype = {
let items = this._prepareItems(aItipItem);
if (items === false) {
return false;
}
return this._sendXpcomMail(aRecipients, items.subject, items.body, aItipItem);
}
// sending xpcom mail is not available if no identity has been set
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
},
_prepareItems(aItipItem) {
let item = aItipItem.getItemList()[0];
// Get ourselves some default text - when we handle organizer properly
// We'll need a way to configure the Common Name attribute and we should
// use it here rather than the email address
--- a/calendar/lightning/components/CalItipProtocolHandler.jsm
+++ b/calendar/lightning/components/CalItipProtocolHandler.jsm
@@ -6,17 +6,17 @@ var EXPORTED_SYMBOLS = ["ItipChannel", "
var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
var ITIP_HANDLER_MIMETYPE = "application/x-itip-internal";
var ITIP_HANDLER_PROTOCOL = "moz-cal-handle-itip";
var NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001;
function NYI() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
function ItipChannel(URI, aLoadInfo) {
this.wrappedJSObject = this;
this.URI = this.originalURI = URI;
this.loadInfo = aLoadInfo;
}
ItipChannel.prototype = {
--- a/calendar/lightning/content/lightning-item-iframe.js
+++ b/calendar/lightning/content/lightning-item-iframe.js
@@ -1742,17 +1742,17 @@ function untilDateCompensation(aItem) {
*/
function updateTitle() {
let strName;
if (cal.item.isEvent(window.calendarItem)) {
strName = window.mode == "new" ? "newEventDialog" : "editEventDialog";
} else if (cal.item.isToDo(window.calendarItem)) {
strName = window.mode == "new" ? "newTaskDialog" : "editTaskDialog";
} else {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
let newTitle = cal.l10n.getCalString(strName) + ": " + getElementValue("item-title");
sendMessage({ command: "updateTitle", argument: newTitle });
}
/**
* Update the disabled status of the accept button. The button is enabled if all
* parts of the dialog have options selected that make sense.
--- a/calendar/providers/caldav/CalDavCalendar.jsm
+++ b/calendar/providers/caldav/CalDavCalendar.jsm
@@ -137,21 +137,21 @@ CalDavCalendar.prototype = {
return null;
},
get displayName() {
return cal.l10n.getCalString("caldavName");
},
createCalendar() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
deleteCalendar(_cal, listener) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
// calIChangeLog interface
get offlineStorage() {
return this.mOfflineStorage;
},
set offlineStorage(storage) {
--- a/calendar/providers/caldav/modules/CalDavRequest.jsm
+++ b/calendar/providers/caldav/modules/CalDavRequest.jsm
@@ -249,17 +249,17 @@ class CalDavResponseBase {
this.completed = new Promise((resolve, reject) => {
this._oncompleted = resolve;
this._oncompleteerror = reject;
});
}
/** The listener passed to the channel's asyncOpen */
get listener() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
/** @return {nsIURI} The request URI **/
get uri() {
return this.nsirequest.URI;
}
/** @return {Boolean} True, if the request was redirected */
@@ -324,17 +324,17 @@ class CalDavResponseBase {
throw new HttpNotFoundError(this);
} else if (this.serverError) {
throw new HttpServerError(this);
}
}
/** The text response of the request */
get text() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
/** @return {DOMDocument} A DOM document with the response xml */
get xml() {
if (this.text && !this._responseXml) {
try {
this._responseXml = cal.xml.parseString(this.text);
} catch (e) {
--- a/calendar/providers/composite/CalCompositeCalendar.jsm
+++ b/calendar/providers/composite/CalCompositeCalendar.jsm
@@ -94,22 +94,22 @@ CalCompositeCalendar.prototype = {
get prefChromeOverlay() {
return null;
},
get displayName() {
return cal.l10n.getCalString("compositeName");
},
createCalendar() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
deleteCalendar(calendar, listener) {
// You shouldn't be able to delete from the composite calendar.
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
//
// calICompositeCalendar interface
//
mCalendars: null,
mDefaultCalendar: null,
@@ -227,56 +227,56 @@ CalCompositeCalendar.prototype = {
// calICalendar interface
//
// Write operations here are forwarded to either the item's
// parent calendar, or to the default calendar if one is set.
// Get operations are sent to each calendar.
//
get id() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
set id(id) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
get superCalendar() {
// There shouldn't be a superCalendar for the composite
return this;
},
set superCalendar(val) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
// this could, at some point, return some kind of URI identifying
// all the child calendars, thus letting us create nifty calendar
// trees.
get uri() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
set uri(val) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
get readOnly() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
set readOnly(bool) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
get canRefresh() {
return true;
},
get name() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
set name(val) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
get type() {
return "composite";
},
getProperty(aName) {
return this.mDefaultCalendar.getProperty(aName);
--- a/calendar/providers/ics/CalICSCalendar.jsm
+++ b/calendar/providers/ics/CalICSCalendar.jsm
@@ -76,21 +76,21 @@ CalICSCalendar.prototype = {
return null;
},
get displayName() {
return cal.l10n.getCalString("icsName");
},
createCalendar() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
deleteCalendar(_cal, listener) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
//
// calICalendar interface
//
get type() {
return "ics";
},
@@ -287,17 +287,17 @@ CalICSCalendar.prototype = {
parser.parseString(str, null, listener);
},
writeICS() {
cal.LOG("[calICSCalendar] Commencing write of ICS Calendar " + this.name);
this.lock();
try {
if (!this.mUri) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
// makeBackup will call doWriteICS
this.makeBackup(this.doWriteICS);
} catch (exc) {
this.unlock(calIErrors.MODIFICATION_FAILED);
throw exc;
}
},
@@ -1057,17 +1057,17 @@ httpHooks.prototype = {
// nsIProgressEventSink
onProgress(aRequest, aProgress, aProgressMax) {},
onStatus(aRequest, aStatus, aStatusArg) {},
getInterface(aIid) {
if (aIid.equals(Ci.nsIProgressEventSink)) {
return this;
}
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
};
function fileHooks(calendar) {
this.mCalendar = calendar;
}
fileHooks.prototype = {
--- a/calendar/providers/memory/CalMemoryCalendar.jsm
+++ b/calendar/providers/memory/CalMemoryCalendar.jsm
@@ -50,17 +50,17 @@ CalMemoryCalendar.prototype = {
return null;
},
get displayName() {
return cal.l10n.getCalString("memoryName");
},
createCalendar() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
deleteCalendar(calendar, listener) {
calendar = calendar.wrappedJSObject;
calendar.mItems = {};
calendar.mMetaData = new Map();
try {
@@ -169,17 +169,17 @@ CalMemoryCalendar.prototype = {
},
// void modifyItem( in calIItemBase aNewItem, in calIItemBase aOldItem, in calIOperationListener aListener );
modifyItem(aNewItem, aOldItem, aListener) {
if (this.readOnly) {
throw Ci.calIErrors.CAL_IS_READONLY;
}
if (!aNewItem) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let self = this;
function reportError(errStr, errId) {
self.notifyOperationComplete(
aListener,
errId ? errId : Cr.NS_ERROR_FAILURE,
Ci.calIOperationListener.MODIFY,
--- a/calendar/providers/storage/CalStorageCalendar.jsm
+++ b/calendar/providers/storage/CalStorageCalendar.jsm
@@ -58,17 +58,17 @@ CalStorageCalendar.prototype = {
return null;
},
get displayName() {
return cal.l10n.getCalString("storageName");
},
createCalendar() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
async deleteCalendar(aCalendar, listener) {
let stmts = [];
aCalendar = aCalendar.wrappedJSObject;
if (this.mDeleteEventExtras) {
for (let stmt of this.mDeleteEventExtras) {
@@ -144,17 +144,17 @@ CalStorageCalendar.prototype = {
// attribute nsIURI uri;
get uri() {
return this.__proto__.__proto__.__lookupGetter__("uri").call(this);
},
set uri(aUri) {
// We can only load once
if (this.uri) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
let uri = this.__proto__.__proto__.__lookupSetter__("uri").call(this, aUri);
if (!this.mDB && this.uri && this.id) {
// Prepare the database as soon as we have an id and an uri.
this.prepareInitDB();
}
@@ -393,17 +393,17 @@ CalStorageCalendar.prototype = {
Ci.calIErrors.CAL_IS_READONLY,
Ci.calIOperationListener.MODIFY,
null,
"Calendar is readonly"
);
return null;
}
if (!aNewItem) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let self = this;
function reportError(errStr, errId) {
self.notifyOperationComplete(
aListener,
errId ? errId : Cr.NS_ERROR_FAILURE,
Ci.calIOperationListener.MODIFY,
@@ -1955,17 +1955,17 @@ CalStorageCalendar.prototype = {
"Error getting extra properties for item '" + item.title + "' (" + item.id + ")!",
e
);
}
}
if (flags & CAL_ITEM_FLAG.HAS_RECURRENCE) {
if (item.recurrenceId) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
let recInfo = cal.createRecurrenceInfo(item);
item.recurrenceInfo = recInfo;
try {
this.prepareStatement(this.mSelectRecurrenceForItem);
this.mSelectRecurrenceForItem.params.item_id = item.id;
@@ -1981,17 +1981,17 @@ CalStorageCalendar.prototype = {
}
}
if (flags & CAL_ITEM_FLAG.HAS_EXCEPTIONS) {
// it's safe that we don't run into this branch again for exceptions
// (getAdditionalDataForItem->get[Event|Todo]FromRow->getAdditionalDataForItem):
// every excepton has a recurrenceId and isn't flagged as CAL_ITEM_FLAG.HAS_EXCEPTIONS
if (item.recurrenceId) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
let rec = item.recurrenceInfo;
if (cal.item.isEvent(item)) {
this.mSelectEventExceptions.params.id = item.id;
this.prepareStatement(this.mSelectEventExceptions);
try {
@@ -2015,17 +2015,17 @@ CalStorageCalendar.prototype = {
});
} catch (e) {
this.logError(
"Error getting exceptions for task '" + item.title + "' (" + item.id + ")!",
e
);
}
} else {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
}
if (flags & CAL_ITEM_FLAG.HAS_ATTACHMENTS) {
let selectAttachment = this.mSelectAttachmentsForItem;
if (item.recurrenceId != null) {
selectAttachment = this.mSelectAttachmentsForItemWithRecurrenceId;
this.setDateParamHelper(selectAttachment, "recurrence_id", item.recurrenceId);
@@ -2201,17 +2201,17 @@ CalStorageCalendar.prototype = {
flags |= this.prepareRelations(stmts, item, olditem);
flags |= this.prepareAlarms(stmts, item, olditem);
if (cal.item.isEvent(item)) {
this.prepareEvent(stmts, item, olditem, flags);
} else if (cal.item.isToDo(item)) {
this.prepareTodo(stmts, item, olditem, flags);
} else {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
},
prepareEvent(stmts, item, olditem, flags) {
let array = this.prepareAsyncStatement(stmts, this.mInsertEvent);
let params = this.prepareAsyncParams(array);
this.setupItemBaseParams(item, olditem, params);
@@ -2359,17 +2359,17 @@ CalStorageCalendar.prototype = {
flags |= CAL_ITEM_FLAG.HAS_EXCEPTIONS;
// we need to serialize each exid as a separate
// event/todo; setupItemBase will handle
// writing the recurrenceId for us
for (let exid of exceptions) {
let ex = rec.getExceptionFor(exid);
if (!ex) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
this.prepareItem(stmts, ex, null);
}
}
} else if (item.recurrenceId && item.recurrenceId.isDate) {
flags |= CAL_ITEM_FLAG.RECURRENCE_ID_ALLDAY;
}
--- a/calendar/resources/content/publish.js
+++ b/calendar/resources/content/publish.js
@@ -201,17 +201,17 @@ function publishItemArray(aItemArray, aP
var notificationCallbacks = {
// nsIInterfaceRequestor interface
getInterface(iid, instance) {
if (iid.equals(Ci.nsIAuthPrompt)) {
// use the window watcher service to get a nsIAuthPrompt impl
return Services.ww.getNewAuthPrompter(null);
}
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
};
/**
* Listener object to pass to `channel.asyncOpen()`. A reference to the current dialog window
* passed to the constructor provides access to the dialog once the request is done.
* @implements {nsIStreamListener}
*/
--- a/chat/components/src/imAccounts.jsm
+++ b/chat/components/src/imAccounts.jsm
@@ -114,20 +114,20 @@ UnknownProtocol.prototype = {
getUsernameSplit() {
return EmptyEnumerator;
},
get usernameEmptyText() {
return "";
},
getAccount(aKey, aName) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
accountExists() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
// false seems an acceptable default for all options
// (they should never be called anyway).
get uniqueChatName() {
return false;
},
get chatHasTopic() {
@@ -170,17 +170,17 @@ function UnknownAccountBuddy(aAccount, a
}
UnknownAccountBuddy.prototype = GenericAccountBuddyPrototype;
// aName and aPrplId are provided as parameter only if this is a new
// account that doesn't exist in the preferences. In this case, these
// 2 values should be stored.
function imAccount(aKey, aName, aPrplId) {
if (!aKey.startsWith(kAccountKeyPrefix)) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
this.id = aKey;
this.numericId = parseInt(aKey.substr(kAccountKeyPrefix.length));
gAccountsService._keepAccount(this);
this.prefBranch = Services.prefs.getBranch(kPrefAccountPrefix + aKey + ".");
if (aName) {
@@ -360,17 +360,17 @@ imAccount.prototype = {
// disconnecting, it was not reconnected automatically at that point,
// so we must do it now. (This happens for protocols like IRC where
// disconnection is not immediate.)
this._sendNotification(aTopic, aData);
this.connect();
return;
}
} else {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
this._sendNotification(aTopic, aData);
},
_debugMessages: null,
_omittedDebugMessages: 0,
_debugMessagesBeforeError: null,
_omittedDebugMessagesBeforeError: 0,
@@ -792,21 +792,21 @@ imAccount.prototype = {
delete this.protocol;
delete this.prplAccount;
},
get _ensurePrplAccount() {
if (this.prplAccount) {
return this.prplAccount;
}
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
connect() {
if (!this.prplAccount) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
if (this._passwordRequired) {
// If the previous connection attempt failed because we have a wrong password,
// clear the passwor cache so that if there's no password in the password
// manager the user gets prompted again.
if (
this.connectionErrorReason ==
@@ -903,17 +903,17 @@ imAccount.prototype = {
clearTimeout(this._reconnectTimer);
delete this._reconnectTimer;
}
delete this.reconnectAttempt;
delete this.timeOfNextReconnect;
},
cancelReconnection() {
if (!this.disconnected) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
// Ensure we don't keep a status observer that could re-enable the
// auto-reconnect timers.
this.disconnect();
this._cancelReconnection();
},
@@ -1013,17 +1013,17 @@ AccountsService.prototype = {
gConvertingOldPasswords = Services.prefs.getBoolPref(
kPrefConvertOldPasswords
);
let accountList = this._accountList;
for (let account of accountList ? accountList.split(",") : []) {
try {
account.trim();
if (!account) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
new imAccount(account);
} catch (e) {
Cu.reportError(e);
dump(e + " " + e.toSource() + "\n");
}
}
// If the user has canceled a master password prompt, we haven't
@@ -1205,17 +1205,17 @@ AccountsService.prototype = {
for (let account of this._accounts) {
account._checkIfPasswordStillMissing();
}
delete this._checkingIfPasswordStillMissing;
},
getAccountById(aAccountId) {
if (!aAccountId.startsWith(kAccountKeyPrefix)) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let id = parseInt(aAccountId.substr(kAccountKeyPrefix.length));
return this.getAccountByNumericId(id);
},
_keepAccount(aAccount) {
this._accounts.push(aAccount);
@@ -1227,21 +1227,21 @@ AccountsService.prototype = {
getAccounts() {
return new nsSimpleEnumerator(this._accounts);
},
createAccount(aName, aPrpl) {
// Ensure an account with the same name and protocol doesn't already exist.
let prpl = Services.core.getProtocolById(aPrpl);
if (!prpl) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
if (prpl.accountExists(aName)) {
Cu.reportError("Attempted to create a duplicate account!");
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
/* First get a unique id for the new account. */
let id;
for (id = 1; ; ++id) {
if (this._accountsById.hasOwnProperty(id)) {
continue;
}
@@ -1269,22 +1269,22 @@ AccountsService.prototype = {
Services.obs.notifyObservers(account, "account-added");
return account;
},
deleteAccount(aAccountId) {
let account = this.getAccountById(aAccountId);
if (!account) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let index = this._accounts.indexOf(account);
if (index == -1) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
let id = account.numericId;
account.remove();
this._accounts.splice(index, 1);
delete this._accountsById[id];
Services.obs.notifyObservers(account, "account-removed");
--- a/chat/components/src/imCommands.jsm
+++ b/chat/components/src/imCommands.jsm
@@ -23,17 +23,17 @@ CommandsService.prototype = {
this.registerCommand({
name: "say",
get helpString() {
return _("sayHelpString");
},
usageContext: Ci.imICommand.CMD_CONTEXT_ALL,
priority: Ci.imICommand.CMD_PRIORITY_HIGH,
run(aMsg, aConv) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
});
this.registerCommand({
name: "raw",
get helpString() {
return _("rawHelpString");
},
@@ -137,17 +137,17 @@ CommandsService.prototype = {
},
unInitCommands() {
delete this._commands;
},
registerCommand(aCommand, aPrplId) {
let name = aCommand.name;
if (!name) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (!this._commands.hasOwnProperty(name)) {
this._commands[name] = {};
}
this._commands[name][aPrplId || ""] = aCommand;
},
unregisterCommand(aCommandName, aPrplId) {
@@ -253,17 +253,17 @@ CommandsService.prototype = {
cmdArray = matches;
}
// Sort the matching commands by priority before returning the array.
return cmdArray.sort((a, b) => b.priority - a.priority);
},
executeCommand(aMessage, aConversation, aReturnedConv) {
if (!aMessage) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let matchResult;
if (
aMessage[0] != "/" ||
!(matchResult = /^\/([a-z0-9]+)(?: |$)([\s\S]*)/.exec(aMessage))
) {
return false;
--- a/chat/components/src/imContacts.jsm
+++ b/chat/components/src/imContacts.jsm
@@ -22,17 +22,17 @@ function executeAsyncThenFinalize(statem
function getDBConnection() {
const NS_APP_USER_PROFILE_50_DIR = "ProfD";
let dbFile = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR, Ci.nsIFile);
dbFile.append("blist.sqlite");
let conn = Services.storage.openDatabase(dbFile);
if (!conn.connectionReady) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
// Grow blist db in 512KB increments.
try {
conn.setGrowthIncrement(512 * 1024, "");
} catch (e) {
if (e.result == Cr.NS_ERROR_FILE_TOO_BIG) {
Services.console.logStringMessage(
@@ -376,17 +376,17 @@ var otherContactsTag = {
// imITag implementation
get id() {
return -1;
},
get name() {
return "__others__";
},
set name(aNewName) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
},
getContacts() {
return Object.keys(this._contacts).map(id => this._contacts[id]);
},
_addContact(aContact) {
this._contacts[aContact.id] = aContact;
this.notifyObservers(aContact, "contact-moved-in");
for (let observer of ContactsById[aContact.id]._observers) {
@@ -663,17 +663,17 @@ Contact.prototype = {
get _empty() {
return this._buddies.length == 0 || this._buddies.every(b => b._empty);
},
mergeContact(aContact) {
// Avoid merging the contact with itself or merging into an
// already removed contact.
if (aContact.id == this.id || !(this.id in ContactsById)) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
this._ensureNotDummy();
let contact = ContactsById[aContact.id]; // remove XPConnect wrapper
// Copy all the contact-only tags first, otherwise they would be lost.
for (let tag of contact.getTags()) {
if (!contact._isTagInherited(tag)) {
@@ -712,17 +712,17 @@ Contact.prototype = {
Math.min(oldPosition, newPosition),
Math.max(oldPosition, newPosition)
);
buddy._notifyObservers("position-changed", String(newPosition));
this._updatePreferredBuddy(buddy);
},
adoptBuddy(aBuddy) {
if (aBuddy.contact.id == this.id) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
let buddy = BuddiesById[aBuddy.id]; // remove XPConnect wrapper
buddy.contact = this;
this._updatePreferredBuddy(buddy);
},
_massRemove: false,
_removeBuddy(aBuddy) {
@@ -791,20 +791,20 @@ Contact.prototype = {
}
statement.finalize();
},
detachBuddy(aBuddy) {
// Should return a new contact with the same list of tags.
let buddy = BuddiesById[aBuddy.id];
if (buddy.contact.id != this.id) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (buddy.contact._buddies.length == 1) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
// Save the list of tags, it may be destoyed if the buddy was the last one.
let tags = buddy.contact.getTags();
// Create a new dummy contact and use it for the detached buddy.
buddy.contact = new Contact();
buddy.contact._notifyObservers("added");
@@ -1100,17 +1100,17 @@ Buddy.prototype = {
},
_srvAlias: "",
_contact: null,
get contact() {
return this._contact;
},
set contact(aContact) /* not in imIBuddy */ {
if (aContact.id == this._contact.id) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
this._notifyObservers("moved-out-of-contact");
this._contact._removeBuddy(this);
this._contact = aContact;
this._contact._buddies.push(this);
@@ -1738,17 +1738,17 @@ ContactsService.prototype = {
if (statement.executeStep()) {
if (
statement.getUTF8String(0) == aUserName &&
statement.getUTF8String(1) == aPrplId
) {
// The account is already stored correctly.
return;
}
- throw Cr.NS_ERROR_UNEXPECTED; // Corrupted database?!?
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED); // Corrupted database?!?
}
} finally {
statement.finalize();
}
// Actually store the account.
statement = DBConn.createStatement(
"INSERT INTO accounts (id, name, prpl) " +
--- a/chat/components/src/imCore.jsm
+++ b/chat/components/src/imCore.jsm
@@ -104,17 +104,17 @@ UserStatus.prototype = {
this._idleService.removeIdleObserver(this, this._timeBeforeIdle);
}
this._timeBeforeIdle = timeBeforeIdle;
if (this._timeBeforeIdle) {
this._idleService.addIdleObserver(this, this._timeBeforeIdle);
}
}
} else {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
} else if (aTopic == NS_IOSERVICE_GOING_OFFLINE_TOPIC) {
this.offline = true;
} else if (
aTopic == NS_IOSERVICE_OFFLINE_STATUS_TOPIC &&
aData == "online"
) {
this.offline = false;
@@ -319,17 +319,17 @@ CoreService.prototype = {
},
observe(aObject, aTopic, aData) {
if (aTopic == kQuitApplicationGranted) {
this.quit();
}
},
quit() {
if (!this._initialized) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
Services.obs.removeObserver(this, kQuitApplicationGranted);
Services.obs.notifyObservers(this, "prpl-quit");
Services.conversations.unInitConversations();
Services.accounts.unInitAccounts();
Services.contacts.unInitContacts();
@@ -338,17 +338,17 @@ CoreService.prototype = {
this.globalUserStatus.unInit();
delete this.globalUserStatus;
delete this._protos;
delete this._initialized;
},
getProtocols() {
if (!this._initialized) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
let protocols = [];
for (let entry of categoryManager.enumerateCategory(
kProtocolPluginCategory
)) {
let id = entry.data;
@@ -368,17 +368,17 @@ CoreService.prototype = {
protocols.push(proto);
}
}
return new nsSimpleEnumerator(protocols);
},
getProtocolById(aPrplId) {
if (!this._initialized) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
if (this._protos.hasOwnProperty(aPrplId)) {
return this._protos[aPrplId];
}
let cid;
try {
--- a/chat/modules/imXPCOMUtils.jsm
+++ b/chat/modules/imXPCOMUtils.jsm
@@ -210,17 +210,17 @@ ClassInfo.prototype = {
if (
iid.equals(Ci.nsISupports) ||
iid.equals(Ci.nsIClassInfo) ||
this._interfaces.some(i => i.equals(iid))
) {
return this;
}
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
get interfaces() {
return [Ci.nsIClassInfo, Ci.nsISupports].concat(this._interfaces);
},
getScriptableHelper: () => null,
contractID: null,
classID: null,
flags: 0,
@@ -257,27 +257,27 @@ function nsSimpleEnumerator(items) {
this._nextIndex = 0;
}
nsSimpleEnumerator.prototype = {
hasMoreElements() {
return this._nextIndex < this._items.length;
},
getNext() {
if (!this.hasMoreElements()) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
return this._items[this._nextIndex++];
},
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
[Symbol.iterator]() {
return this._items.values();
},
};
var EmptyEnumerator = {
hasMoreElements: () => false,
getNext() {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
*[Symbol.iterator]() {},
};
--- a/chat/modules/jsProtoHelper.jsm
+++ b/chat/modules/jsProtoHelper.jsm
@@ -38,32 +38,32 @@ var GenericAccountPrototype = {
},
_init(aProtocol, aImAccount) {
this.protocol = aProtocol;
this.imAccount = aImAccount;
initLogModule(aProtocol.id, this);
},
observe(aSubject, aTopic, aData) {},
remove() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
unInit() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
connect() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
disconnect() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
createConversation(aName) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
joinChat(aComponents) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
setBool(aName, aVal) {},
setInt(aName, aVal) {},
setString(aName, aVal) {},
get name() {
return this.imAccount.name;
},
@@ -272,20 +272,20 @@ var GenericAccountPrototype = {
for (let field in parsedDefaultChatName) {
defaultFieldValues[field] = parsedDefaultChatName[field];
}
}
return new ChatRoomFieldValues(defaultFieldValues);
},
requestRoomInfo(aCallback) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
getRoomInfo(aName) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
get isRoomInfoStale() {
return false;
},
getPref(aName, aType) {
return this.prefs.prefHasUserValue(aName)
? this.prefs["get" + aType + "Pref"](aName)
@@ -382,17 +382,17 @@ var GenericAccountBuddyPrototype = {
delete this._buddy;
},
get account() {
return this._account.imAccount;
},
set buddy(aBuddy) {
if (this._buddy) {
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
this._buddy = aBuddy;
},
get buddy() {
return this._buddy;
},
get tag() {
return this._tag;
@@ -520,17 +520,17 @@ var GenericAccountBuddyPrototype = {
},
get canSendMessage() {
return this.online;
},
getTooltipInfo: () => EmptyEnumerator,
createConversation() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};
// aUserName is required only if aBuddy is null, i.e., we are adding a buddy.
function AccountBuddy(aAccount, aBuddy, aTag, aUserName) {
this._init(aAccount, aBuddy, aTag, aUserName);
}
AccountBuddy.prototype = GenericAccountBuddyPrototype;
@@ -634,17 +634,17 @@ var GenericConversationPrototype = {
},
_id: 0,
get id() {
return this._id;
},
set id(aId) {
if (this._id) {
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
this._id = aId;
},
addObserver(aObserver) {
if (!this._observers.includes(aObserver)) {
this._observers.push(aObserver);
}
@@ -669,17 +669,17 @@ var GenericConversationPrototype = {
"Preparing:\n" +
aImMessage.message +
"\nDisplaying:\n" +
aImMessage.displayMessage
);
}
},
sendMsg(aMsg) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
sendTyping: aString => Ci.prplIConversation.NO_TYPING_LIMIT,
close() {
Services.obs.notifyObservers(this, "closing-conversation");
Services.conversations.removeConversation(this);
},
unInit() {
@@ -1134,17 +1134,17 @@ var GenericProtocolPrototype = {
get normalizedName() {
return this.name.replace(/[^a-z0-9]/gi, "").toLowerCase();
},
get iconBaseURI() {
return "chrome://chat/skin/prpl-generic/";
},
getAccount(aImAccount) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
_getOptionDefault(aName) {
if (this.options && this.options.hasOwnProperty(aName)) {
return this.options[aName].default;
}
throw new Error(aName + " has no default value in " + this.id + ".");
},
--- a/chat/modules/socket.jsm
+++ b/chat/modules/socket.jsm
@@ -151,17 +151,17 @@ var Socket = {
aOriginHost,
aOriginPort,
aSecurity,
aProxy,
aHost = aOriginHost,
aPort = aOriginPort
) {
if (Services.io.offline) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
// This won't work for Linux due to bug 758848.
Services.obs.addObserver(this, "wake_notification");
this.LOG("Connecting to: " + aHost + ":" + aPort);
this.originHost = aOriginHost;
this.originPort = aOriginPort;
--- a/chat/protocols/irc/irc.jsm
+++ b/chat/protocols/irc/irc.jsm
@@ -1200,17 +1200,17 @@ ircAccount.prototype = {
// provided through the callback (prplIRoomInfoCallback instance).
requestRoomInfo(aCallback, aIsUserRequest) {
// Ignore the automaticList pref if the user explicitly requests /list.
if (
!aIsUserRequest &&
!Services.prefs.getBoolPref("chat.irc.automaticList")
) {
// Pretend we can't return roomInfo.
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
if (this._roomInfoCallbacks.has(aCallback)) {
// Callback is not new.
return;
}
// Send a LIST request if the channel list is stale and a current request
// has not been sent.
if (this.isRoomInfoStale && !this._pendingList) {
--- a/chat/protocols/matrix/matrix.jsm
+++ b/chat/protocols/matrix/matrix.jsm
@@ -445,17 +445,17 @@ MatrixAccount.prototype = {
conv.joining = false;
conv.left = true;
// TODO Perhaps we should call createRoom if the room doesn't exist.
});
return conv;
},
createConversation(aName) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
requestBuddyInfo(aUserId) {
let user = this._client.getUser(aUserId);
if (!user) {
Services.obs.notifyObservers(
EmptyEnumerator,
"user-info-received",
--- a/chat/protocols/twitter/twitter.jsm
+++ b/chat/protocols/twitter/twitter.jsm
@@ -438,17 +438,17 @@ TimelineConversation.prototype = {
},
this
);
},
sendMsg(aMsg) {
let parsed = twttr.txt.parseTweet(aMsg);
if (!parsed.valid) {
this.systemMessage(_("error.tooLong"), true);
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
this._account.tweet(
aMsg,
this.inReplyToStatusId,
this.onSentCallback.bind(this, aMsg),
function(aException, aData) {
let error = this._parseError(aData);
this.systemMessage(_("error.general", error, aMsg), true);
--- a/common/src/viewZoomOverlay.js
+++ b/common/src/viewZoomOverlay.js
@@ -48,17 +48,17 @@ var ZoomManager = {
set zoom(aVal) {
this.setZoomForBrowser(getBrowser(), aVal);
return aVal;
},
setZoomForBrowser(aBrowser, aVal) {
if (aVal < this.MIN || aVal > this.MAX) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
if (this.useFullZoom || aBrowser.isSyntheticDocument) {
aBrowser.textZoom = 1;
aBrowser.fullZoom = aVal;
} else {
aBrowser.textZoom = aVal;
aBrowser.fullZoom = 1;
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -1795,39 +1795,39 @@ function IsSupportedTextMimeType(aMimeTy
return false;
}
/* eslint-disable complexity */
// throws an error or returns true if user attempted save; false if user canceled save
async function SaveDocument(aSaveAs, aSaveCopy, aMimeType) {
var editor = GetCurrentEditor();
if (!aMimeType || !editor) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
var editorDoc = editor.document;
if (!editorDoc) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
// if we don't have the right editor type bail (we handle text and html)
var editorType = GetCurrentEditorType();
if (!["text", "html", "htmlmail", "textmail"].includes(editorType)) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
var saveAsTextFile = IsSupportedTextMimeType(aMimeType);
// check if the file is to be saved is a format we don't understand; if so, bail
if (
aMimeType != kHTMLMimeType &&
aMimeType != kXHTMLMimeType &&
!saveAsTextFile
) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
if (saveAsTextFile) {
aMimeType = "text/plain";
}
var urlstring = GetDocumentUrl();
var mustShowFileDialog =
--- a/ldap/xpcom/src/LDAPProtocolHandler.jsm
+++ b/ldap/xpcom/src/LDAPProtocolHandler.jsm
@@ -23,17 +23,17 @@ function makeProtocolHandler(aCID, aProt
var channel = Cc["@mozilla.org/network/ldap-channel;1"].createInstance(
Ci.nsIChannel
);
channel.init(aURI);
channel.loadInfo = aLoadInfo;
return channel;
}
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
allowPort(port, scheme) {
return port == aDefaultPort;
},
};
}
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -721,17 +721,17 @@ nsBrowserAccess.prototype = {
aOpener,
aWhere,
aFlags,
aTriggeringPrincipal = null,
aCsp = null
) {
if (!aURI) {
Cu.reportError("openURI should only be called with a valid URI");
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return this.getContentWindowOrOpenURI(
aURI,
aOpener,
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp,
--- a/mail/base/modules/MailMigrator.jsm
+++ b/mail/base/modules/MailMigrator.jsm
@@ -771,17 +771,17 @@ var MailMigrator = {
* are renamed with the extension ".mab.bak" to avoid confusion.
*/
async _migrateAddressBooks() {
async function migrateBook(fileName, notFoundThrows = true) {
let oldFile = profileDir.clone();
oldFile.append(`${fileName}.mab`);
if (!oldFile.exists()) {
if (notFoundThrows) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
return;
}
console.log(`Creating new ${fileName}.sqlite`);
let newBook = new AddrBookDirectory();
newBook.init(`jsaddrbook://${fileName}.sqlite`);
--- a/mail/base/test/unit/test_alertHook.js
+++ b/mail/base/test/unit/test_alertHook.js
@@ -39,17 +39,17 @@ var mockAlertsService = {
var gMsgWindow = {};
var mailnewsURL = {
get msgWindow() {
if (gMsgWindow) {
return gMsgWindow;
}
- throw Cr.NS_ERROR_INVALID_POINTER;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_POINTER);
},
};
function run_test() {
// First register the mock alerts service
let uuid = MockFactory.register(
"@mozilla.org/alerts-service;1",
mockAlertsService
--- a/mail/components/AboutRedirector.jsm
+++ b/mail/components/AboutRedirector.jsm
@@ -57,25 +57,25 @@ AboutRedirector.prototype = {
// Strip out the first ? or #, and anything following it
let name = /[^?#]+/.exec(aURI.pathQueryRef)[0];
return name.toLowerCase();
},
getURIFlags(aURI) {
let name = this._getModuleName(aURI);
if (!(name in this._redirMap)) {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
return this._redirMap[name].flags;
},
newChannel(aURI, aLoadInfo) {
let name = this._getModuleName(aURI);
if (!(name in this._redirMap)) {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
let newURI = Services.io.newURI(this._redirMap[name].url);
let channel = Services.io.newChannelFromURIWithLoadInfo(newURI, aLoadInfo);
channel.originalURI = aURI;
if (
this._redirMap[name].flags &
--- a/mail/components/MessengerContentHandler.jsm
+++ b/mail/components/MessengerContentHandler.jsm
@@ -53,31 +53,31 @@ function handleIndexerResult(aFile) {
"resource:///modules/SearchIntegration.jsm"
);
let msgHdr = SearchIntegration.handleResult(aFile);
// If we found a message header, open it, otherwise throw an exception
if (msgHdr) {
MailUtils.displayMessage(msgHdr);
} else {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
}
function mayOpenURI(uri) {
var ext = Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(
Ci.nsIExternalProtocolService
);
return ext.isExposedProtocol(uri.scheme);
}
function openURI(uri) {
if (!mayOpenURI(uri)) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
var channel = Services.io.newChannelFromURI(
uri,
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
@@ -132,17 +132,17 @@ function openURI(uri) {
if (iid.equals(Ci.nsIURIContentListener)) {
return this;
}
if (iid.equals(Ci.nsILoadGroup)) {
return loadgroup;
}
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
},
};
loader.openURI(channel, true, listener);
}
function MailDefaultHandler() {}
MailDefaultHandler.prototype = {
@@ -156,17 +156,17 @@ MailDefaultHandler.prototype = {
/* eslint-disable complexity */
handle(cmdLine) {
var uri;
try {
var remoteCommand = cmdLine.handleFlagWithParam("remote", true);
} catch (e) {
- throw Cr.NS_ERROR_ABORT;
+ throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
if (remoteCommand != null) {
try {
var a = /^\s*(\w+)\(([^\)]*)\)\s*$/.exec(remoteCommand);
var remoteVerb = a[1].toLowerCase();
var remoteParams = a[2].split(",");
@@ -215,33 +215,33 @@ MailDefaultHandler.prototype = {
"chrome://messenger/content/messengercompose/messengercompose.xhtml",
"_blank",
"chrome,dialog=no,all",
argstring
);
break;
}
default:
- throw Cr.NS_ERROR_ABORT;
+ throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
break;
default:
// Somebody sent us a remote command we don't know how to process:
// just abort.
- throw Cr.NS_ERROR_ABORT;
+ throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
cmdLine.preventDefault = true;
} catch (e) {
// If we had a -remote flag but failed to process it, throw
// NS_ERROR_ABORT so that the xremote code knows to return a failure
// back to the handling code.
dump(e);
- throw Cr.NS_ERROR_ABORT;
+ throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
}
var chromeParam = cmdLine.handleFlagWithParam("chrome", false);
if (chromeParam) {
try {
let argstring = Cc["@mozilla.org/supports-string;1"].createInstance(
Ci.nsISupportsString
@@ -513,17 +513,17 @@ MailDefaultHandler.prototype = {
}
if (actionFlagIdx && osintFlagIdx > -1) {
var param = cmdLine.getArgument(actionFlagIdx + 1);
if (
cmdLine.length != actionFlagIdx + 2 ||
/thunderbird.url.(mailto|news):/.test(param)
) {
- throw Cr.NS_ERROR_ABORT;
+ throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
cmdLine.handleFlag("osint", false);
}
},
openInExternal(uri) {
Cc["@mozilla.org/uriloader/external-protocol-service;1"]
.getService(Ci.nsIExternalProtocolService)
@@ -532,46 +532,46 @@ MailDefaultHandler.prototype = {
handleContent(aContentType, aWindowContext, aRequest) {
try {
if (
!Cc["@mozilla.org/webnavigation-info;1"]
.getService(Ci.nsIWebNavigationInfo)
.isTypeSupported(aContentType, null)
) {
- throw Cr.NS_ERROR_WONT_HANDLE_CONTENT;
+ throw Components.Exception("", Cr.NS_ERROR_WONT_HANDLE_CONTENT);
}
} catch (e) {
- throw Cr.NS_ERROR_WONT_HANDLE_CONTENT;
+ throw Components.Exception("", Cr.NS_ERROR_WONT_HANDLE_CONTENT);
}
aRequest.QueryInterface(Ci.nsIChannel);
// For internal protocols (e.g. imap, mailbox, mailto), we want to handle
// them internally as we know what to do. For http and https we don't
// actually deal with external windows very well, so we redirect them to
// the external browser.
if (!aRequest.URI.schemeIs("http") && !aRequest.URI.schemeIs("https")) {
- throw Cr.NS_ERROR_WONT_HANDLE_CONTENT;
+ throw Components.Exception("", Cr.NS_ERROR_WONT_HANDLE_CONTENT);
}
this.openInExternal(aRequest.URI);
aRequest.cancel(Cr.NS_BINDING_ABORTED);
},
helpInfo:
" -options Open the options dialog.\n" +
" -file Open the specified email file.\n" +
" -setDefaultMail Set this app as the default mail client.\n",
/* nsIFactory */
createInstance(outer, iid) {
if (outer != null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},
lockFactory(lock) {
/* no-op */
},
--- a/mail/components/activity/Activity.jsm
+++ b/mail/components/activity/Activity.jsm
@@ -92,59 +92,59 @@ ActivityProcess.prototype = {
!(
val == Ci.nsIActivityProcess.STATE_COMPLETED ||
val == Ci.nsIActivityProcess.STATE_CANCELED ||
val == Ci.nsIActivityProcess.STATE_WAITINGFORRETRY ||
val == Ci.nsIActivityProcess.STATE_WAITINGFORINPUT ||
val == Ci.nsIActivityProcess.STATE_PAUSED
)
) {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
// we cannot change the state after the activity is completed,
// or it is canceled.
if (
this._state == Ci.nsIActivityProcess.STATE_COMPLETED ||
this._state == Ci.nsIActivityProcess.STATE_CANCELED
) {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
if (
this._state == Ci.nsIActivityProcess.STATE_PAUSED &&
!(
val == Ci.nsIActivityProcess.STATE_COMPLETED ||
val == Ci.nsIActivityProcess.STATE_INPROGRESS ||
val == Ci.nsIActivityProcess.STATE_WAITINGFORRETRY ||
val == Ci.nsIActivityProcess.STATE_WAITINGFORINPUT ||
val == Ci.nsIActivityProcess.STATE_CANCELED
)
) {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
if (
this._state == Ci.nsIActivityProcess.STATE_WAITINGFORINPUT &&
!(
val == Ci.nsIActivityProcess.STATE_INPROGRESS ||
val == Ci.nsIActivityProcess.STATE_CANCELED
)
) {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
if (
this._state == Ci.nsIActivityProcess.STATE_WAITINGFORRETRY &&
!(
val == Ci.nsIActivityProcess.STATE_INPROGRESS ||
val == Ci.nsIActivityProcess.STATE_CANCELED
)
) {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
let oldState = this._state;
this._state = val;
// let the listeners know about the change
this.log.debug("Notifying onStateChanged listeners");
for (let value of this._listeners) {
--- a/mail/components/activity/ActivityManager.jsm
+++ b/mail/components/activity/ActivityManager.jsm
@@ -79,17 +79,17 @@ ActivityManager.prototype = {
removeActivity(aID) {
let activity = this.getActivity(aID);
// make sure that the activity is not in-progress state
if (
activity instanceof Ci.nsIActivityProcess &&
activity.state == Ci.nsIActivityProcess.STATE_INPROGRESS
) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
// remove the activity
this._activities.delete(aID);
// notify all the listeners
for (let value of this._listeners) {
try {
@@ -119,17 +119,17 @@ ActivityManager.prototype = {
} else {
this.removeActivity(id);
}
}
},
getActivity(aID) {
if (!this._activities.has(aID)) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
return this._activities.get(aID);
},
containsActivity(aID) {
return this._activities.has(aID);
},
--- a/mail/components/compose/content/ComposerCommands.js
+++ b/mail/components/compose/content/ComposerCommands.js
@@ -1591,39 +1591,39 @@ function IsSupportedTextMimeType(aMimeTy
return false;
}
/* eslint-disable complexity */
// throws an error or returns true if user attempted save; false if user canceled save
async function SaveDocument(aSaveAs, aSaveCopy, aMimeType) {
var editor = GetCurrentEditor();
if (!aMimeType || !editor) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
var editorDoc = editor.document;
if (!editorDoc) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
// if we don't have the right editor type bail (we handle text and html)
var editorType = GetCurrentEditorType();
if (!["text", "html", "htmlmail", "textmail"].includes(editorType)) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
var saveAsTextFile = IsSupportedTextMimeType(aMimeType);
// check if the file is to be saved is a format we don't understand; if so, bail
if (
aMimeType != kHTMLMimeType &&
aMimeType != kXHTMLMimeType &&
!saveAsTextFile
) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
if (saveAsTextFile) {
aMimeType = "text/plain";
}
var urlstring = GetDocumentUrl();
var mustShowFileDialog =
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -4112,23 +4112,23 @@ function SetComposeDetails(newValues) {
"msgSubject"
).value = newValues.subject;
SetComposeWindowTitle();
}
if (
typeof newValues.body == "string" &&
typeof newValues.plainTextBody == "string"
) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
let editor = GetCurrentEditor();
if (typeof newValues.body == "string") {
if (!IsHTMLEditor()) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
editor.rebuildDocumentFromSource(newValues.body);
gMsgCompose.bodyModified = true;
}
if (typeof newValues.plainTextBody == "string") {
editor.selectAll();
editor.insertText(newValues.plainTextBody);
gMsgCompose.bodyModified = true;
@@ -4415,17 +4415,17 @@ function CompleteGenericSendMessage(msgT
// compose-send-message event for listeners, so they can do
// any pre-security work before sending.
var event = document.createEvent("UIEvents");
event.initEvent("compose-send-message", false, true);
var msgcomposeWindow = document.getElementById("msgcomposeWindow");
msgcomposeWindow.setAttribute("msgtype", msgType);
msgcomposeWindow.dispatchEvent(event);
if (event.defaultPrevented) {
- throw Cr.NS_ERROR_ABORT;
+ throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
gAutoSaving = msgType == Ci.nsIMsgCompDeliverMode.AutoSaveAsDraft;
// disable the ui if we're not auto-saving
if (!gAutoSaving) {
ToggleWindowLock(true);
} else {
--- a/mail/components/extensions/parent/ext-cloudFile.js
+++ b/mail/components/extensions/parent/ext-cloudFile.js
@@ -176,24 +176,24 @@ class CloudFileAccount {
try {
if (this._uploads.has(uploadId)) {
results = await this.extension.emit("deleteFile", this, {
id: uploadId,
});
}
this._uploads.delete(uploadId);
} catch (ex) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
if (!results || results.length == 0) {
console.error(
`Missing cloudFile.onFileDeleted listener for ${this.extension.id}`
);
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
}
}
function convertCloudFileAccount(nativeAccount) {
return {
id: nativeAccount.accountKey,
name: nativeAccount.displayName,
--- a/mail/components/preferences/general.js
+++ b/mail/components/preferences/general.js
@@ -2709,17 +2709,17 @@ class InternalHandlerInfoWrapper extends
// Override store so we so we can notify any code listening for registration
// or unregistration of this handler.
store() {
super.store();
Services.obs.notifyObservers(null, this._handlerChanged);
}
get enabled() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
get description() {
return gGeneralPane._prefsBundle.getString(this._appPrefLabel);
}
}
function addTagCallback(aName, aColor) {
--- a/mail/extensions/openpgp/content/modules/core.jsm
+++ b/mail/extensions/openpgp/content/modules/core.jsm
@@ -296,17 +296,17 @@ function failureOn(ex, status) {
getEnigmailLog().ERROR(
"core.jsm: Enigmail.initialize: Error - " +
status.initializationError +
"\n"
);
getEnigmailLog().DEBUG(
"core.jsm: Enigmail.initialize: exception=" + ex.toString() + "\n"
);
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
function getEnvironment(status) {
try {
return Cc["@mozilla.org/process/environment;1"].getService(nsIEnvironment);
} catch (ex) {
failureOn(ex, status);
}
@@ -492,17 +492,17 @@ class Factory {
constructor(component) {
this.component = component;
this.register();
Object.freeze(this);
}
createInstance(outer, iid) {
if (outer) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new this.component();
}
register() {
Cm.registerFactory(
this.component.prototype.classID,
this.component.prototype.classDescription,
--- a/mail/extensions/openpgp/content/modules/files.jsm
+++ b/mail/extensions/openpgp/content/modules/files.jsm
@@ -142,17 +142,17 @@ var EnigmailFiles = {
localFile = Cc[NS_FILE_CONTRACTID].createInstance(Ci.nsIFile);
EnigmailFiles.initPath(localFile, filePath);
} else {
localFile = filePath.QueryInterface(Ci.nsIFile);
}
if (localFile.exists()) {
if (localFile.isDirectory() || !localFile.isWritable()) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
if (!permissions) {
permissions = localFile.permissions;
}
}
if (!permissions) {
@@ -408,17 +408,17 @@ var EnigmailFiles = {
try {
const fileOutStream = EnigmailFiles.createFileStream(
filePath,
permissions
);
if (data.length) {
if (fileOutStream.write(data, data.length) != data.length) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
fileOutStream.flush();
}
fileOutStream.close();
} catch (ex) {
lazyLog().ERROR(
"files.jsm: writeFileContents: Failed to write to " + filePath + "\n"
--- a/mail/extensions/openpgp/content/modules/funcs.jsm
+++ b/mail/extensions/openpgp/content/modules/funcs.jsm
@@ -51,17 +51,17 @@ var EnigmailFuncs = {
while ((qStart = mailAddrs.indexOf('"')) >= 0) {
qEnd = mailAddrs.indexOf('"', qStart + 1);
if (qEnd < 0) {
EnigmailLog.ERROR(
"funcs.jsm: stripEmail: Unmatched quote in mail address: '" +
mailAddresses +
"'\n"
);
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
mailAddrs =
mailAddrs.substring(0, qStart) + mailAddrs.substring(qEnd + 1);
}
// replace any ";" by ","; remove leading/trailing ","
mailAddrs = mailAddrs
@@ -75,17 +75,17 @@ var EnigmailFuncs = {
// having two <..> <..> in one email, or things like <a@b.c,><d@e.f> is an error
if (mailAddrs.search(MatchAddr) < 0) {
EnigmailLog.ERROR(
"funcs.jsm: stripEmail: Invalid <..> brackets in mail address: '" +
mailAddresses +
"'\n"
);
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
// We know that the "," and the < > are at the right places, thus we can split by ","
let addrList = mailAddrs.split(/,/);
for (let i in addrList) {
// Extract pure e-mail address list (strip out anything before angle brackets and any whitespace)
addrList[i] = addrList[i]
--- a/mail/extensions/openpgp/content/modules/keyserver.jsm
+++ b/mail/extensions/openpgp/content/modules/keyserver.jsm
@@ -96,17 +96,17 @@ function createError(errId) {
* @param keyserver: String - name of keyserver with optional protocol and port.
* E.g. keys.gnupg.net, hkps://keys.gnupg.net:443
*
* @return Object: {port, host, protocol} (all Strings)
*/
function parseKeyserverUrl(keyserver) {
if (keyserver.length > 1024) {
// insane length of keyserver is forbidden
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
keyserver = keyserver.toLowerCase().trim();
let protocol = "";
if (keyserver.search(/^[a-zA-Z0-9_.-]+:\/\//) === 0) {
protocol = keyserver.replace(/^([a-zA-Z0-9_.-]+)(:\/\/.*)/, "$1");
keyserver = keyserver.replace(/^[a-zA-Z0-9_.-]+:\/\//, "");
} else {
@@ -191,17 +191,17 @@ const accessHkpInternal = {
let method = "GET";
let protocol;
switch (keySrv.protocol) {
case "hkp":
protocol = "http";
break;
case "ldap":
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
default:
// equals to hkps
protocol = "https";
}
let url = protocol + "://" + keySrv.host + ":" + keySrv.port;
if (actionFlag === EnigmailConstants.UPLOAD_KEY) {
@@ -652,17 +652,17 @@ const accessKeyBase = {
/**
* return the URL and the HTTP access method for a given action
*/
createRequestUrl(actionFlag, searchTerm) {
let url = "https://keybase.io/_/api/1.0/user/";
if (actionFlag === EnigmailConstants.UPLOAD_KEY) {
// not supported
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
} else if (
actionFlag === EnigmailConstants.DOWNLOAD_KEY ||
actionFlag === EnigmailConstants.DOWNLOAD_KEY_NO_IMPORT
) {
if (searchTerm.indexOf("0x") === 0) {
searchTerm = searchTerm.substr(0, 40);
}
url +=
@@ -915,17 +915,17 @@ const accessKeyBase = {
retObj.errorDetails = ex.errorDetails;
throw retObj;
}
return retObj;
},
upload() {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
},
refresh(keyServer, listener = null) {
EnigmailLog.DEBUG(`keyserver.jsm: accessKeyBase: refresh()\n`);
let keyList = EnigmailKeyRing.getAllKeys()
.keyList.map(keyObj => {
return "0x" + keyObj.fpr;
})
--- a/mail/extensions/openpgp/content/modules/mimeEncrypt.jsm
+++ b/mail/extensions/openpgp/content/modules/mimeEncrypt.jsm
@@ -176,32 +176,32 @@ PgpMimeEncrypt.prototype = {
isDraft
) {
EnigmailLog.DEBUG("mimeEncrypt.js: beginCryptoEncapsulation\n");
if (this.checkSMime && !this.smimeCompose) {
LOCAL_DEBUG(
"mimeEncrypt.js: beginCryptoEncapsulation: ERROR MsgComposeSecure not instantiated\n"
);
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
if (this.useSmime) {
return this.smimeCompose.beginCryptoEncapsulation(
outStream,
recipientList,
msgCompFields,
msgIdentity,
sendReport,
isDraft
);
}
if (!outStream) {
- throw Cr.NS_ERROR_NULL_POINTER;
+ throw Components.Exception("", Cr.NS_ERROR_NULL_POINTER);
}
try {
this.outStream = outStream;
this.isDraft = isDraft;
this.msgCompFields = msgCompFields;
this.outStringStream = Cc[
@@ -223,17 +223,17 @@ PgpMimeEncrypt.prototype = {
if (this.sendFlags & EnigmailConstants.SEND_ENCRYPTED) {
// applies to encrypted and signed & encrypted
this.cryptoMode = MIME_ENCRYPTED;
} else if (this.sendFlags & EnigmailConstants.SEND_SIGNED) {
this.cryptoMode = MIME_SIGNED;
this.hashAlgorithm = "SHA256"; // TODO: coordinate with RNP.jsm
}
} else {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
this.cryptoBoundary = EnigmailMime.createBoundary();
this.startCryptoHeaders();
} catch (ex) {
console.debug(ex);
EnigmailLog.writeException("mimeEncrypt.js", ex);
throw ex;
@@ -467,17 +467,17 @@ PgpMimeEncrypt.prototype = {
this.writeOut("\r\n--" + this.cryptoBoundary + "--\r\n");
},
finishCryptoEncapsulation(abort, sendReport) {
EnigmailLog.DEBUG("mimeEncrypt.js: finishCryptoEncapsulation\n");
if (this.checkSMime && !this.smimeCompose) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
if (this.useSmime) {
this.smimeCompose.finishCryptoEncapsulation(abort, sendReport);
return;
}
if ((this.sendFlags & EnigmailConstants.SEND_VERBATIM) !== 0) {
@@ -555,17 +555,17 @@ PgpMimeEncrypt.prototype = {
},
mimeCryptoWriteBlock(buffer, length) {
if (gDebugLogLevel > 4) {
LOCAL_DEBUG("mimeEncrypt.js: mimeCryptoWriteBlock: " + length + "\n");
}
if (this.checkSMime && !this.smimeCompose) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
if (this.useSmime) {
return this.smimeCompose.mimeCryptoWriteBlock(buffer, length);
}
try {
let line = buffer.substr(0, length);
--- a/mail/extensions/openpgp/content/modules/pgpmimeHandler.jsm
+++ b/mail/extensions/openpgp/content/modules/pgpmimeHandler.jsm
@@ -269,17 +269,17 @@ class Factory {
constructor(component) {
this.component = component;
this.register();
Object.freeze(this);
}
createInstance(outer, iid) {
if (outer) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new this.component();
}
register() {
Cm.registerFactory(
this.component.prototype.classID,
this.component.prototype.classDescription,
--- a/mail/extensions/openpgp/content/modules/protocolHandler.jsm
+++ b/mail/extensions/openpgp/content/modules/protocolHandler.jsm
@@ -131,17 +131,17 @@ EnigmailProtocolHandler.prototype = {
var messageId = EnigmailData.extractMessageId(aURI.spec);
var mimeMessageId = EnigmailData.extractMimeMessageId(aURI.spec);
var contentType, contentCharset, contentData;
if (messageId) {
// Handle enigmail:message/...
if (!EC.getEnigmailService()) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
if (EnigmailURIs.getMessageURI(messageId)) {
var messageUriObj = EnigmailURIs.getMessageURI(messageId);
contentType = messageUriObj.contentType;
contentCharset = messageUriObj.contentCharset;
contentData = messageUriObj.contentData;
@@ -217,17 +217,17 @@ EnigmailProtocolHandler.prototype = {
recentWin.focus();
} else {
var appShellSvc = Services.appShell;
var domWin = appShellSvc.hiddenDOMWindow;
domWin.open(spec, "_blank", "chrome,menubar,toolbar,resizable");
}
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
},
handleMimeMessage(messageId) {
// EnigmailLog.DEBUG("protocolHandler.jsm: EnigmailProtocolHandler.handleMimeMessage: messageURL="+messageUriObj.originalUrl+", content length="+contentData.length+", "+contentType+", "+contentCharset+"\n");
EnigmailLog.DEBUG(
"protocolHandler.jsm: EnigmailProtocolHandler.handleMimeMessage: messageURL=, content length=, , \n"
);
},
--- a/mail/extensions/openpgp/content/ui/enigmailCommon.js
+++ b/mail/extensions/openpgp/content/ui/enigmailCommon.js
@@ -213,17 +213,17 @@ function EnigReadURLContents(url, maxByt
url +
", " +
maxBytes +
"\n"
);
var ioServ = enigGetService(ENIG_IOSERVICE_CONTRACTID, "nsIIOService");
if (!ioServ) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
var fileChannel = EnigmailStreams.createChannel(url);
var rawInStream = fileChannel.open();
var inStream = Cc[ENIG_BINARYINPUTSTREAM_CONTRACTID].createInstance(
Ci.nsIBinaryInputStream
@@ -248,22 +248,22 @@ function EnigReadFileContents(localFile,
"enigmailCommon.js: EnigReadFileContents: file=" +
localFile.leafName +
", " +
maxBytes +
"\n"
);
if (!localFile.exists() || !localFile.isReadable()) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
var ioServ = enigGetService(ENIG_IOSERVICE_CONTRACTID, "nsIIOService");
if (!ioServ) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
var fileURI = ioServ.newFileURI(localFile);
return EnigReadURLContents(fileURI.asciiSpec, maxBytes);
}
///////////////////////////////////////////////////////////////////////////////
--- a/mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js
+++ b/mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js
@@ -2142,17 +2142,17 @@ Enigmail.msg = {
},
createEnigmailSecurityFields(oldSecurityInfo) {
let newSecurityInfo = EnigmailMimeEncrypt.createMimeEncrypt(
Enigmail.msg.getSecurityParams()
);
if (!newSecurityInfo) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
Enigmail.msg.setSecurityParams(newSecurityInfo);
},
/*
sendSmimeEncrypted: function(msgSendType, sendFlags, isOffline) {
let recList;
--- a/mail/test/browser/notification/browser_notification.js
+++ b/mail/test/browser/notification/browser_notification.js
@@ -52,17 +52,17 @@ var gMockAlertsService = {
cookie,
alertListener,
name
) {
// Setting the _doFail flag allows us to revert to the newmailalert.xhtml
// notification
if (this._doFail) {
SimpleTest.expectUncaughtException(true);
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
this._didNotify = true;
this._imageUrl = imageUrl;
this._title = title;
this._text = text;
this._textClickable = textClickable;
this._cookie = cookie;
this._alertListener = alertListener;
@@ -95,21 +95,21 @@ var gMockAlertsService = {
this._alertListener = null;
this._name = null;
},
};
var gMockAlertsServiceFactory = {
createInstance(aOuter, aIID) {
if (aOuter != null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
if (!aIID.equals(Ci.nsIAlertsService)) {
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
return gMockAlertsService;
},
};
add_task(function setupModule(module) {
// Register the mock alerts service
--- a/mail/test/browser/shared-modules/AttachmentHelpers.jsm
+++ b/mail/test/browser/shared-modules/AttachmentHelpers.jsm
@@ -33,17 +33,17 @@ var gMockFilePicker = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIFilePicker]),
defaultExtension: "",
filterIndex: null,
displayDirectory: null,
returnFiles: [],
addToRecentDocs: false,
get defaultString() {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
},
get fileURL() {
return null;
},
get file() {
if (this.returnFiles.length >= 1) {
--- a/mail/test/browser/shared-modules/CloudfileHelpers.jsm
+++ b/mail/test/browser/shared-modules/CloudfileHelpers.jsm
@@ -86,17 +86,17 @@ MockCloudfileAccount.prototype = {
});
},
urlForFile(aFile) {
return `http://www.example.com/${this.accountKey}/${aFile.leafName}`;
},
cancelFileUpload(aUploadId) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
deleteFile(aUploadId) {
return new Promise(resolve => fdh.mc.window.setTimeout(resolve));
},
get displayName() {
return cloudFileAccounts.getDisplayName(this.accountKey);
--- a/mail/test/browser/shared-modules/MockObjectHelpers.jsm
+++ b/mail/test/browser/shared-modules/MockObjectHelpers.jsm
@@ -25,17 +25,17 @@ function MockObjectRegisterer(aContractI
}
MockObjectRegisterer.prototype = {
register: function MOR_register() {
let providedConstructor = this._component;
this._mockFactory = {
createInstance: function MF_createInstance(aOuter, aIid) {
if (aOuter != null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new providedConstructor().QueryInterface(aIid);
},
};
let componentRegistrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
componentRegistrar.registerFactory(
@@ -89,17 +89,17 @@ MockObjectReplacer.prototype = {
throw Error("Invalid object state when calling register()");
}
// Define a factory that creates a new object using the given constructor.
var providedConstructor = this._replacementCtor;
this._mockFactory = {
createInstance(aOuter, aIid) {
if (aOuter != null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return new providedConstructor().QueryInterface(aIid);
},
};
var retVal = swapFactoryRegistration(
this._cid,
this._originalCID,
--- a/mail/test/browser/shared-modules/PromptHelpers.jsm
+++ b/mail/test/browser/shared-modules/PromptHelpers.jsm
@@ -40,21 +40,21 @@ var gMockAuthPromptFactory = {
};
var gMockAuthPrompt = {
password: "",
QueryInterface: ChromeUtils.generateQI([Ci.nsIAuthPrompt]),
prompt(aTitle, aText, aRealm, aSave, aDefaultText) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
promptUsernameAndPassword(aTitle, aText, aRealm, aSave, aUser, aPwd) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
promptPassword(aTitle, aText, aRealm, aSave, aPwd) {
aPwd.value = this.password;
return true;
},
};
@@ -239,18 +239,18 @@ var gMockPromptService = {
"nsIPromptService"
);
},
};
var gMockPromptServiceFactory = {
createInstance(aOuter, aIID) {
if (aOuter != null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
if (!aIID.equals(Ci.nsIPromptService)) {
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
}
return gMockPromptService;
},
};
--- a/mail/test/browser/shared-modules/httpd.jsm
+++ b/mail/test/browser/shared-modules/httpd.jsm
@@ -66,17 +66,17 @@ function NS_ASSERT(cond, msg) {
dumpn(
stack
.map(function(val) {
return "###!!! " + val;
})
.join("\n")
);
- throw Cr.NS_ERROR_ABORT;
+ throw Components.Exception("", Cr.NS_ERROR_ABORT);
}
}
/** Constructs an HTTP error object. */
function HttpError(code, description) {
this.code = code;
this.description = description;
}
@@ -467,17 +467,17 @@ nsHttpServer.prototype = {
// see nsIHttpServer.start
//
start(port) {
this._start(port, "localhost");
},
_start(port, host) {
if (this._socket) {
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
this._port = port;
this._doQuit = this._socketClosed = false;
this._host = host;
// The listen queue needs to be long enough to handle
@@ -507,29 +507,29 @@ nsHttpServer.prototype = {
maxConnections +
" pending connections"
);
socket.asyncListen(this);
this._identity._initialize(port, host, true);
this._socket = socket;
} catch (e) {
dumpn("!!! could not start server on port " + port + ": " + e);
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
},
//
// see nsIHttpServer.stop
//
stop(callback) {
if (!callback) {
- throw Cr.NS_ERROR_NULL_POINTER;
+ throw Components.Exception("", Cr.NS_ERROR_NULL_POINTER);
}
if (!this._socket) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
this._stopCallback =
typeof callback === "function"
? callback
: function() {
callback.onStopped();
};
@@ -547,33 +547,33 @@ nsHttpServer.prototype = {
// socket-close notification and pending request completion happen async
},
//
// see nsIHttpServer.registerFile
//
registerFile(path, file) {
if (file && (!file.exists() || file.isDirectory())) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
this._handler.registerFile(path, file);
},
//
// see nsIHttpServer.registerDirectory
//
registerDirectory(path, directory) {
// XXX true path validation!
if (
path.charAt(0) != "/" ||
path.charAt(path.length - 1) != "/" ||
(directory && (!directory.exists() || !directory.isDirectory()))
) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
// XXX determine behavior of nonexistent /foo/bar when a /foo/bar/ mapping
// exists!
this._handler.registerDirectory(path, directory);
},
@@ -835,37 +835,37 @@ function ServerIdentity() {
ServerIdentity.prototype = {
// NSIHTTPSERVERIDENTITY
//
// see nsIHttpServerIdentity.primaryScheme
//
get primaryScheme() {
if (this._primaryPort === -1) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
return this._primaryScheme;
},
//
// see nsIHttpServerIdentity.primaryHost
//
get primaryHost() {
if (this._primaryPort === -1) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
return this._primaryHost;
},
//
// see nsIHttpServerIdentity.primaryPort
//
get primaryPort() {
if (this._primaryPort === -1) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
return this._primaryPort;
},
//
// see nsIHttpServerIdentity.add
//
add(scheme, host, port) {
@@ -1012,25 +1012,25 @@ ServerIdentity.prototype = {
*
* @throws NS_ERROR_ILLEGAL_VALUE
* if any argument doesn't match the corresponding production
*/
_validate(scheme, host, port) {
if (scheme !== "http" && scheme !== "https") {
dumpn("*** server only supports http/https schemes: '" + scheme + "'");
dumpStack();
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
if (!HOST_REGEX.test(host)) {
dumpn("*** unexpected host: '" + host + "'");
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
if (port < 0 || port > 65535) {
dumpn("*** unexpected port: '" + port + "'");
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
},
};
/**
* Represents a connection to the server (and possibly in the future the thread
* on which the connection is processed).
*
@@ -2296,29 +2296,29 @@ ServerHandler.prototype = {
},
//
// see nsIHttpServer.registerPathHandler
//
registerPathHandler(path, handler) {
// XXX true path validation!
if (path.charAt(0) != "/") {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
this._handlerToField(handler, this._overridePaths, path);
},
//
// see nsIHttpServer.registerPrefixHandler
//
registerPrefixHandler(path, handler) {
// XXX true path validation!
if (path.charAt(0) != "/" || path.charAt(path.length - 1) != "/") {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
this._handlerToField(handler, this._overridePrefixes, path);
},
//
// see nsIHttpServer.registerDirectory
//
@@ -2327,17 +2327,17 @@ ServerHandler.prototype = {
// determining exactly how a path maps onto a mapped directory --
// conditional is required here to deal with "/".substring(1, 0) being
// converted to "/".substring(0, 1) per the JS specification
var key = path.length == 1 ? "" : path.substring(1, path.length - 1);
// the path-to-directory mapping code requires that the first character not
// be "/", or it will go into an infinite loop
if (key.charAt(0) == "/") {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
key = toInternalPath(key, false);
if (directory) {
dumpn("*** mapping '" + path + "' to the location " + directory.path);
this._pathDirectoryMap.put(key, directory);
} else {
@@ -2985,17 +2985,17 @@ ServerHandler.prototype = {
* @param response : Response
* an uninitialized Response should be initialized when this method
* completes with information which represents the desired error code in the
* ideal case or a fallback code in abnormal circumstances (i.e., 500 is a
* fallback for 505, per HTTP specs)
*/
_handleError(errorCode, metadata, response) {
if (!metadata) {
- throw Cr.NS_ERROR_NULL_POINTER;
+ throw Components.Exception("", Cr.NS_ERROR_NULL_POINTER);
}
var errorX00 = errorCode - (errorCode % 100);
try {
if (!(errorCode in HTTP_ERROR_CODES)) {
dumpn("*** WARNING: requested invalid error: " + errorCode);
}
@@ -3526,17 +3526,17 @@ function Response(connection) {
Response.prototype = {
// PUBLIC CONSTRUCTION API
//
// see nsIHttpResponse.bodyOutputStream
//
get bodyOutputStream() {
if (this._finished) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
if (!this._bodyOutputStream) {
var pipe = new Pipe(
true,
false,
Response.SEGMENT_SIZE,
PR_UINT32_MAX,
@@ -3552,91 +3552,91 @@ Response.prototype = {
return this._bodyOutputStream;
},
//
// see nsIHttpResponse.write
//
write(data) {
if (this._finished) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
var dataAsString = String(data);
this.bodyOutputStream.write(dataAsString, dataAsString.length);
},
//
// see nsIHttpResponse.setStatusLine
//
setStatusLine(httpVersion, code, description) {
if (!this._headers || this._finished || this._powerSeized) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
this._ensureAlive();
if (!(code >= 0 && code < 1000)) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
try {
var httpVer;
// avoid version construction for the most common cases
if (!httpVersion || httpVersion == "1.1") {
httpVer = nsHttpVersion.HTTP_1_1;
} else if (httpVersion == "1.0") {
httpVer = nsHttpVersion.HTTP_1_0;
} else {
httpVer = new nsHttpVersion(httpVersion);
}
} catch (e) {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
// Reason-Phrase = *<TEXT, excluding CR, LF>
// TEXT = <any OCTET except CTLs, but including LWS>
//
// XXX this ends up disallowing octets which aren't Unicode, I think -- not
// much to do if description is IDL'd as string
if (!description) {
description = "";
}
for (var i = 0; i < description.length; i++) {
if (isCTL(description.charCodeAt(i)) && description.charAt(i) != "\t") {
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
}
// set the values only after validation to preserve atomicity
this._httpDescription = description;
this._httpCode = code;
this._httpVersion = httpVer;
},
//
// see nsIHttpResponse.setHeader
//
setHeader(name, value, merge) {
if (!this._headers || this._finished || this._powerSeized) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
this._ensureAlive();
this._headers.setHeader(name, value, merge);
},
//
// see nsIHttpResponse.processAsync
//
processAsync() {
if (this._finished) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
if (this._powerSeized) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
if (this._processAsync) {
return;
}
this._ensureAlive();
dumpn("*** processing connection " + this._connection.number + " async");
this._processAsync = true;
@@ -3659,20 +3659,20 @@ Response.prototype = {
}
},
//
// see nsIHttpResponse.seizePower
//
seizePower() {
if (this._processAsync) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
if (this._finished) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
if (this._powerSeized) {
return;
}
this._ensureAlive();
dumpn(
"*** forcefully seizing power over connection " +
@@ -3702,17 +3702,17 @@ Response.prototype = {
}
},
//
// see nsIHttpResponse.finish
//
finish() {
if (!this._processAsync && !this._powerSeized) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
if (this._finished) {
return;
}
dumpn("*** finishing connection " + this._connection.number);
this._startAsyncProcessor(); // in case bodyOutputStream was never accessed
if (this._bodyOutputStream) {
@@ -4080,17 +4080,17 @@ Response.prototype = {
/**
* Size of the segments in the buffer used in storing response data and writing
* it to the socket.
*/
Response.SEGMENT_SIZE = 8192;
/** Serves double duty in WriteThroughCopier implementation. */
function notImplemented() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
}
/** Returns true iff the given exception represents stream closure. */
function streamClosed(e) {
return (
e === Cr.NS_BASE_STREAM_CLOSED ||
(typeof e === "object" && e.result === Cr.NS_BASE_STREAM_CLOSED)
);
@@ -4114,17 +4114,17 @@ function wouldBlock(e) {
* the stream to which data is to be copied
* @param observer : nsIRequestObserver
* an observer which will be notified when the copy starts and finishes
* @throws NS_ERROR_NULL_POINTER
* if source, sink, or observer are null
*/
function WriteThroughCopier(source, sink, observer) {
if (!source || !sink || !observer) {
- throw Cr.NS_ERROR_NULL_POINTER;
+ throw Components.Exception("", Cr.NS_ERROR_NULL_POINTER);
}
/** Stream from which data is being read. */
this._source = source;
/** Stream to which data is being written. */
this._sink = sink;
@@ -4232,17 +4232,17 @@ WriteThroughCopier.prototype = {
this._pendingData.push(String.fromCharCode.apply(String, data));
}
dumpn("*** " + bytesConsumed + " bytes read");
// Handle the zero-data edge case in the same place as all other edge
// cases are handled.
if (bytesWanted === 0) {
- throw Cr.NS_BASE_STREAM_CLOSED;
+ throw Components.Exception("", Cr.NS_BASE_STREAM_CLOSED);
}
} catch (e) {
let ex = e;
if (streamClosed(e)) {
dumpn("*** input stream closed");
ex = bytesWanted === 0 ? Cr.NS_OK : Cr.NS_ERROR_UNEXPECTED;
} else {
dumpn("!!! unexpected error reading from input, canceling: " + e);
@@ -4636,23 +4636,23 @@ var headerUtils = {
* if fieldName does not match the field-name production in RFC 2616
* @returns string
* fieldName converted to lowercase if it is a valid header, for characters
* where case conversion is possible
*/
normalizeFieldName(fieldName) {
if (fieldName == "") {
dumpn("*** Empty fieldName");
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
for (var i = 0, sz = fieldName.length; i < sz; i++) {
if (!IS_TOKEN_ARRAY[fieldName.charCodeAt(i)]) {
dumpn(fieldName + " is not a valid header field name!");
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
}
return fieldName.toLowerCase();
},
/**
* Ensures that fieldValue is a valid header field value (although not
@@ -4689,17 +4689,17 @@ var headerUtils = {
// remove leading/trailing LWS (which has been converted to SP)
val = val.replace(/^ +/, "").replace(/ +$/, "");
// that should have taken care of all CTLs, so val should contain no CTLs
dumpn("*** Normalized value: '" + val + "'");
for (var i = 0, len = val.length; i < len; i++) {
if (isCTL(val.charCodeAt(i))) {
dump("*** Char " + i + " has charcode " + val.charCodeAt(i));
- throw Cr.NS_ERROR_INVALID_ARG;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_ARG);
}
}
// XXX disallows quoted-pair where CHAR is a CTL -- will not invalidly
// normalize, however, so this can be construed as a tightening of the
// spec and not entirely as a bug
return val;
},
@@ -4882,17 +4882,17 @@ nsHttpHeaders.prototype = {
* that header has been added more than once.
*/
getHeaderValues(fieldName) {
var name = headerUtils.normalizeFieldName(fieldName);
if (name in this._headers) {
return this._headers[name];
}
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
},
/**
* Returns true if a header with the given field name exists in this, false
* otherwise.
*
* @param fieldName : string
* the field name whose existence is to be determined in this
@@ -4935,17 +4935,17 @@ function nsSimpleEnumerator(items) {
this._nextIndex = 0;
}
nsSimpleEnumerator.prototype = {
hasMoreElements() {
return this._nextIndex < this._items.length;
},
getNext() {
if (!this.hasMoreElements()) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
return this._items[this._nextIndex++];
},
QueryInterface: ChromeUtils.generateQI(["nsISimpleEnumerator"]),
};
/**
--- a/mailnews/addrbook/jsaddrbook/AddrBookCard.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookCard.jsm
@@ -86,29 +86,29 @@ AddrBookCard.prototype = {
get UID() {
if (!this._uid) {
this._uid = newUID();
}
return this._uid;
},
set UID(value) {
if (value != this._uid) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return value;
},
get properties() {
let entries = [...this._properties.entries()];
let enumerator = {
hasMoreElements() {
return entries.length > 0;
},
getNext() {
if (!this.hasMoreElements()) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
let [name, value] = entries.shift();
return {
get name() {
return name;
},
get value() {
return value;
@@ -165,46 +165,46 @@ AddrBookCard.prototype = {
getPropertyAsAString(name) {
if (!this._properties.has(name)) {
return "";
}
return this.getProperty(name);
},
getPropertyAsAUTF8String(name) {
if (!this._properties.has(name)) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
return this.getProperty(name);
},
getPropertyAsUint32(name) {
let value = this.getProperty(name);
if (isNaN(parseInt(value, 10))) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
return value;
},
getPropertyAsBool(name) {
let value = this.getProperty(name);
switch (value) {
case false:
case 0:
case "0":
return false;
case true:
case 1:
case "1":
return true;
}
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
},
setProperty(name, value) {
this._properties.set(name, value);
},
setPropertyAsAString(name, value) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
setPropertyAsAUTF8String(name, value) {
this.setProperty(name, value);
},
setPropertyAsUint32(name, value) {
this.setProperty(name, value);
},
setPropertyAsBool(name, value) {
@@ -250,14 +250,14 @@ AddrBookCard.prototype = {
]) {
if (this._properties.has(name)) {
return this._properties.get(name);
}
}
return "";
},
copy(srcCard) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
equals(card) {
return this.UID == card.UID;
},
};
--- a/mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm
@@ -74,17 +74,17 @@ AddrBookDirectory.prototype = {
);
for (let list of parent.childNodes) {
list.QueryInterface(Ci.nsIAbDirectory);
if (list.URI == uri) {
this.__proto__ = list;
return;
}
}
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
let fileName = uri.substring("jsaddrbook://".length);
if (fileName.includes("/")) {
fileName = fileName.substring(0, fileName.indexOf("/"));
}
this.__proto__ =
directories.get(fileName) || new AddrBookDirectoryInner(fileName);
@@ -185,17 +185,17 @@ function AddrBookDirectoryInner(fileName
child.endsWith(".filename") &&
Services.prefs.getStringPref(child) == fileName
) {
this.dirPrefId = child.substring(0, child.length - ".filename".length);
break;
}
}
if (!this.dirPrefId) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
// Make sure we always have a file. If a file is not created, the
// filename may be accidentally reused.
let file = FileUtils.getFile("ProfD", [fileName]);
if (!file.exists()) {
file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
}
@@ -208,17 +208,17 @@ AddrBookDirectoryInner.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIAbDirectory]),
classID: Components.ID("{e96ee804-0bd3-472f-81a6-8a9d65277ad3}"),
_uid: null,
_nextCardId: null,
_nextListId: null,
get _prefBranch() {
if (!this.dirPrefId) {
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
}
return Services.prefs.getBranch(`${this.dirPrefId}.`);
},
get _dbConnection() {
let file = FileUtils.getFile("ProfD", [this.fileName]);
let connection = openConnectionTo(file);
Object.defineProperty(this._inner, "_dbConnection", {
@@ -942,17 +942,17 @@ AddrBookDirectoryInner.prototype = {
newValue
);
}
}
Services.obs.notifyObservers(card, "addrbook-contact-updated", this.UID);
},
deleteCards(cards) {
if (cards === null) {
- throw Cr.NS_ERROR_INVALID_POINTER;
+ throw Components.Exception("", Cr.NS_ERROR_INVALID_POINTER);
}
let deleteCardStatement = this._dbConnection.createStatement(
"DELETE FROM cards WHERE uid = :uid"
);
for (let card of cards.enumerate(Ci.nsIAbCard)) {
deleteCardStatement.params.uid = card.UID;
deleteCardStatement.execute();
@@ -1030,17 +1030,17 @@ AddrBookDirectoryInner.prototype = {
useForAutocomplete(identityKey) {
return (
Services.prefs.getBoolPref("mail.enable_autocomplete") &&
this.getBoolValue("enable_autocomplete", true)
);
},
addMailList(list) {
if (!list.isMailList) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
let newList = new AddrBookMailingList(
newUID(),
this,
this._getNextListId(),
list.dirName || "",
list.listNickName || "",
@@ -1055,20 +1055,20 @@ AddrBookDirectoryInner.prototype = {
newList.asDirectory,
"addrbook-list-created",
this.UID
);
return newListDirectory;
},
editMailListToDatabase(listCard) {
// Deliberately not implemented, this isn't a mailing list.
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
copyMailList(srcList) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
getIntValue(name, defaultValue) {
return this._prefBranch.getIntPref(name, defaultValue);
},
getBoolValue(name, defaultValue) {
return this._prefBranch.getBoolPref(name, defaultValue);
},
getStringValue(name, defaultValue) {
--- a/mailnews/addrbook/jsaddrbook/AddrBookManager.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookManager.jsm
@@ -69,17 +69,17 @@ if (AppConstants.platform == "macosx") {
* @param {string} uri - URI for the directory.
* @param {boolean} shouldStore - Whether to keep a reference to this address
* book in the store.
* @returns {nsIAbDirectory}
*/
function createDirectoryObject(uri, shouldStore = false) {
let uriParts = URI_REGEXP.exec(uri);
if (!uriParts) {
- throw Cr.NS_ERROR_MALFORMED_URI;
+ throw Components.Exception("", Cr.NS_ERROR_MALFORMED_URI);
}
let [, scheme] = uriParts;
let dir = Cc[
`@mozilla.org/addressbook/directory;1?type=${scheme}`
].createInstance(Ci.nsIAbDirectory);
if (shouldStore) {
store.set(uri, dir);
@@ -186,25 +186,25 @@ AddrBookManager.prototype = {
ensureInitialized();
if (store.has(uri)) {
return store.get(uri);
}
let uriParts = URI_REGEXP.exec(uri);
if (!uriParts) {
- throw Cr.NS_ERROR_MALFORMED_URI;
+ throw Components.Exception("", Cr.NS_ERROR_MALFORMED_URI);
}
let [, scheme, , tail] = uriParts;
if (tail && types.includes(scheme)) {
// `tail` could either point to a mailing list or a query.
// Both of these will be handled differently in future.
return createDirectoryObject(uri);
}
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
},
getDirectoryFromId(dirPrefId) {
ensureInitialized();
for (let dir of store.values()) {
if (dir.dirPrefId == dirPrefId) {
return dir;
}
}
@@ -259,34 +259,34 @@ AddrBookManager.prototype = {
this.notifyDirectoryItemAdded(null, dir);
Services.obs.notifyObservers(dir, "addrbook-directory-created");
break;
}
case MAPI_DIRECTORY_TYPE: {
if (AppConstants.platform == "macosx") {
uri = "moz-abosxdirectory:///";
if (store.has(uri)) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
prefName = "ldap_2.servers.osx";
} else if (AppConstants.platform == "win") {
if (
![
"moz-aboutlookdirectory://oe/",
"moz-aboutlookdirectory://op/",
].includes(uri)
) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
if (store.has(uri)) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
prefName = "ldap_2.servers.oe";
} else {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
Services.prefs.setIntPref(`${prefName}.dirType`, MAPI_DIRECTORY_TYPE);
Services.prefs.setStringPref(
`${prefName}.description`,
"chrome://messenger/locale/addressbook/addressBook.properties"
);
Services.prefs.setStringPref(`${prefName}.uri`, uri);
@@ -319,25 +319,25 @@ AddrBookManager.prototype = {
uri = `jsaddrbook://${file.leafName}`;
let dir = createDirectoryObject(uri, true);
this.notifyDirectoryItemAdded(null, dir);
Services.obs.notifyObservers(dir, "addrbook-directory-created");
break;
}
default:
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
return prefName;
},
deleteAddressBook(uri) {
let uriParts = URI_REGEXP.exec(uri);
if (!uriParts) {
- throw Cr.NS_ERROR_MALFORMED_URI;
+ throw Components.Exception("", Cr.NS_ERROR_MALFORMED_URI);
}
let [, scheme, fileName, tail] = uriParts;
if (tail) {
if (tail.startsWith("/MailList")) {
let dir = store.get(`${scheme}://${fileName}`);
let list = this.getDirectory(uri);
if (dir && list) {
--- a/mailnews/addrbook/jsaddrbook/AddrBookUtils.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookUtils.jsm
@@ -36,17 +36,17 @@ function SimpleEnumerator(elements) {
SimpleEnumerator.prototype = {
hasMoreElements() {
return this._position < this._elements.length;
},
getNext() {
if (this.hasMoreElements()) {
return this._elements[this._position++];
}
- throw Cr.NS_ERROR_NOT_AVAILABLE;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_AVAILABLE);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
*[Symbol.iterator]() {
while (this.hasMoreElements()) {
yield this.getNext();
}
},
};
--- a/mailnews/addrbook/src/AbLDAPAttributeMap.jsm
+++ b/mailnews/addrbook/src/AbLDAPAttributeMap.jsm
@@ -19,17 +19,17 @@ AbLDAPAttributeMap.prototype = {
// return the joined list
return this.mPropertyMap[aProperty].join(",");
},
getAttributes(aProperty) {
// fail if no entry for this
if (!(aProperty in this.mPropertyMap)) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return this.mPropertyMap[aProperty];
},
getFirstAttribute(aProperty) {
// fail if no entry for this
if (!(aProperty in this.mPropertyMap)) {
return null;
@@ -41,17 +41,17 @@ AbLDAPAttributeMap.prototype = {
setAttributeList(aProperty, aAttributeList, aAllowInconsistencies) {
var attrs = aAttributeList.split(",");
// check to make sure this call won't allow multiple mappings to be
// created, if requested
if (!aAllowInconsistencies) {
for (var attr of attrs) {
if (attr in this.mAttrMap && this.mAttrMap[attr] != aProperty) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
}
}
// delete any attr mappings created by the existing property map entry
if (aProperty in this.mPropertyMap) {
for (attr of this.mPropertyMap[aProperty]) {
delete this.mAttrMap[attr];
@@ -78,17 +78,17 @@ AbLDAPAttributeMap.prototype = {
getAllCardAttributes() {
var attrs = [];
for (var prop in this.mPropertyMap) {
let attrArray = this.mPropertyMap[prop];
attrs = attrs.concat(attrArray);
}
if (!attrs.length) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return attrs.join(",");
},
getAllCardProperties() {
var props = [];
for (var prop in this.mPropertyMap) {
@@ -148,34 +148,34 @@ AbLDAPAttributeMap.prototype = {
} catch (ex) {
// ignore any errors getting message values or setting card values
}
}
}
}
if (!cardValueWasSet) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
},
checkState() {
var attrsSeen = [];
for (var prop in this.mPropertyMap) {
let attrArray = this.mPropertyMap[prop];
for (var attr of attrArray) {
// multiple attributes that mapped to the empty string are permitted
if (!attr.length) {
continue;
}
// if we've seen this before, there's a problem
if (attrsSeen.includes(attr)) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
// remember that we've seen it now
attrsSeen.push(attr);
}
}
},
--- a/mailnews/base/src/FolderLookupService.jsm
+++ b/mailnews/base/src/FolderLookupService.jsm
@@ -15,17 +15,17 @@ var gCreated = false;
/**
* FolderLookupService maintains an index of folders and provides
* lookup by folder URI.
* @class
*/
function FolderLookupService() {
if (gCreated) {
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
this._map = new Map();
gCreated = true;
}
FolderLookupService.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIFolderLookupService]),
--- a/mailnews/base/src/MailNewsCommandLineHandler.jsm
+++ b/mailnews/base/src/MailNewsCommandLineHandler.jsm
@@ -143,17 +143,17 @@ MailNewsCommandLineHandler.prototype = {
helpInfo:
" -mail Open the mail folder view.\n" +
" -mail <URL> Open the message specified by this URL.\n",
/* nsIFactory */
createInstance(outer, iid) {
if (outer != null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},
QueryInterface: ChromeUtils.generateQI([
Ci.nsICommandLineHandler,
Ci.nsIFactory,
--- a/mailnews/base/test/unit/test_compactFailure.js
+++ b/mailnews/base/test/unit/test_compactFailure.js
@@ -25,26 +25,26 @@ logHelperAllowedErrors.push(Cr.NS_ERROR_
logHelperAllowedErrors.push(Cr.NS_ERROR_FILE_TARGET_DOES_NOT_EXIST);
function LockedFileOutputStream() {}
LockedFileOutputStream.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIFileOutputStream]),
init(file, ioFlags, perm, behaviorFlags) {
- throw Cr.NS_ERROR_FILE_IS_LOCKED;
+ throw Components.Exception("", Cr.NS_ERROR_FILE_IS_LOCKED);
},
};
var MsgDBServiceFailure = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgDBService]),
openMailDBFromFile(file, folder, create, leaveInvalidDB) {
if (folder.name == "ShouldFail") {
- throw Cr.NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
+ throw Components.Exception("", Cr.NS_ERROR_FILE_TARGET_DOES_NOT_EXIST);
}
return this._genuine.openMailDBFromFile(
file,
folder,
create,
leaveInvalidDB
);
},
--- a/mailnews/compose/src/SMTPProtocolHandler.jsm
+++ b/mailnews/compose/src/SMTPProtocolHandler.jsm
@@ -15,17 +15,17 @@ function makeProtocolHandler(aProtocol,
protocolFlags:
nsIProtocolHandler.URI_NORELATIVE |
nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
nsIProtocolHandler.URI_NON_PERSISTABLE |
nsIProtocolHandler.ALLOWS_PROXY |
nsIProtocolHandler.URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT,
newChannel(aURI, aLoadInfo) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
allowPort(port, scheme) {
return port == aDefaultPort;
},
};
}
--- a/mailnews/import/test/unit/resources/mock_windows_reg_factory.js
+++ b/mailnews/import/test/unit/resources/mock_windows_reg_factory.js
@@ -8,29 +8,29 @@ function MockWindowsRegKey(registryData)
this._registryData = registryData;
}
MockWindowsRegKey.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIWindowsRegKey]),
open(aRootKey, aRelPath, aMode) {
if (!this._registryData[aRelPath]) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
this._keyPath = aRelPath;
},
close() {},
openChild(aRelPath, aMode) {
if (
!this._registryData[this._keyPath] ||
!this._registryData[this._keyPath][aRelPath]
) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
let child = new MockWindowsRegKey({});
let newKeyPath = this._keyPath + "\\" + aRelPath;
child._keyPath = newKeyPath;
child._registryData[newKeyPath] = this._registryData[this._keyPath][
aRelPath
];
@@ -40,28 +40,28 @@ MockWindowsRegKey.prototype = {
get childCount() {
return Object.keys(this._registryData[this._keyPath]).length;
},
getChildName(aIndex) {
let keys = Object.keys(this._registryData[this._keyPath]);
let keyAtIndex = keys[aIndex];
if (!keyAtIndex) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return keyAtIndex;
},
_readValue(aName) {
if (
!this._registryData[this._keyPath] ||
!this._registryData[this._keyPath][aName]
) {
- throw Cr.NS_ERROR_FAILURE;
+ throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
return this._registryData[this._keyPath][aName];
},
readIntValue(aName) {
return this._readValue(aName);
},
--- a/mailnews/jsaccount/modules/JSAccountUtils.jsm
+++ b/mailnews/jsaccount/modules/JSAccountUtils.jsm
@@ -82,17 +82,17 @@ var log = configureLogging();
JSAccountUtils.jaFactory = function(aProperties, aJsDelegateConstructor) {
let factory = {};
factory.QueryInterface = ChromeUtils.generateQI([Ci.nsIFactory]);
factory.lockFactory = function() {};
factory.createInstance = function(outer, iid) {
if (outer != null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
// C++ delegator class.
let delegator = Cc[aProperties.baseContractID].createInstance(
Ci.msgIOverride
);
// Make sure the delegator JS wrapper knows its interfaces.
@@ -181,17 +181,17 @@ JSAccountUtils.jaFactory = function(aPro
}
for (let iface of aProperties.baseInterfaces) {
if (iid.equals(iface)) {
log.debug("Successfully returning delegator " + delegator);
return delegator;
}
}
- throw Cr.NS_ERROR_NO_INTERFACE;
+ throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
};
return factory;
};
/**
* Create a JS object that contains calls to each of the methods in a CPP
* base class, that will reference the cpp object defined on a particular
--- a/mailnews/mime/src/MimeJSComponents.jsm
+++ b/mailnews/mime/src/MimeJSComponents.jsm
@@ -39,17 +39,17 @@ StringEnumerator.prototype = {
this._setNext();
return !this._next.done;
},
getNext() {
this._setNext();
let result = this._next;
this._next = undefined;
if (result.done) {
- throw Cr.NS_ERROR_UNEXPECTED;
+ throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED);
}
return result.value;
},
};
/**
* If we get XPConnect-wrapped objects for msgIAddressObjects, we will have
* properties defined for 'group' that throws off jsmime. This function converts
@@ -87,25 +87,25 @@ MimeStructuredHeaders.prototype = {
return this._headers.has(aHeaderName.toLowerCase());
},
getUnstructuredHeader(aHeaderName) {
let result = this.getHeader(aHeaderName);
if (result === undefined || typeof result == "string") {
return result;
}
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
},
getAddressingHeader(aHeaderName, aPreserveGroups) {
let addrs = this.getHeader(aHeaderName);
if (addrs === undefined) {
addrs = [];
} else if (!Array.isArray(addrs)) {
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
+ throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
}
return fixArray(addrs, aPreserveGroups);
},
getRawHeader(aHeaderName) {
let result = this.getHeader(aHeaderName);
if (result === undefined) {
return result;
@@ -154,17 +154,17 @@ MimeHeaders.prototype = {
]),
initialize(allHeaders) {
this._headers = MimeParser.extractHeaders(allHeaders);
},
extractHeader(header, getAll) {
if (!this._headers) {
- throw Cr.NS_ERROR_NOT_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_NOT_INITIALIZED);
}
// Canonicalized to lower-case form
header = header.toLowerCase();
if (!this._headers.has(header)) {
return null;
}
var values = this._headers.getRawHeader(header);
if (getAll) {
--- a/mailnews/test/fakeserver/Maild.jsm
+++ b/mailnews/test/fakeserver/Maild.jsm
@@ -174,17 +174,17 @@ nsMailServer.prototype = {
this._debug = debug;
for (var i = 0; i < this._readers.length; i++) {
this._readers[i].setDebugLevel(debug);
}
},
start(port = -1) {
if (this._socket) {
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
+ throw Components.Exception("", Cr.NS_ERROR_ALREADY_INITIALIZED);
}
if (port > 0) {
this._port = port;
}
this._socketClosed = false;
var socket = new ServerSocket(
--- a/mailnews/test/resources/alertTestUtils.js
+++ b/mailnews/test/resources/alertTestUtils.js
@@ -332,17 +332,17 @@ var alertUtilsPromptService = {
}
do_throw("selectPS unexpectedly called: " + aText + "\n");
return false;
},
createInstance(outer, iid) {
if (outer != null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
}
return this.QueryInterface(iid);
},
QueryInterface: ChromeUtils.generateQI([
Ci.nsIPromptService,
Ci.nsIPromptService2,
]),