Closed Bug 1771371 Opened 2 years ago Closed 2 years ago

Add-ons not loaded in first Account Creation Dialog

Categories

(Thunderbird :: Add-Ons: General, defect)

Thunderbird 102
defect

Tracking

(thunderbird_esr91 unaffected)

RESOLVED FIXED
102 Branch
Tracking Status
thunderbird_esr91 --- unaffected

People

(Reporter: BenB, Assigned: TbSync)

Details

Attachments

(1 file, 1 obsolete file)

Bug: If there are no accounts configured, add-on startup is running after the account creation dialog, but it needs to run before.

Reproduction 1:

  1. Pre-install Owl in the TB install or profile folder, e.g. in an enterprise setup with automatic rollout
  2. Start Thunderbird with a fresh profile
  3. -> The account creation dialog comes up
  4. Cancel the dialog and close Thunderbird
  5. Start Thunderbird again
  6. -> The account creation dialog comes up
  7. Set up an Exchange account

Reproduction 2:

  1. Start Thunderbird with a fresh profile
  2. -> The account creation dialog comes up
  3. Cancel the dialog and close Thunderbird
  4. Start Thunderbird again
  5. -> The account creation dialog comes up
  6. Set up an Exchange account

Reproduction 3:

  1. Start Thunderbird with a fresh profile
  2. -> The account creation dialog comes up
  3. Cancel the dialog, but say "No" to "Use without mail", and do not close Thunderbird
  4. Go to addons manager, and install Owl
  5. Close Thunderbird
  6. Start Thunderbird again
  7. -> The account creation dialog comes up
  8. Set up an Exchange account

Reproduction 2:

  1. Start Thunderbird with a fresh profile
  2. -> The account creation dialog comes up
  3. Set up an Exchange account, install Owl, but cancel during the OAuth2 process
  4. Cancel the dialog and close Thunderbird
  5. Start Thunderbird again
  6. -> The account creation dialog comes up
  7. Set up an Exchange account

Actual result:

  • Owl is installed in the directory
  • The account creation dialog sees that Owl is installed, and tries to use it, but that fails, because Owl has not been started yet. Owl is disfunctional.

Expected result:

  • If Owl is installed (by any of the above means), it loads before the account creation dialog starts, and account creation works.

Implementation:
There are 4 scenarios:

  • If mail accounts are configured, addons are started after the folder pane loaded.
  • If no accounts are configured, and TB loads the account creation dialog, then addons are not loaded until after the dialog finishes, which breaks Owl, because it's needed to create the account. This is the bug we fix here.
  • If the user aborts the account creation dialog, and wants to use TB without mail accounts, and restarts TB, addons load correctly, because TB runs the "post account creation dialog" code in this case.

Also:
On the very first load, Gecko loads all pre-installed addons, so it works for the very first time, but not after you restart Thunderbird (without having an account configured).

Wow, John, you're fast. I was about to attach a patch, but you responded before I could! :)

Hey John, this is what we have.

Attachment #9278367 - Flags: review?(john)
Assignee: nobody → ben.bucksch
Status: NEW → ASSIGNED

John, I see that in your patch https://hg.mozilla.org/try-comm-central/rev/a96c5899c0bd633ea33c0e9a1b4f42f9f0422693 https://hg.mozilla.org/try-comm-central/file/a96c5899c0bd633ea33c0e9a1b4f42f9f0422693/mail/base/content/msgMail3PaneWindow.js#l694 , you put the load a few lines before the calendar load, but it's otherwise an identical patch.

Owl uses the calendar, and it's nice to be able to depend that the calendar is there, so that's why we put it after the calendar load. Otherwise, the patches are identical.

How come you're working on the exact same patch in the exact same moment? What a coincidence!

I was stumbling upon strange effects while testing different add-ons in 102 (but not owl) and by inspecting the code I saw that I made a mistake regarding the "extensions-late-startup" event: I wired it up to the "mail-tabs-session-restored" event instead of the "mail-delayed-startup-finished" event.

My try run finished a few minutes before you filed this bug, so yeah, that was perfect timing.

I would like to stay as close to m-c here as possible, and currently prefer my patch. In 91, your add-on started way earlier, how did you await calendar being ready? Is there anything we could add to make it easier for you to detect calendar being ready?

I think it will be fine to load earlier. This is just the extension loading at all. It doesn't mean that we need to access calendar just yet.

Ok, but with merge day coming next week, I need to get this fixed today or on Monday. Not putting any pressure on you, but ... :-)

You can detect if session restore has fired or not by looking at SessionStoreManager._restored, do not know if that helps or not.
https://searchfox.org/comm-central/rev/3914da07fe3c2421eefb483e6f32dd4772f7bc7f/mail/base/content/msgMail3PaneWindow.js#1353-1354

Hey John, can you attach your patch here, so that I can review it?

Hey John, can you attach your patch here, so that I can review it?

Oh, yes, of course. Attached via phabricator.

r=BenB

I checked back:

  1. At our extension load time, we only need the calendar components module loaded, because we subclass a calendar class (CalCalendarClassSomething), but we don't initialize it at this time.
  2. The calendar load in TB inits the calendar UI
  3. We instantiate the calendar class and access calendar APIs only after we log in, i.e. much later.

So, it should be fine for us. Thanks, John!

Attachment #9278367 - Attachment is obsolete: true
Attachment #9278367 - Flags: review?(john)
Target Milestone: --- → 102 Branch
Assignee: ben.bucksch → john

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/10f63768f0b7
Move extensions-late-startup from mail-tabs-session-restored to mail-delayed-startup-finished to better match m-c. r=BenB

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: