Thunderbird just became a multi-process application

40 views
Skip to first unread message

Geoff Lankow

unread,
Jan 20, 2021, 4:55:22 AMJan 20
to Thunderbird planning

I am pleased to announce that, unless something crazy happens, the next Daily will use more than one process. This builds on the work to make Firefox multi-process capable (AKA the Electrolysis project) and is the result of my work over the last few months.

Don't get too excited… this is more about enabling potential improvements in the future than noticeable improvements now.

What has actually changed?

  • When Thunderbird loads a web page in the message pane (such as the home page), or in a tab, or in a window, that will be done by a secondary "child" process, not the main Thunderbird process as was previously the case.
  • Transitioning from a web page to a message, or vice versa, has become more complicated, but this is handled automatically.
  • Extensions are now loaded in child processes.

What does this mean for me?

End-users:

Users should not notice any changes. This change is entirely in the background and shouldn't make any difference to what the user interface does.

Developers:

This won't affect most of what developers are working on. However if you need to do something with the contents of a web page, your life just became more complicated. You'll need to reach across the process boundary, probably using actors. This may seem complicated compared to using contentDocument etc. but is pretty easy once you get the hang of it. The Firefox docs have some good information or you can ask me for help.

The same applies to tests looking at the content of web pages. In most cases, SpecialPowers.spawn will be all you need.

When loading or changing URLs in a <browser> element, please use MailE10SUtils.loadURI. This will handle the transition between parent and child processes, if necessary.

One other thing to note is that the "content" tab type has changed. Where once you would open a content tab and specify how clicks on links in that tab should behave, this now happens automatically. By default links to URLs on the same website will open in Thunderbird and all others in an external browser, but you can make this more restrictive (only URLs on the same page) or less restrictive (any URLs). See the JSDoc on specialTabs.contentTabType.openTab for details.

Extension developers:

You might notice some changes, depending on what your extension does.

  • If it's wholly a WebExtension (no experiments) it should just work as before.
  • Experiments run in the main "parent" process, just like they did before. Most things should continue working, unless you're reaching into web pages (which you shouldn't need to because the tabs.executeScript function and friends exist).
  • If you open tabs using an experiment you should read about the changes above. And probably think about moving to tabs.create.

When will this happen?

I've just landed the changes. They'll be in the next Daily build. Unless something serious happens, I expect they will be in 86 beta 1 next week, and then in 2021's ESR.

Can I turn it off?

If you must, yes, technically it will be possible to return to using a single process. However, it's not possible to run our automated testing on both single-process and multi-process Thunderbird at the same time, so the default will be multi-process.

The preferences to change are browser.tabs.remote.autostart and extensions.webextensions.remote. Set them to false to go back to single-process.

What will happen in the future?

While the changes I've made today don't do a lot, it does bring us a lot closer to what Firefox does so we can take advantage of what they have been working on for the last few years. (It also means there should be fewer problems caused by the differences between our code and theirs.)

I haven't really looked into what could now be possible, but theoretically it should allow us to move things out of the main process for performance and security advantages. For example, loading network calendars or CardDAV address books should be possible in a child process. Potentially we could move mail operations to another process (don't hold your breath).

What should I do if I find a bug?

Report bugs as per usual, and if you're convinced today's changes are the cause, mark as regressed by bug 1646648. If you're not convinced of the cause but suspicious, CC/NI me and ask.

GL

Magnus Melin

unread,
Jan 20, 2021, 5:54:19 AMJan 20
to tb-pl...@mozilla.org

Congrats to pulling through this first step! I do think some excitement is in order, even if the capabilities can't be used full out just yet :)

 -Magnus

_______________________________________________
tb-planning mailing list
tb-pl...@mozilla.org
https://mail.mozilla.org/listinfo/tb-planning

Matt Harris

unread,
Jan 20, 2021, 7:43:42 AMJan 20
to tb-pl...@mozilla.org
Well I am a little excited.
“Against stupidity the gods themselves contend in vain.” ― Friedrich von Schiller, Die Jungfrau von Orleans
Reply all
Reply to author
Forward
0 new messages