Closed Bug 1612175 Opened 2 months ago Closed 2 months ago

Refactor calendar data migration code

Categories

(Calendar :: General, task)

task
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pmorris, Assigned: pmorris)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

A follow-up on bug 1608610. See comment 104 (https://bugzilla.mozilla.org/show_bug.cgi?id=1608610#c104). The code in calendar-migration-dialog.js needs to be split up so the whole file doesn't need to be included in main window (messenger.xhtml) scope, but we still prevent this error on first run with a fresh profile:

  Migrator error: ReferenceError: gDataMigrator is not defined calendar-management.js:423
    initHomeCalendar chrome://calendar/content/calendar-management.js:423
    loadCalendarManager chrome://calendar/content/calendar-management.js:122
    commonInitCalendar chrome://calendar/content/calendar-chrome-startup.js:28
    ltnOnLoad chrome://lightning/content/messenger-overlay-sidebar.js:386
    (Async: EventListener.handleEvent)
    <anonymous> chrome://lightning/content/messenger-overlay-sidebar.js:753

Also some of the code in calendar-migration-dialog.js can be removed (e.g. for migrating data from Sunbird).

Part1 - Remove ancient code for migrating from sunbird and early calendar add-on.

Attachment #9124900 - Flags: review?(geoff)

part2 - Replace ad hoc logger function with console.debug.

Attachment #9124901 - Flags: review?(geoff)

part3 - Split migration code into two files, one for the main window and one for the migration dialog.
I confirmed that the "gDataMigrator" is not defined" error did not occur with a new profile.

Attachment #9124902 - Flags: review?(geoff)
Attachment #9124900 - Flags: review?(geoff) → review+
Comment on attachment 9124902 [details] [diff] [review]
part3-split-up-migration-code-0.patch

Review of attachment 9124902 [details] [diff] [review]:
-----------------------------------------------------------------

::: calendar/base/content/calendar-migration.js
@@ +10,5 @@
>  var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
>  var { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
>  
>  //
> +// The more back-end data detection bits.

Let's lose this comment.

::: calendar/base/content/dialogs/calendar-migration-dialog.js
@@ +6,3 @@
>  
>  //
>  // The front-end wizard bits.

And this one.
Attachment #9124902 - Flags: review?(geoff) → review+
Attachment #9124901 - Flags: review?(geoff) → review+

Removes those two unneeded comments.

Attachment #9124902 - Attachment is obsolete: true
Attachment #9125143 - Flags: review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/0a9ab01b088c
Remove ancient Sunbird era migration code. r=darktrojan
https://hg.mozilla.org/comm-central/rev/d2d2062087ac
Replace ad hoc migration logging function with console.debug. r=darktrojan
https://hg.mozilla.org/comm-central/rev/8e95050586b3
Split calendar migration code into front and back end files. r=darktrojan

Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Product: Thunderbird → Calendar
Target Milestone: --- → 74
You need to log in before you can comment on or make changes to this bug.