Closed Bug 1552981 Opened 5 years ago Closed 5 years ago

WebExtension with type="bootstrap" doesn't load after a restart

Categories

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

defect
Not set
normal

Tracking

(thunderbird68?)

RESOLVED WONTFIX
Tracking Status
thunderbird68 ? ---

People

(Reporter: standard8, Assigned: darktrojan)

References

(Regression)

Details

(Keywords: regression)

In the latest nightly I converted my add-on from install.rdf to manifest.json due to the changes in bug 1552634.

I installed a new version of the add-on into the latest Daily and it worked fine.

When I restarted, the add-on did not run. On the browser console was a message:

Error: Cannot find loader for bootstrap XPIProvider.jsm:1805:15

I don't think this is due to my add-on, since that installs fine when Daily is already running.

That's … odd. It's looking for something to parse an install.rdf. A caching problem, perhaps?

I guess that could have been referring to something old.

However, I am still seeing issues, and I can now see where the issue is. In startup() in bootstrap.js my add-on is doing this:

Services.obs.addObserver({
  observer() {
    // do some initialisation
  }
}, "final-ui-startup");

That observer now never gets fired, which seems to be a breaking change.

Based on the mailing list I tried changing to mail-startup-done.

When I did this, I dragged and dropped my updated extension to the add-ons manager and restarted Daily. At this stage the mail-startup-done observer did not fire.

I tried with adding various console debug and installing the extension in the same way, and the new debug wouldn't fire. Eventually, I removed the add-on completely, restarted, and installed again. After a restart it all worked fine.

After more testing, and some removal of the console debug I got into the same state again - mail-startup-done wouldn't fire. Uninstalling & re-installing would fix it again.

I've tried it again a few times, but now I'm in the state where whatever I do it seems to work fine.

This still has me concerned though, as could there now be a timing issue, and we're not guaranteed to see that notification? We need this to ensure that we set up everything correctly in the window when we start up.

Version: unspecified → 68

We need this to ensure that we set up everything correctly in the window when we start up.

If you're doing things with a window you should be checking if the load event has already fired (document.readyState == "complete"), or otherwise, listening for the load event. Using observers for that job is not really a good practice.

Unfortunately load isn't likely to be good enough. It'll likely fire before the rest of the UI startup is done, which a) could affect performance, b) could mean the UI isn't actually in a setup state where we can attach everything an insert columns etc.

I could try it, but I do think that at the moment this change is unexpected and undocumented and hence could affect a few add-ons.

Severity: blocker → normal
Assignee: nobody → geoff

I've updated https://developer.thunderbird.net/add-ons/tb68/bootstrapped#possible-timing-issues, which was already there but I made a few changes. There's not really a lot we can do other than making sure what we document is accurate, so I'm WONTFIXing this (for want of a better resolution).

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