Closed Bug 1667276 (backgroundtasks) Opened 8 months ago Closed 4 months ago

Add a Gecko background task mode and `--backgroundtask` flag to allow running short-lived processes that perform maintenance

Categories

(Toolkit :: Application Update, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

References

(Depends on 1 open bug, Blocks 3 open bugs)

Details

Attachments

(6 files, 9 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

This is a ticket for experimentation. We'd like to support something like firefox --backgroundtask update that would pump the UpdateService loop from the command line. Here's a place to hang work in progress.

Obvious TODOs:

  • Use the static BackgroundTasks class rather than hardcoding the
    changes to the manifest parser and to the static component
    registration, so that regular Firefox still works.

  • Make the static component registration futzing data driven.

Depends on D91372

Depends on D94209

Attached file Bug 1667276 - Actually check for updates. (obsolete) —

Depends on D94210

Adds a couple of useful APIs for background tasks. The main one is for safely
locking the profile so that data can be extracted and then unlocking it. A
second API allows for parsing the prefs file from the profile.

Attached file Bug 1667276: Disable various caches. (obsolete) —

Depends on D95200

Depends on: 1675329
Depends on: 1675332

Depends on D91373

No longer depends on: 1675329
Depends on: 1675848
Blocks: 1679440
Blocks: 1679443

This establishes a high water mark for code loaded (even after a short
delay) by a background task that does nothing.

Code loaded here means:

  1. Chrome JSMs imported using ChromeUtils.import;

  2. XPCOM services, generally long-lived, loaded using do_getService
    or Services.* or an equivalent;

  3. XPCOM components defined in JavaScript and loaded via
    chrome.manifest entries.

At this time background tasks do not load any of category 3. The
distinction is made because they are reported separately by Gecko.

Depends on D97512

Attachment #9186075 - Attachment is obsolete: true
Attachment #9182781 - Attachment is obsolete: true
Attachment #9182783 - Attachment is obsolete: true
Attachment #9182784 - Attachment is obsolete: true
Attachment #9177785 - Attachment is obsolete: true

Comment on attachment 9184605 [details]
Bug 1667276: Disable persistent cookie storage when running background tasks.

Revision D95200 was moved to bug 1675829. Setting attachment 9184605 [details] to obsolete.

Attachment #9184605 - Attachment is obsolete: true
Attachment #9184603 - Attachment description: Bug 1667276: Disable the startup cache when running a background task. → Bug 1667276 - Pre: Disable the startup cache when running a background task. r?sg!
Attachment #9188713 - Attachment description: Bug 1667276 - Disable extension manager in background tasks mode. r?Mossop → Bug 1667276 - Pre: Disable extension manager in background tasks mode. r?Mossop
Attachment #9188714 - Attachment description: Bug 1667276 - Load a custom prefs file when running a background task. r?Mossop → Bug 1667276 - Part 3: Load a custom prefs file when running a background task. r?Mossop!,KrisWright!
Attachment #9190050 - Attachment description: Bug 1667276 - Add test limiting the XPCOM graph of the no-op wait background task. r?Mossop → Bug 1667276 - Post: Add test limiting the XPCOM graph of the no-op wait background task. r?Mossop
Blocks: 1682069
Depends on: 1686344
Blocks: 1686997
Blocks: 1687009
Blocks: 1687777
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ab6f830f6e75
Pre: Disable the startup cache when running a background task. r=dthayer
https://hg.mozilla.org/integration/autoland/rev/74580a0f2633
Pre: Disable extension manager in background tasks mode. r=mossop
https://hg.mozilla.org/integration/autoland/rev/cf52687c4433
Part 1: Wire background task mode into Gecko startup. r=mossop
https://hg.mozilla.org/integration/autoland/rev/60c2f2dbc676
Part 2: Add BackgroundTasksManager to invoke task defined in JS. r=mossop
https://hg.mozilla.org/integration/autoland/rev/38c20196aabc
Part 3: Load a custom prefs file when running a background task. r=mossop,KrisWright
https://hg.mozilla.org/integration/autoland/rev/f970ef0897cd
Post: Add test limiting the XPCOM graph of the no-op wait background task. r=mossop

Backed out for causing browser_all_files_referenced.js failures.

backout: https://hg.mozilla.org/integration/autoland/rev/06ee1ff0214b90a8b2689141d33e9d756b2351ae

push: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&test_paths=browser%2Fbase%2Fcontent%2Ftest%2Fstatic%2Fbrowser.ini&revision=f1a65c9b3ca29e352a6fa427ec811b816bf328c2&selectedTaskRun=aVIAbSqGSQ2qYD8IKfWdUQ.1

failure log: https://treeherder.mozilla.org/logviewer?job_id=327785851&repo=autoland&lineNumber=2582

[task 2021-01-26T03:44:56.643Z] 03:44:56 INFO - indirectly whitelisted file: chrome://fxr/content/prefs.js used from chrome://fxr/content/prefs.html
[task 2021-01-26T03:44:56.644Z] 03:44:56 INFO - Buffered messages finished
[task 2021-01-26T03:44:56.648Z] 03:44:56 INFO - TEST-UNEXPECTED-FAIL | browser/base/content/test/static/browser_all_files_referenced.js | there should be no unreferenced files - Got 4, expected +0
[task 2021-01-26T03:44:56.648Z] 03:44:56 INFO - Stack trace:
[task 2021-01-26T03:44:56.648Z] 03:44:56 INFO - chrome://mochikit/content/browser-test.js:test_is:1351
[task 2021-01-26T03:44:56.649Z] 03:44:56 INFO - chrome://mochitests/content/browser/browser/base/content/test/static/browser_all_files_referenced.js:checkAllTheFiles:948
[task 2021-01-26T03:44:56.649Z] 03:44:56 INFO - Not taking screenshot here: see the one that was previously logged
[task 2021-01-26T03:44:56.650Z] 03:44:56 INFO - TEST-UNEXPECTED-FAIL | browser/base/content/test/static/browser_all_files_referenced.js | unreferenced file: resource://gre/defaults/backgroundtasks/backgroundtasks.js -
[task 2021-01-26T03:44:56.650Z] 03:44:56 INFO - Stack trace:
[task 2021-01-26T03:44:56.651Z] 03:44:56 INFO - chrome://mochikit/content/browser-test.js:test_ok:1323
[task 2021-01-26T03:44:56.651Z] 03:44:56 INFO - chrome://mochitests/content/browser/browser/base/content/test/static/browser_all_files_referenced.js:checkAllTheFiles:952
[task 2021-01-26T03:44:56.652Z] 03:44:56 INFO - Not taking screenshot here: see the one that was previously logged

Also failing: https://treeherder.mozilla.org/logviewer?job_id=327785366&repo=autoland&lineNumber=5074

Flags: needinfo?(nalexander)
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c673fff5bd85
Pre: Disable the startup cache when running a background task. r=dthayer
https://hg.mozilla.org/integration/autoland/rev/1dcb2d1be264
Pre: Disable extension manager in background tasks mode. r=mossop
https://hg.mozilla.org/integration/autoland/rev/62488ec634f9
Part 1: Wire background task mode into Gecko startup. r=mossop
https://hg.mozilla.org/integration/autoland/rev/8d6f10d83c6b
Part 2: Add BackgroundTasksManager to invoke task defined in JS. r=mossop
https://hg.mozilla.org/integration/autoland/rev/1c8d51d2c90f
Part 3: Load a custom prefs file when running a background task. r=mossop,KrisWright
https://hg.mozilla.org/integration/autoland/rev/9ab334e527a5
Post: Add test limiting the XPCOM graph of the no-op wait background task. r=mossop
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/68c50add73aa
Pre: Disable the startup cache when running a background task. r=dthayer
https://hg.mozilla.org/integration/autoland/rev/09db6a973d97
Pre: Disable extension manager in background tasks mode. r=mossop
https://hg.mozilla.org/integration/autoland/rev/b238efac91b4
Part 1: Wire background task mode into Gecko startup. r=mossop
https://hg.mozilla.org/integration/autoland/rev/14441979c730
Part 2: Add BackgroundTasksManager to invoke task defined in JS. r=mossop
https://hg.mozilla.org/integration/autoland/rev/73f56e24b72c
Part 3: Load a custom prefs file when running a background task. r=mossop,KrisWright
https://hg.mozilla.org/integration/autoland/rev/0e0e6bbf6f79
Post: Add test limiting the XPCOM graph of the no-op wait background task. r=mossop

Updating the ticket title to be more representative of what we've actually landed.

Flags: needinfo?(nalexander)
Summary: Experiment with a Gecko "backgroundtask" mode to allow running UpdateService.jsm at the command line → Add a Gecko background task mode and `--backgroundtask` flag to allow running short-lived processes that perform maintenance
Attachment #9184358 - Attachment is obsolete: true
Attachment #9184606 - Attachment is obsolete: true
Attachment #9184604 - Attachment is obsolete: true
Blocks: 1689481
Alias: backgroundtasks
Regressions: 1689562
Blocks: 1694515
Blocks: 1695754
Blocks: 1695797
See Also: → 1700192
Regressions: 1700850
You need to log in before you can comment on or make changes to this bug.