Bug 1667962 - Avoid comparing calendar objects in a way that causes them to be printed to a log. r=mkmelin

The log printer follows a cyclical reference until it dies of "too much recursion".

Differential Revision: https://phabricator.services.mozilla.com/D128976

--HG--
extra : rebase_source : c1909693412deb639017163ef22632b32773abf8
This commit is contained in:
Geoff Lankow 2021-10-17 14:53:34 +13:00
Родитель 8f036fdc02
Коммит 625a29cc8a
4 изменённых файлов: 3 добавлений и 10 удалений

Просмотреть файл

@ -384,7 +384,7 @@ function test_dates() {
alarm.related = Ci.calIAlarm.ALARM_RELATED_ABSOLUTE;
let alarmDate = createDate(2007, 0, 1, true, 2, 0, 0);
alarm.alarmDate = alarmDate;
equal(alarm.alarmDate, alarmDate);
equal(alarm.alarmDate.icalString, alarmDate.icalString);
equal(alarm.offset, null);
try {
alarm.offset = cal.createDuration();

Просмотреть файл

@ -88,7 +88,7 @@ add_task(async function test_setDefaultValues_tasks() {
equal(alarm.related, Ci.calIAlarm.ALARM_RELATED_START);
equal(alarm.action, "DISPLAY");
equal(alarm.offset.icalString, "-P2DT12H");
equal(item.entryDate, nowDate);
equal(item.entryDate.icalString, nowDate.icalString);
Services.prefs.setIntPref("calendar.alarms.onfortodos", 1);
Services.prefs.setStringPref("calendar.alarms.todoalarmunit", "yards");

Просмотреть файл

@ -94,6 +94,6 @@ function check_absolute(aIcalString) {
let alarm = new CalAlarm();
alarm.icalString = aIcalString;
equal(alarm.related, Ci.calIAlarm.ALARM_RELATED_ABSOLUTE);
notEqual(alarm.alarmDate, null);
ok(alarm.alarmDate != null);
equal(alarm.offset, null);
}

Просмотреть файл

@ -919,14 +919,7 @@ add_task(async function test_freebusy_request() {
equal(results.headers.get("Originator"), "mailto:xpcshell@example.com");
equal(results.headers.get("Recipient"), "mailto:recipient@example.com");
// The following assertion succeeds but causes "too much recursion" with
// icaljs. Assert.jsm calls JSON.stringify on the arguments to log the result
// of the assertion, and that causes the recursion error. (Then Assert.jsm
// just falls back to using toString instead.) See bug 1546606 starting at
// comment 23 and ical.js issue #410.
let first = response.firstRecipient;
strictEqual(first, response.data["mailto:recipient1@example.com"]);
equal(first.status, "2.0;Success");
deepEqual(
first.intervals.map(interval => interval.type),