Commit Graph
216 Commits
Author SHA1 Message Date
edgul 0f92a57295 Bug 1819147 - Fixed clearOriginAttributes not clearing all cache entries specificed with userContext r=valentin,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D213368
2024-06-13 21:44:51 +00:00
Kershaw Chang b1346aabfe Bug 1893075 - Refactor CacheFileIOManager::Write, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D208739
2024-05-03 07:50:38 +00:00
Valentin Gosu e006d83f5e Bug 1854621 - Remove unused NETWORK_CACHE_SIZE_FULL_FAT r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D201068
2024-02-12 13:49:33 +00:00
Valentin Gosu bfbf0fb7ed Bug 1848542 - Add telemetry for residual cache folder removal or failure r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D194076
2023-11-21 17:29:08 +00:00
Valentin Gosu 0e41566d01 Bug 1848542 - Do a cache cleanup when cache purging is enabled r=necko-reviewers,kershaw
It seems that sometimes the cache purge task may fail to remove the
cache folder. When that happens, we might end up with multiple cache
folders in the profile folder. Since the task is unable to remove it,
we should remove the folders on a background thread (check once a day)

Differential Revision: https://phabricator.services.mozilla.com/D194051
2023-11-21 17:29:08 +00:00
Valentin Gosu 83def1272f Bug 1827504 - Remove last files of netwerk/cache/ r=sunil,geckoview-reviewers,zeid,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D175177
2023-04-13 09:04:24 +00:00
Kagami Sascha Rosylight b3dfe5002f Bug 1788986 - Part 5: Add Glean metrics for _removeDirectory r=janv,valentin,necko-reviewers,chutten,nalexander,smaug
Differential Revision: https://phabricator.services.mozilla.com/D156941
2023-02-06 11:32:49 +00:00
Iulian Moraru 968971693d Backed out 3 changesets (bug 1788986) for causing xpcshell failures on test_backgroundtask_removeDirectory.js. CLOSED TREE
Backed out changeset d288a5d5cc3d (bug 1788986)
Backed out changeset 7f30102942bc (bug 1788986)
Backed out changeset 8c8026379e91 (bug 1788986)
2023-02-02 20:58:26 +02:00
Kagami Sascha Rosylight c3a224c6e2 Bug 1788986 - Part 5: Add Glean metrics for _removeDirectory r=janv,valentin,necko-reviewers,chutten,nalexander,smaug
Differential Revision: https://phabricator.services.mozilla.com/D156941
2023-02-02 15:23:47 +00:00
Valentin Gosu acdd3f38a9 Bug 1805535 - Add null check to avoid crash in CacheFileIOManager::SyncRemoveDir r=necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D166571
2023-01-12 08:05:44 +00:00
Valentin Gosu 350eb9d9ff Bug 1806831 - removeDirectory background tasks keep spawning if the policy is set to clear the cache on shutdown r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D165854
2023-01-04 07:29:36 +00:00
Noemi Erli 17bf1e36fe Backed out changeset 837b1f1e4939 (bug 1806831) for causing background related failures CLOSED TREE 2023-01-03 15:17:35 +02:00
Valentin Gosu 3deb06d96d Bug 1806831 - removeDirectory background tasks keep spawning if the policy is set to clear the cache on shutdown r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D165854
2023-01-03 11:45:23 +00:00
Valentin Gosu 39932a3e8d Bug 1787927 - Don't dispatch http purge background task if sanitizeOnShutdown pref not set r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D163080
2022-11-28 12:55:14 +00:00
Kagami Sascha Rosylight 4c820e2e6b Bug 1788986 - Part 1: Convert BackgroundTasksRunner as an XPCOM component r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D160674
2022-11-25 19:50:29 +00:00
Mathew Hodson 9054de0a6c Bug 1801020 - Fix build failure with --disable-backgroundtasks. r=valentin,necko-reviewers,nalexander,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D162257
2022-11-18 13:05:56 +00:00
Valentin Gosu 3e9e42cb99 Bug 1786256 - Let network.cache.shutdown_purge_in_background_task=true ride the trains r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D162190
2022-11-16 12:36:16 +00:00
Kagami Sascha Rosylight d9d87c2afa Bug 1791675 - Part 4: Make sure purgeHTTPCache runs after shutdown r=webdriver-reviewers,necko-reviewers,valentin,nalexander,whimboo
This adds BackgroundTasksRunner utility class as a generic way to properly run background tasks. A few argument for not extending existing BackgroundTasksUtils:

1. Simply because the existing use case is in C++.
2. I have another use case from JSM and thus I'll ultimately convert this an XPCOM component. And `CacheFileIOManager::DispatchPurgeTask` cannot get a JSM-written XPCOM instance which is required to be main-thread only.

Depends on D157998

Differential Revision: https://phabricator.services.mozilla.com/D157757
2022-11-08 15:42:24 +00:00
Valentin Gosu 86ebb94749 Bug 1794376 - Use SpinEventLoopUntil to await for CacheFileIOManager shutdown r=jstutte,edgul
Differential Revision: https://phabricator.services.mozilla.com/D159845
2022-10-28 12:36:47 +00:00
Kagami Sascha Rosylight 313e7c6f5e Bug 1796085 - Part 2: Rename _purgeHTTPCache as _removeDirectory r=valentin,necko-reviewers
This background task currently is generic enough that it can be reused for other components, namely QuotaCleaner in the child patches. Renaming makes it clear that it's generic.

Differential Revision: https://phabricator.services.mozilla.com/D156912
2022-10-19 12:04:09 +00:00
Manuel Bucher d8f937616b Bug 1787729 - Move NS_HasRootDomain, CheckForBrokenChromeURL, IsCoepCredentiallessEnabled to mozilla::net namespace r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D155992
2022-08-31 11:19:14 +00:00
Valentin Gosu d2deb818a0 Bug 1785018 - Avoid data race when calling GetParent for nsLocalFileUnix r=necko-reviewers,kershaw
We avoid the race by cloning the file before calling GetParent, to avoid
writing to mCacheDirectory's buffer on the main thread during shutdown,
when called from SyncRemoveAllCacheFiles.

Additionally, we dispatch OnDelayedStartupFinished to the IO thread
to avoid accessing mCacheDirectory on the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D155798
2022-08-31 09:59:32 +00:00
Valentin Gosu 3bb8425e41 Bug 1705676 - Purge HTTP disk cache using backgroundtasks (out-of-process) r=nalexander,necko-reviewers,dragana
Purge HTTP disk cache using backgroundtasks

Motivation:

In the History settings preferences panel you may choose to
`Clear History when Firefox closes` - which sets the
`privacy.sanitize.sanitizeOnShutdown` pref.
If the `Cache` checkbox is also checked it sets the
`privacy.clearOnShutdown.cache` pref to true.

When both of these prefs are true `CacheObserver::ClearCacheOnShutdown()`
will return true, which will cause Firefox to clear the HTTP disk cache
during shutdown. This will block shutdown for howeverlong this takes. If the
user has a slow disk, or the user is on Windows and something is blocking the
deletion of those files, this will trigger a shutdown hang making Firefox
crash. This leads to a bad user experience as trying to start Firefox again
during this time will show the "Firefox is already running message".
Eventually a crash dump is produced. Bug 1356853 and bug 1682899 are caused
by this specific issue.

In order to avoid these crashes and a bad user experience we have
a few options:

1. Completely disable the disk cache when a user checks this box.
  This option will degrade the user's browsing experience.
2. Don't delete the folder at shutdown
  Whether we do this by removing the checkbox or simply not respecting
  the pref value, users who already have this setting would be surprised
  if the cache folder stops being deleted.
3. Use a thread pool to delete the files
  While it's likely to speed up the deletion at least a little bit,
  this would introduce additional complexity while not completely
  fixing the issue. A slow disk will still block shutdown.
4. Delete the cache at shutdown using a separate process
  This is likely the best option. It has the advantage of not blocking
  shutdown while at the same time maintaining similar properties to the
  existing functionality:
  - The cache folder is deleted at shutdown.
  - Has the same behaviour if Firefox gets killed or crashes for different issues.
  - Behaves similarly if the OS is forcefully shutdown during or before we begin to purge.
  - Additionaly, because we rename the folder prior to dispatching the background task, if the purging isn't completed we
    - don't rebuild the cache from an incomplete folder on next restart
    - are able to resume the purging after Firefox startup

A particularly special case is the Windows shutdown.
If the user shuts down windows that will try to close Firefox. If the shutdown
takes too long, the user will see the "Close anyway" button and may click
it thus preventing the cache purge to complete.
When using a background task we have a similar situation, but the button won't
even appear. So after the next Firefox restart we will check if the cache
needs to be purged.

Largely, the new behaviour will be:
- At shutdown we conditionally dispatch a background task to delete the folder
- If creating the process fails (for some reason) we fallback to the old way
  of synchronously deleting the folder.
- The task will then try to delete the folder in the background
- If for some reason it fails, we will dispatch a new background task shortly
  after Firefox restarts to clean up the old folders.

Differential Revision: https://phabricator.services.mozilla.com/D126339
2022-08-15 07:07:45 +00:00
Bryan Thrall 2f998d325f Bug 1768679 - Add 'Alt Data size' column to about:cache r=necko-reviewers,dragana
In CacheFileIOManager::GetEntryInfo(), there is only a problem if the Alt Data
element is present but we can't parse a reasonable value out of it (a value
smaller than the metadata offset).

Differential Revision: https://phabricator.services.mozilla.com/D146467
2022-08-04 16:20:17 +00:00
Jan Rio Krause 3fe00f5de7 Bug 1519200 - Remove NS_ERROR_FILE_TARGET_DOES_NOT_EXIST in favor of NS_ERROR_FILE_NOT_FOUND. r=xpcom-reviewers,nika,dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D77575
2022-04-05 15:17:03 +00:00
Randell Jesup 855202c183 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 18:47:08 +00:00
Noemi Erli 16f5f5f2b9 Backed out changeset 12a59e5a50bf (bug 1207753) for causing build bustage CLOSED TREE 2022-03-16 18:32:51 +02:00
Randell Jesup a98b1f8218 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 16:16:14 +00:00
Butkovits Atila 01197944a0 Backed out changeset a68ee4b09f92 (bug 1207753) for causing Hazard bustages. CLOSED TREE 2022-03-16 14:38:14 +02:00
Randell Jesup fe15f2115d Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 12:01:14 +00:00
Paul Zuehlcke 10432fde89 Bug 1714608 - Cleaned up partitionKey base domain helpers. r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D118724
2021-07-07 16:05:06 +00:00
Paul Zuehlcke 5c8d7ecfa6 Bug 1705030 - Added NetworkCacheCleaner deleteByBaseDomain. r=necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D113128
2021-06-24 09:13:30 +00:00
Valentin Gosu 9560d62d63 Bug 1714307 - Run modernize-use-default-member-init --fix check on netwerk r=necko-reviewers,kershaw
This changeset is the result of adding modernize-use-default-member-init to
tools/clang-tidy/config.yaml then proceeding to run
`./mach static-analysis check netwerk/ --fix`
I then went through the resulting fix and manually updated all of the member
variables which were missed due to them having a non-trivial constructor.

Note that the tool was only run on Linux, so code that only runs on some
platforms may have been missed.

The member variables that are still initialized in the contructor definition
are:
  - bitfields (not all currently supported compilers allow default-member-init
  - variables that are initialized via a parameter
  - variables that use code not visible in the header file

There are a few advantages to landing this change:
- fewer lines of code - now declaration is in the same place as initialization
  this also makes it easier to see when looking at the header.
- it makes it harder to miss initializing a member when adding a new contructor
- variables that depend on an include guard look much nicer now

Additionally I removed some unnecessary reinitialization of NetAddr members
(it has a constructor that does that now), and changed nsWifiScannerDBus to
use the thread-safe strtok_r instead of strtok.

Differential Revision: https://phabricator.services.mozilla.com/D116980
2021-06-11 07:10:41 +00:00
Csoregi Natalia e88581b300 Backed out changeset 6e00f8bd2acc (bug 1714307) for causing hazard bustage. CLOSED TREE 2021-06-09 21:50:03 +03:00
Valentin Gosu c01e585de7 Bug 1714307 - Run modernize-use-default-member-init --fix check on netwerk r=necko-reviewers,kershaw
This changeset is the result of adding modernize-use-default-member-init to
tools/clang-tidy/config.yaml then proceeding to run
`./mach static-analysis check netwerk/ --fix`
I then went through the resulting fix and manually updated all of the member
variables which were missed due to them having a non-trivial constructor.

Note that the tool was only run on Linux, so code that only runs on some
platforms may have been missed.

The member variables that are still initialized in the contructor definition
are:
  - bitfields (not all currently supported compilers allow default-member-init
  - variables that are initialized via a parameter
  - variables that use code not visible in the header file

There are a few advantages to landing this change:
- fewer lines of code - now declaration is in the same place as initialization
  this also makes it easier to see when looking at the header.
- it makes it harder to miss initializing a member when adding a new contructor
- variables that depend on an include guard look much nicer now

Additionally I removed some unnecessary reinitialization of NetAddr members
(it has a constructor that does that now), and changed nsWifiScannerDBus to
use the thread-safe strtok_r instead of strtok.

Differential Revision: https://phabricator.services.mozilla.com/D116980
2021-06-09 10:20:04 +00:00
Valentin Gosu 56cd5036af Bug 1714307 - Autofix static-analysis warnings in netwerk/ r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D116701
2021-06-04 12:35:16 +00:00
Butkovits Atila 1f3e4dc865 Backed out changeset c4b44c4ef15b (bug 1714307) for causing build bustages on nsHTTPCompressConv.h. CLOSED TREE 2021-06-04 13:53:37 +03:00
Valentin Gosu 5b4ead87fd Bug 1714307 - Autofix static-analysis warnings in netwerk/ r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D116701
2021-06-04 10:00:55 +00:00
Jens Stutte 67170da4d4 Bug 1690326: Add mappings for ERROR_DEVICE_HARDWARE_ERROR, ERROR_DEVICE_NOT_CONNECTED, ERROR_DISK_FULL and remove error NS_ERROR_FILE_DISK_FULL in favor of existing NS_ERROR_FILE_NO_DEVICE_SPACE r=xpcom-reviewers,necko-reviewers,nika,valentin
Win32 errors ERROR_DEVICE_HARDWARE_ERROR, ERROR_DEVICE_NOT_CONNECTED, ERROR_DISK_FULL need a mapping.
NS_ERROR_FILE_DISK_FULL is duplicate to NS_ERROR_FILE_NO_DEVICE_SPACE
Drive by: RejectJSPromise lacked some NS_ERROR_* mappings

Differential Revision: https://phabricator.services.mozilla.com/D113974
2021-05-06 14:00:06 +00:00
Valentin Gosu 52a9a0a80d Bug 1664020 - ShutdownEvent::PostAndWait should return immediately if posting the event fails r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D89648
2020-09-14 09:27:42 +00:00
Bogdan Tara d6bf6b4531 Backed out changeset 73bd8f2fbbf1 (bug 1664020) for bustages complaining about CacheFileIOManager.cpp CLOSED TREE 2020-09-11 16:10:19 +03:00
Valentin Gosu 19c9b96b06 Bug 1664020 - ShutdownEvent::PostAndWait should return immediately if posting the event fails r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D89648
2020-09-11 07:59:42 +00:00
Michal Novotny eabbd45270 Bug 1662012 - Remove filesystem reporting from the cache, r=valentin,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D88740
2020-08-31 15:16:07 +00:00
Simon Giesecke 1fbb2b245e Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84807
2020-08-04 11:27:07 +00:00
Noemi Erli c5adcfe981 Backed out 4 changesets (bug 1654992, bug 1654991) for causing timeous in mask-opacity-1e.html
Backed out changeset 11f0f54c6e0a (bug 1654992)
Backed out changeset a353dd5b3f08 (bug 1654991)
Backed out changeset 6a7964ba549f (bug 1654991)
Backed out changeset cf3bfb91d98c (bug 1654991)
2020-08-03 22:09:36 +03:00
Simon Giesecke 9d2e516112 Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84807
2020-08-03 14:54:18 +00:00
Michal Novotny 036dcbbc63 Bug 1645051 - Calculated smart max cache size shouldn't overwrite browser.cache.disk.capacity pref r=necko-reviewers,mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D83377
2020-07-14 16:54:22 +00:00
Simon Giesecke a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Simon Giesecke 9bcfd47601 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-13 14:38:48 +00:00
shindli 6bb3487209 Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00