Commit Graph

144 Commits

Author SHA1 Message Date
Tooru Fujisawa
a4b321722f Bug 1608282 - Part 3: Remove Cu.importGlobalProperties from JSM. r=extension-reviewers,kmag
Depends on D149195

Differential Revision: https://phabricator.services.mozilla.com/D149196
2022-06-15 20:34:35 +00:00
criss
c1b045ddda Backed out 9 changesets (bug 1772006) causing build bustages on nsTString.cpp. CLOSED TREE
Backed out changeset f17c7565707b (bug 1772006)
Backed out changeset c725fe1f5882 (bug 1772006)
Backed out changeset d19663161261 (bug 1772006)
Backed out changeset b6611ab002d9 (bug 1772006)
Backed out changeset 790f42b64af9 (bug 1772006)
Backed out changeset 79a734b4e4d9 (bug 1772006)
Backed out changeset 42730aae16ea (bug 1772006)
Backed out changeset b2542aef3054 (bug 1772006)
Backed out changeset 962bfea4a309 (bug 1772006)
2022-06-11 01:13:42 +03:00
Nika Layzell
fe77bb85a8 Bug 1772006 - Part 5: Simplify and move the string comparison APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,dragana,barret
In addition to moving these methods to a more appropriate file, they were
simplified to make them easier to maintain in the future.
nsTStringRepr::Compare was extended to also work on char16_t strings, and the
case insensitive and other options were removed as they aren't necessary. This
required some changes to callers in the tree.

The EqualsIgnoreCase method was also simplified by using `std::string_view`.

Differential Revision: https://phabricator.services.mozilla.com/D148299
2022-06-10 21:12:07 +00:00
Tooru Fujisawa
1392c9b1f6 Bug 1772101 - Part 4: Use plain object for lazy getter in toolkit/components/backgroundtasks/. r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D147944
2022-06-07 04:30:55 +00:00
Kirk Steuber
945e5927c1 Bug 1772183 - Set Background Task code metadata to the new Background Tasks component r=bhearsum
Differential Revision: https://phabricator.services.mozilla.com/D148037
2022-06-01 19:36:17 +00:00
Chris Martin
7f062b4b16 Bug 1769807 - Ensure Win32k state initialized before content launch. r=nalexander
Win32k Lockdown state must be initialized on the main thread, but currently
a process launcher may be the first thing to read it on the IPC Thread

Initializing Win32k Lockdown state also relies on the gfxPlatform being
initialized, but that also isn't explicit anywhere.

This patch ensures both things are true: Always ensure that Win32k State is
initialized before queuing a process launch to the IPC Thread, and always
ensure that gfxPlatform is initialized before attempting to read the
gfx state.

Differential Revision: https://phabricator.services.mozilla.com/D146821
2022-05-20 20:55:05 +00:00
Cristian Tuns
f043eddc84 Backed out changeset 9dc2f0c648e4 (bug 1769807) for causing mochitest failures on browser_xpcom_graph_wait.js CLOSED TREE 2022-05-20 14:01:26 -04:00
Chris Martin
990cdac9ef Bug 1769807 - Ensure Win32k state initialized before content launch r=bobowen,nalexander
Win32k Lockdown state must be initialized on the main thread, but currently
a process launcher may be the first thing to read it on the IPC Thread

Initializing Win32k Lockdown state also relies on the gfxPlatform being
initialized, but that also isn't explicit anywhere.

This patch ensures both things are true: Always ensure that Win32k State is
initialized before queuing a process launch to the IPC Thread, and always
ensure that gfxPlatform is initialized before attempting to read the
gfx state.

Differential Revision: https://phabricator.services.mozilla.com/D146821
2022-05-20 17:12:36 +00:00
Nick Alexander
f35db8eba8 Bug 1765628 - Test that launching many background tasks concurrently succeeds. r=nrishel
This verifies that stale temporary profile purging does not interfere
with concurrent temporary profile creation and locking.

Depends on D144775

Differential Revision: https://phabricator.services.mozilla.com/D144328
2022-05-04 18:21:07 +00:00
Nicholas Rishel
42bce43c49 Bug 1765628 - Don't delete recently created temporary profiles to avoid race between background task cleanup and background task profile locking. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D144775
2022-05-04 18:21:07 +00:00
Emilio Cobos Álvarez
f5ab38ff0b Bug 1757604 - Make content-type on JAR channels behave the same as HTTP channels. r=Gijs
That is, treat it as a hint if called before open, and as an override if
called after. Override the hint on open.

This is a less invasive change that is green on try and also fixes the
issue.

Differential Revision: https://phabricator.services.mozilla.com/D145098
2022-04-30 01:24:47 +00:00
Frederik Braun
81746167b1 Bug 1577122 - mozJSComponentLoader::Import() should only work for internal URLs, and update some tests r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D140058
2022-04-06 14:36:47 +00:00
Nick Alexander
dbbde84b58 Bug 1722777 - Test. r=bytesized
Depends on D140429

Differential Revision: https://phabricator.services.mozilla.com/D141069
2022-03-22 00:28:23 +00:00
Nicholas Rishel
777b32482d Bug 1722777 - Incrementally remove stale temporary profiles from background tasks which match the name of the current background task profile (before adding unique identifier). r=nalexander,mossop
Depends on D140911

Differential Revision: https://phabricator.services.mozilla.com/D140429
2022-03-22 00:28:23 +00:00
Butkovits Atila
54be2abb66 Backed out changeset 5fc643cc5b17 (bug 1722777) for causing xpcshell failures. CLOSED TREE 2022-03-19 01:47:01 +02:00
Butkovits Atila
2607cf3f6e Backed out 5 changesets (bug 1722777) for causing xpcshell failures.
Backed out changeset 8ea40ee4caf0 (bug 1722777)
Backed out changeset 00fa6e16e916 (bug 1722777)
Backed out changeset b90cab865ce4 (bug 1722777)
Backed out changeset a8344f5044e6 (bug 1722777)
Backed out changeset 51a7df84c674 (bug 1722777)
2022-03-18 23:39:56 +02:00
Nicholas Rishel
58f4570e92 Bug 1757252 - Intialize NSS in "no DB" mode for background tasks. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D141305
2022-03-18 20:14:47 +00:00
Nicholas Rishel
c06a797c92 Bug 1757435 - Disable fast shutdown for background tasks. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D141304
2022-03-18 20:14:47 +00:00
Nick Alexander
ab166841a5 Bug 1722777 - Test. r=nrishel,bytesized
Differential Revision: https://phabricator.services.mozilla.com/D141069
2022-03-18 20:13:04 +00:00
Nicholas Rishel
b6ea0c4251 Bug 1722777 - Incrementally remove stale temporary profiles from background tasks which match the name of the current background task profile (before adding unique identifier). r=nalexander,mossop
Differential Revision: https://phabricator.services.mozilla.com/D140429
2022-03-18 17:15:33 +00:00
Nick Alexander
c74dc57bf2 Bug 1675829 - Post: Make background tasks not persist cookie database. r=bytesized
Differential Revision: https://phabricator.services.mozilla.com/D140863
2022-03-18 04:20:03 +00:00
Nick Alexander
f24cb48487 Bug 1757229 - Ensure Telemetry::CanRecordExtended() is false in background tasks. r=janerik
Differential Revision: https://phabricator.services.mozilla.com/D141291
2022-03-17 15:45:56 +00:00
Nick Alexander
201953d2d2 Bug 1679443 - Add test ensuring profiles created by background tasks are (and remain) "slim". r=bytesized
There are a few ways that we could test this.  We could use the
profiler and "File IO" markers, a la
https://searchfox.org/mozilla-central/source/browser/base/content/test/performance/browser_startup_content_mainthreadio.js.
This would profile content that is transient, which could be good or
bad -- temporary files for atomic writes would show up for example.
But in fact there are profile contents created after the profiler is
shut down (including `Telemetry.ShutdownTime.txt`), so this approach
isn't sufficient.

Therefore we do the simpler thing: we simply don't remove the
temporary profile directory after the background task exits.

Differential Revision: https://phabricator.services.mozilla.com/D139909
2022-03-16 17:18:45 +00:00
Mark Banner
7ea3c792f2 Bug 1758474 - Implement an ESLint rule to disallow passing {} as the target parameter for ChromeUtils.import. r=Gijs,mossop,perftest-reviewers,preferences-reviewers,sparky
Differential Revision: https://phabricator.services.mozilla.com/D140517
2022-03-11 16:41:29 +00:00
smolnar
19781d16c7 Backed out changeset 5018856d8fee (bug 1758474) for causing node eslint failure. CLOSED TREE 2022-03-10 11:58:45 +02:00
Mark Banner
de1754318e Bug 1758474 - Implement an ESLint rule to disallow passing {} as the target parameter for ChromeUtils.import. r=Gijs,mossop,perftest-reviewers,preferences-reviewers,sparky
Differential Revision: https://phabricator.services.mozilla.com/D140517
2022-03-10 09:25:28 +00:00
Nick Alexander
5c6479a485 Bug 1686344 - Add test for --backgroundtask --jsdebugger --wait-for-jsdebugger. r=devtools-reviewers,jdescottes
This version is as simple as I can make it.  It simply expects the JS
debugger to stop on the breakpoint added automatically by the
backgroundtask debugger command line processing (using
`setBreakpointOnLoad`) and disconnects, expecting the task to continue
execution and exit with exit code 0.

In the future, we'd like to interact with the task environment, for example to:

1. stop on the automatic breakpoint
2. continue
3. stop on a `debugger;`
4. set the task's exit code from a failure code to exit code 0
5. continue
6. verifies the tasks's exit code is 0.

Sadly my attempts to do this fail intermittently in automation.

Differential Revision: https://phabricator.services.mozilla.com/D139156
2022-03-03 03:38:40 +00:00
Nick Alexander
5e08f60944 Bug 1686344 - Support --backgroundtask --jsdebugger (and --wait-for-jsdebugger). r=mossop,jdescottes
Background task mode is roughly equivalent to `xpcshell`, but inside
the regular browser startup flow.  There is no browser window (no
`Window` at all) and there should be no content processes.  It's
sufficient to treat it like `xpcshell`, with its own stripped-down
actor and a few tweaks to the integration points.

The structural changes in this commit keep `--backgroundtask` mode
slim in the regular case when the Devtools are *not* requested.  This
is reflected in the small changes needed to the
`browser_xpcom_graph_wait.js` test: loading the Devtools
unconditionally causes a huge amount of code to be loaded.  In order
to load the Devtools framework conditionally, we check for
Devtools-specific command line flags and delegate to Devtools when
appropriate.  In order to check the command line flags, we turn the
`BackgroundTasksManager` into an XPCOM service, which allows it to be
instantiated by XPCOM in order to handle the command line.

One final note: this leaves two XPCOM components, "backgroundtasks"
and "backgroundtasksmanager".  Why not combine them?  This is
technically possible but not attractive: we really do want a natural
place for native/C++ code ("backgroundtasks") and JavaScript code
("backgroundtasksmanager").

Differential Revision: https://phabricator.services.mozilla.com/D129771
2022-03-03 03:38:39 +00:00
Nicholas Rishel
3b71baadb4 Bug 1756675 - Post: Add logging for BackgroundTask temporary profile setup and teardown. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D139329
2022-02-23 20:35:31 +00:00
Nicholas Rishel
0108a14823 Bug 1756675 - Consolidate BackgroundTask implementation into BackgroundTasks.cpp. r=nalexander
Other cleanup:
* Remove unused headers and replaced with forward declarations where possible.
* Removed redundant `mozilla::` namespacing for individual variables.
* Resolved clang-tidy warnings for unnecessary use of `const` return and suggested use of move semantics.

Differential Revision: https://phabricator.services.mozilla.com/D139328
2022-02-23 20:35:31 +00:00
Nick Alexander
e645204d78 Bug 1753718 - Post: Docs for shutdown background tasks process lifetimes. r=application-update-reviewers,bytesized
Differential Revision: https://phabricator.services.mozilla.com/D138086
2022-02-10 20:12:26 +00:00
Nick Alexander
889b3e087d Bug 1753718 - Add test(s) ensuring that a running background task does not prevent application updates. r=application-update-reviewers,bytesized
Differential Revision: https://phabricator.services.mozilla.com/D138085
2022-02-10 20:12:26 +00:00
Nick Alexander
218907f4b0 Bug 1753718 - Pre: Prefix child process stdout lines with PID>; add stdout line callback. r=bytesized
We may get multiple lines or incomplete lines from the pipe, so we
need to split the data and keep the leftover.  This makes debugging a
little more pleasant and allows for the consumer to react to stdout as
it is read.

Differential Revision: https://phabricator.services.mozilla.com/D138222
2022-02-10 20:12:26 +00:00
Chris Peterson
c0ef096bd3 Bug 1744425 - xre: Use nsID::GeneratorUUIDInPlace() instead of the nsUUIDGenerator service. r=mossop
This change is needed to avoid toolkit/components/backgroundtasks/tests/browser/browser_xpcom_graph_wait.js test failures where the nsUUIDGenerator service was loaded during ASan test runs but not non-ASan test runs (due to differences in temp profile directory paths). With this change, the nsUUIDGenerator service is no longer needed in BackgroundTasks.

Using nsID::GenerateUUIDInPlace() also avoids the overhead of instantiating the nsUUIDGenerator service.

Depends on D136992

Differential Revision: https://phabricator.services.mozilla.com/D136993
2022-02-03 04:39:35 +00:00
Mike Kaply
d3e92e4aab Bug 1745022 - Add better debug information for policies.json r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D133761
2021-12-17 19:11:14 +00:00
Jens Stutte
b837d77418 Bug 1707963: Remove permission manager from browser_xpcom_graph_wait.js. r=mossop
Once we allow lazy initialization for the permission manager, we do not launch it at startup in any kind of process. We thus need to update the allowlist of this test and remove the permission manager and other (networking) modules it started.

Differential Revision: https://phabricator.services.mozilla.com/D133655
2021-12-14 18:39:42 +00:00
Nick Alexander
c41abc5d3f Bug 1737117 - Only process updates only for --backgroundtask backgroundupdate. r=bytesized
The aim is to avoid background tasks causing unexpected updates, as
happened when we tried to migrate `pingsender` to a Gecko background
task in Bug 1734262.  This commit makes it so that we only process
updates for the `backgroundupdate` task (and the test-only
`shouldprocessupdates` task).

Differential Revision: https://phabricator.services.mozilla.com/D133557
2021-12-14 07:00:59 +00:00
Nick Alexander
3c9849fc72 Bug 1737117 - Pre: Add a reason to "should process updates at startup" logic. r=bytesized
I've elected to rename the function from `Should...` to
`ShouldNot...`, but not to rename the various test files.  The
functionality under test is both "should" and "should not", so I think
the churn of renaming is not justified.

This rearranges the deck chairs to accommodate testing the new
functionality in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D133556
2021-12-14 07:00:59 +00:00
Butkovits Atila
1ba2cc1c80 Backed out 2 changesets (bug 1737117) for causing bustages at nsAppRunner.cpp. CLOSED TREE
Backed out changeset b78709bc0d0c (bug 1737117)
Backed out changeset b3be1a6a5e3f (bug 1737117)
2021-12-14 06:30:49 +02:00
Nick Alexander
8aaf80be99 Bug 1737117 - Only process updates only for --backgroundtask backgroundupdate. r=bytesized
The aim is to avoid background tasks causing unexpected updates, as
happened when we tried to migrate `pingsender` to a Gecko background
task in Bug 1734262.  This commit makes it so that we only process
updates for the `backgroundupdate` task (and the test-only
`shouldprocessupdates` task).

Differential Revision: https://phabricator.services.mozilla.com/D133557
2021-12-14 03:44:14 +00:00
Nick Alexander
6f9134c94a Bug 1737117 - Pre: Add a reason to "should process updates at startup" logic. r=bytesized
I've elected to rename the function from `Should...` to
`ShouldNot...`, but not to rename the various test files.  The
functionality under test is both "should" and "should not", so I think
the churn of renaming is not justified.

This rearranges the deck chairs to accommodate testing the new
functionality in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D133556
2021-12-14 03:44:14 +00:00
Bobby Holley
40a91d2109 Bug 1734750 - Stop force-disabling the socket process for background tasks. r=nalexander
This was causing issues in socket-process xpcshell tests for the gecko-based pingsender.

The spi-nw configuration [1] passes `--setpref=network.http.network_access_on_socket_process.enabled=true` to xpcshell tests. The xpcshell harness reads this pref [2] to set self.mozInfo["socketprocess_networking"], and then later uses it to set MOZ_FORCE_USE_SOCKET_PROCESS in the enviroment [3]. However, the backgroundtask machinery also disables the socket process pref on startup [4].

This activates a mismatch between nsIOService::UseSocketProcess, which checks MOZ_FORCE_USE_SOCKET_PROCESS [5], and nsIOService::LaunchSocketProcess, which doesn't [6]. The net result is that necko is inoperable, because part of the system thinks there should be a socket process and part of the system thinks the converse.

We could solve this mismatch by making LaunchSocketProcess check MOZ_FORCE_USE_SOCKET_PROCESS, but that would simply override the attempt to disable the socket process in backgroundtasks.js. According to Nick, disabling the socket process for background tasks was just done to avoid a crash, and that crash appears to be gone. So we just remove that special-casing.

[1] https://searchfox.org/mozilla-central/rev/b847c844adf49013067281d3237e7ada24325a34/taskcluster/gecko_taskgraph/transforms/tests.py#329
[2] https://searchfox.org/mozilla-central/rev/b847c844adf49013067281d3237e7ada24325a34/testing/xpcshell/runxpcshelltests.py#1526
[3] https://searchfox.org/mozilla-central/rev/b847c844adf49013067281d3237e7ada24325a34/testing/xpcshell/runxpcshelltests.py#1198
[4] https://searchfox.org/mozilla-central/rev/b847c844adf49013067281d3237e7ada24325a34/toolkit/components/backgroundtasks/defaults/backgroundtasks.js#8
[5] https://searchfox.org/mozilla-central/rev/b847c844adf49013067281d3237e7ada24325a34/netwerk/base/nsIOService.cpp#583
[6] https://searchfox.org/mozilla-central/rev/b847c844adf49013067281d3237e7ada24325a34/netwerk/base/nsIOService.cpp#505

Differential Revision: https://phabricator.services.mozilla.com/D127906
2021-10-08 23:45:49 +00:00
Valentin Gosu
27c6f80da7 Bug 1732011 - Update backgroundtasks example to include EXPORTED_SYMBOLS r=nalexander DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D126340
2021-09-23 07:41:50 +00:00
Mark Banner
1817e82737 Bug 1602940 - Automated replacements to use Services.uuid. r=Gijs,necko-reviewers,preferences-reviewers,kershaw
Depends on D124391

Differential Revision: https://phabricator.services.mozilla.com/D124392
2021-09-06 09:53:52 +00:00
Kris Maglione
412d136e74 Bug 1716849: Add crash annotation for error when aborting for failed module import. r=mccr8
There are a number of modules that we import from C++ and can't continue
running without. We have a number of crashes for some of those failed loads. A
lot of them are from OOMs or corruption, but we're not sure about the rest.

This patch adds a crash annotation with the details of the error wherever we
abort for failing to load a module.

Differential Revision: https://phabricator.services.mozilla.com/D120290
2021-07-22 16:58:02 +00:00
Butkovits Atila
d3af3666d1 Backed out changeset ef812b3d914d (bug 1716849) for causing assertion failures at nsImportModule.cpp. CLOSED TREE 2021-07-22 06:49:23 +03:00
Kris Maglione
078a3d821a Bug 1716849: Add crash annotation for error when aborting for failed module import. r=mccr8
There are a number of modules that we import from C++ and can't continue
running without. We have a number of crashes for some of those failed loads. A
lot of them are from OOMs or corruption, but we're not sure about the rest.

This patch adds a crash annotation with the details of the error wherever we
abort for failing to load a module.

Differential Revision: https://phabricator.services.mozilla.com/D120290
2021-07-22 01:28:22 +00:00
Youhai Li
c53b73c5dd Bug 1672577 - Removed expired probe NUMBER_OF_PROFILES, r=jaws,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D116735
2021-06-21 14:53:09 +00:00
Kirk Steuber
0ac13e7643 Bug 1708752 - Add testing for background task timeout r=nalexander
Depends on D115399

Differential Revision: https://phabricator.services.mozilla.com/D115524
2021-05-20 17:38:05 +00:00
Kirk Steuber
ce6d4acb3e Bug 1708752 - Allow BackgroundTasksManager to use a timeout to prevent long running tasks r=nalexander,application-update-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D115399
2021-05-20 17:38:04 +00:00