Working in a separate thread?

Hi *,

In the extension I develop, there is an heavy process which may freeze Firefox for several seconds. In order to avoid that, I’d like to make it work in a separate thread.

ChromeWorkers are said to be a non-standard feature (the behavior may change in the future), PromiseWorkers are apparently a derivative of ChromeWorkers. There is also Web Workers (can it be used in an addon?). Content workers run in the same thread…

At the moment, using a PromiseWorker is probably the way to go, but with the landing of Electrolysis in Firefox and the warning that it might change the addons behavior, I’m wondering what to do.

What is the best practice for now? and for the future?

That warning of “non-standard” is for web developers. For add-on devleopers it is a highly recommended thing. Use it without fear! PromiseWorker is built on top of ChromeWorker.

1 Like

Addons are a non-standard feature :slight_smile:

1 Like

There is a lot of warnings about the deprecation of features with the coming of WebExtensions and Electrolysis.

Asking is easy, rewriting code to comply to API modifications is boring. :sweat_smile: