Open Bug 1808316 Opened 2 years ago Updated 2 years ago

Background tasks should not spawn other background tasks unintentionally

Categories

(Toolkit :: Background Tasks, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: valentin, Unassigned)

References

Details

In bug 1806831 we discovered that a policy was setting a pref for all Firefox instances on that machine. Depending on the value of the pref (which we didn't expect to be set in the profile for the background task) we would spawn a background task to clean up the cache, but because the pref was also set for the background task instance, we would keep doing that endlessly.

If background tasks is to be used in more scenarios we should have a mechanism to prevent background tasks from spawning other background tasks. Of course, if there is a case where that's desirable the task should do so explicitly. The default should be that "background tasks can't spawn other background tasks"

I think this is sensible. A few thoughts.

  1. Background tasks have the regular Firefox preferences, plus an additional set of overrides, but this is not clearly documented in https://firefox-source-docs.mozilla.org/toolkit/components/backgroundtasks/index.html#most-background-tasks-run-in-ephemeral-temporary-profiles. Part of this ticket should make this clear, like:

Background tasks have regular Gecko/Firefox preferences, plus specific overrides

At startup when in background task mode, the preference service loads the regular Gecko/Firefox preferences, and then loads background task specific preferences from defaults/backgroundtasks/*.js. Gecko-specific preferences are loaded from backgroundtasks.js and Firefox-specific preferences from backgroundtasks_browser.js. See mozilla::Preferences::InitInitialObjects for details.

It would be possible to set the pref specifically for background tasks to avoid this recursion.

  1. I would like the "launch background task helper" to take care of this detail in runInDetachedProcess.
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.