From 61a9cafb6f5440060e3b6a10ea41552bedbe02c3 Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Mon, 24 Oct 2022 22:35:42 +0000 Subject: [PATCH] Bug 1795797 - Await CalDAVServer.putItemInternal wherever it is called. r=mkmelin I missed one of these in a review comment. It turns out there are many calls which do not await, although it doesn't appear to make any difference. Differential Revision: https://phabricator.services.mozilla.com/D159823 --HG-- extra : moz-landing-system : lando --- .../browser_caldavCalendar_cached.js | 4 +-- .../browser_caldavCalendar_uncached.js | 4 +-- .../providers/test_caldavCalendar_cached.js | 32 ++++++++++--------- .../providers/test_caldavCalendar_uncached.js | 30 +++++++++-------- 4 files changed, 37 insertions(+), 33 deletions(-) diff --git a/calendar/test/browser/providers/browser_caldavCalendar_cached.js b/calendar/test/browser/providers/browser_caldavCalendar_cached.js index e584580a5b..0e0d0259c4 100644 --- a/calendar/test/browser/providers/browser_caldavCalendar_cached.js +++ b/calendar/test/browser/providers/browser_caldavCalendar_cached.js @@ -44,13 +44,13 @@ add_task(async function testAlarms() { add_task(async function testSyncChanges() { await syncChangesTest.setUp(); - CalDAVServer.putItemInternal( + await CalDAVServer.putItemInternal( "ad0850e5-8020-4599-86a4-86c90af4e2cd.ics", syncChangesTest.part1Item ); await syncChangesTest.runPart1(); - CalDAVServer.putItemInternal( + await CalDAVServer.putItemInternal( "ad0850e5-8020-4599-86a4-86c90af4e2cd.ics", syncChangesTest.part2Item ); diff --git a/calendar/test/browser/providers/browser_caldavCalendar_uncached.js b/calendar/test/browser/providers/browser_caldavCalendar_uncached.js index ccb3cab182..abd3bab853 100644 --- a/calendar/test/browser/providers/browser_caldavCalendar_uncached.js +++ b/calendar/test/browser/providers/browser_caldavCalendar_uncached.js @@ -41,13 +41,13 @@ add_task(async function testAlarms() { add_task(async function testSyncChanges() { await syncChangesTest.setUp(); - CalDAVServer.putItemInternal( + await CalDAVServer.putItemInternal( "ad0850e5-8020-4599-86a4-86c90af4e2cd.ics", syncChangesTest.part1Item ); await syncChangesTest.runPart1(); - CalDAVServer.putItemInternal( + await CalDAVServer.putItemInternal( "ad0850e5-8020-4599-86a4-86c90af4e2cd.ics", syncChangesTest.part2Item ); diff --git a/calendar/test/unit/providers/test_caldavCalendar_cached.js b/calendar/test/unit/providers/test_caldavCalendar_cached.js index d6f2ca11fd..608b112bfd 100644 --- a/calendar/test/unit/providers/test_caldavCalendar_cached.js +++ b/calendar/test/unit/providers/test_caldavCalendar_cached.js @@ -4,20 +4,22 @@ var { CalDAVServer } = ChromeUtils.import("resource://testing-common/calendar/CalDAVServer.jsm"); -CalDAVServer.open(); -CalDAVServer.putItemInternal( - "5a9fa76c-93f3-4ad8-9f00-9e52aedd2821.ics", - CalendarTestUtils.dedent` - BEGIN:VCALENDAR - BEGIN:VEVENT - UID:5a9fa76c-93f3-4ad8-9f00-9e52aedd2821 - SUMMARY:exists before time - DTSTART:20210401T120000Z - DTEND:20210401T130000Z - END:VEVENT - END:VCALENDAR - ` -); +add_setup(async function() { + CalDAVServer.open(); + await CalDAVServer.putItemInternal( + "5a9fa76c-93f3-4ad8-9f00-9e52aedd2821.ics", + CalendarTestUtils.dedent` + BEGIN:VCALENDAR + BEGIN:VEVENT + UID:5a9fa76c-93f3-4ad8-9f00-9e52aedd2821 + SUMMARY:exists before time + DTSTART:20210401T120000Z + DTEND:20210401T130000Z + END:VEVENT + END:VCALENDAR + ` + ); +}); registerCleanupFunction(() => CalDAVServer.close()); add_task(async function() { @@ -154,7 +156,7 @@ add_task(async function testSyncError2() { // Add some items to the server so multiple requests are required to get // them all. There's already one item on the server. for (let i = 0; i < 3; i++) { - CalDAVServer.putItemInternal( + await CalDAVServer.putItemInternal( `fake-uid-${i}.ics`, CalendarTestUtils.dedent` BEGIN:VCALENDAR diff --git a/calendar/test/unit/providers/test_caldavCalendar_uncached.js b/calendar/test/unit/providers/test_caldavCalendar_uncached.js index 99316acf8b..64d521ad2d 100644 --- a/calendar/test/unit/providers/test_caldavCalendar_uncached.js +++ b/calendar/test/unit/providers/test_caldavCalendar_uncached.js @@ -4,20 +4,22 @@ var { CalDAVServer } = ChromeUtils.import("resource://testing-common/calendar/CalDAVServer.jsm"); -CalDAVServer.open(); -CalDAVServer.putItemInternal( - "5a9fa76c-93f3-4ad8-9f00-9e52aedd2821.ics", - CalendarTestUtils.dedent` - BEGIN:VCALENDAR - BEGIN:VEVENT - UID:5a9fa76c-93f3-4ad8-9f00-9e52aedd2821 - SUMMARY:exists before time - DTSTART:20210401T120000Z - DTEND:20210401T130000Z - END:VEVENT - END:VCALENDAR - ` -); +add_setup(async function() { + CalDAVServer.open(); + await CalDAVServer.putItemInternal( + "5a9fa76c-93f3-4ad8-9f00-9e52aedd2821.ics", + CalendarTestUtils.dedent` + BEGIN:VCALENDAR + BEGIN:VEVENT + UID:5a9fa76c-93f3-4ad8-9f00-9e52aedd2821 + SUMMARY:exists before time + DTSTART:20210401T120000Z + DTEND:20210401T130000Z + END:VEVENT + END:VCALENDAR + ` + ); +}); registerCleanupFunction(() => CalDAVServer.close()); add_task(async function() {