fune/browser/components/newtab
Nick Alexander 6ff82016a0 Bug 1804757 - Avoid shutdown crashes writing targeting.snapshot.json. r=barret
This commit trades away consistency in order to reduce code execution.
Hopefully this avoids executing code that is likely not "shutdown
safe" and is inadvertently restarting services or otherwise hanging
when run during shutdown.

The trade off is that the written targeting snapshot may now be
incomplete (which was always the case in the face of runtime errors,
e.g., corrupt a database) or internally inconsistent (which is
probably new).  For example, weekly usage could be populated but most
frecent sites could be empty, contradicting the usage.  This trade-off
is accepted: occassionally targeting the user "in the
past" (generally, with data captured 30 minutes ago) is preferable to
relatively frequent shutdown crashes.

I would have liked to have checked for `shuttingDown` in
[CachedTargetingGetter](https://searchfox.org/mozilla-central/rev/abf6758ed833c203f84703aa2e3e3d317571b1e9/browser/components/newtab/lib/ASRouterTargeting.jsm#152),
but doing so might throw exceptions (or inject `null` values) where
they were not anticipated, which carries risks that I couldn't easily
mitigate.

If the measure implemented here is ineffective, we'll likely need to
restrict the set of targeting data collected, but I hope to avoid
that, since it reduces the flexibility of the background messaging
targeting significantly, and we may want the agility provided by rich
targeting at an unknown time in the future.

Differential Revision: https://phabricator.services.mozilla.com/D165916
2023-01-10 21:22:46 +00:00
..
aboutwelcome Bug 1805313 - Update Onboarding template to support two CTA buttons r=pdahiya,omc-reviewers 2023-01-06 15:25:33 +00:00
actors Bug 1808202 - Convert newtab DeDupe.jsm, ActorConstants.jsm and Actions.jsm to ES modules and update imports. r=Mardak 2023-01-05 09:58:30 +00:00
bin
common Bug 1808941 - Enable ESLint rules no-restricted-globals and strict for newtab. r=aminomancer 2023-01-07 13:21:41 +00:00
components/CustomElements Backed out 3 changesets (bug 1780074, bug 1780347) for causing multiple failures. CLOSED TREE 2022-07-20 14:57:48 +03:00
content-src Backed out changeset 2dcea9f0eb7e (bug 1768730) for causing python failures. CLOSED TREE 2023-01-10 10:13:31 +02:00
css Bug 1799974 - Pocket newtab fixing loading of page to have less shifting. r=gvn 2022-12-02 00:40:05 +00:00
data/content Bug 1808941 - Enable ESLint rules no-restricted-globals and strict for newtab. r=aminomancer 2023-01-07 13:21:41 +00:00
docs Bug 1795184 - Update syntax highlighting for newtab docs r=aminomancer 2023-01-04 19:23:32 +00:00
lib Bug 1804757 - Avoid shutdown crashes writing targeting.snapshot.json. r=barret 2023-01-10 21:22:46 +00:00
loaders
prerendered
test Bug 1804757 - Avoid shutdown crashes writing targeting.snapshot.json. r=barret 2023-01-10 21:22:46 +00:00
tools Bug 1808202 - Add ES import handling to jsm to commonjs converter. r=Mardak 2023-01-05 09:58:30 +00:00
vendor
.eslintrc.js Bug 1808941 - Remove unnecessary/redundant rule specifications from newtab's ESLint configuration. r=aminomancer 2023-01-07 13:21:41 +00:00
.nvmrc
.sass-lint.yml
AboutNewTabService.jsm Bug 1792341 - Migrate more toolkit/modules consumers to use direct ES module import. r=Gijs,webdriver-reviewers,perftest-reviewers,necko-reviewers,geckoview-reviewers,preferences-reviewers,application-update-reviewers,pip-reviewers,credential-management-reviewers,sgalich,owlish,bytesized,AlexandruIonescu,whimboo,mconley,mixedpuppy 2022-10-18 11:21:26 +00:00
components.conf Backed out 3 changesets (bug 1780074, bug 1780347) for causing multiple failures. CLOSED TREE 2022-07-20 14:57:48 +03:00
jar.mn Bug 1776514 - Allow background tasks to enable Nimbus and Firefox Messaging System. r=barret,bytesized 2022-07-22 04:42:13 +00:00
karma.mc.config.js Bug 1808202 - Add babel-plugin-jsm-to-commonjs directly into the tree rather than importing. r=Mardak 2023-01-05 09:58:29 +00:00
metrics.yaml Bug 1786670 Renew newtab metrics r=chutten DONTBUILD 2022-09-12 21:02:32 +00:00
moz.build Bug 1775849 - Import messages from messaging-system-inflight-assets as test cases for schema validation r=dmose 2022-12-15 01:52:09 +00:00
nsIAboutNewTabService.idl
package-lock.json Bug 1808202 - Add babel-plugin-jsm-to-commonjs directly into the tree rather than importing. r=Mardak 2023-01-05 09:58:29 +00:00
package.json Bug 1808202 - Add babel-plugin-jsm-to-commonjs directly into the tree rather than importing. r=Mardak 2023-01-05 09:58:29 +00:00
pings.yaml Bug 1802207 - Wait to send component_init-reason "newtab" ping until newtab has been categorized r=nanj 2022-11-24 17:59:21 +00:00
webpack.aboutwelcome.config.js
webpack.system-addon.config.js Bug 1808202 - Add babel-plugin-jsm-to-commonjs directly into the tree rather than importing. r=Mardak 2023-01-05 09:58:29 +00:00
yamscripts.yml