Граф коммитов

844 Коммитов

Автор SHA1 Сообщение Дата
Andi-Bogdan Postelnicu d7e8a09c21 Bug 1519636 - Reformat recent changes to the Google coding style. r=glandium
Updated with clang-format version 15.0.5 (taskcluster-MKK8dHUpQkGfPLA793lizg)
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D168658
2023-02-13 15:02:07 +00:00
Kagami Sascha Rosylight 66762decd8 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 0caa2f1940 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 4df611fead 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
Nika Layzell 9d6bb19c23 Bug 1809753 - Part 4: Remove unnecessary GetMainThreadEventTarget, r=mccr8
This method always returned GetMainThreadSerialEventTarget(). This patch
switches all callers over to use that method instead.

We can't easily switch all calls to be calls to NS_GetMainThread(), as there is
no version of that method returning a bare nsIThread* instance.

I didn't introduce one, as we may want to add a lock around mMainThread in the
future, which would require removing nsThreadManager::GetMainThreadWeak. As
this method only returns nsISerialEventTarget, it method could remain
implemented, however, by returning a statically allocated fake event target
which forwards dispatches (and QIs to nsIThread) to the real main thread.

Differential Revision: https://phabricator.services.mozilla.com/D166608
2023-01-16 23:14:12 +00:00
Nika Layzell 852d02ec16 Bug 1809753 - Part 3: Replace all callers of GetCurrentEventTarget with GetCurrentSerialEventTarget, r=mccr8,necko-reviewers,valentin
This only changes the behaviour when called with a TaskQueue or other type
using SerialEventTargetGuard on the stack. They are being switched over as the
existing GetCurrentEventTarget method is being removed, as it is somewhat
confusing, and poorly documented.

Callers which need to get the current thread even when on a threadpool or
behind a TaskQueue were switched to GetCurrentEventTarget in the previous part.

Differential Revision: https://phabricator.services.mozilla.com/D166607
2023-01-16 23:14:11 +00:00
Sandor Molnar 41b78439d0 Backed out 6 changesets (bug 1809752, bug 1809753) for causing perma failures in browser/components/firefoxview/tests/browser/browser_feature_callout_position.js
Backed out changeset ea05784d74c4 (bug 1809753)
Backed out changeset 7c9b20eebcc8 (bug 1809753)
Backed out changeset d0267ac2256d (bug 1809753)
Backed out changeset aa9f2971bd6f (bug 1809753)
Backed out changeset f0d9fcfaa6f8 (bug 1809752)
Backed out changeset 6d58c799cffe (bug 1809752)
2023-01-17 03:19:24 +02:00
Nika Layzell f7772bb6ae Bug 1809753 - Part 4: Remove unnecessary GetMainThreadEventTarget, r=mccr8
This method always returned GetMainThreadSerialEventTarget(). This patch
switches all callers over to use that method instead.

We can't easily switch all calls to be calls to NS_GetMainThread(), as there is
no version of that method returning a bare nsIThread* instance.

I didn't introduce one, as we may want to add a lock around mMainThread in the
future, which would require removing nsThreadManager::GetMainThreadWeak. As
this method only returns nsISerialEventTarget, it method could remain
implemented, however, by returning a statically allocated fake event target
which forwards dispatches (and QIs to nsIThread) to the real main thread.

Differential Revision: https://phabricator.services.mozilla.com/D166608
2023-01-16 23:14:12 +00:00
Nika Layzell 8d118308de Bug 1809753 - Part 3: Replace all callers of GetCurrentEventTarget with GetCurrentSerialEventTarget, r=mccr8,necko-reviewers,valentin
This only changes the behaviour when called with a TaskQueue or other type
using SerialEventTargetGuard on the stack. They are being switched over as the
existing GetCurrentEventTarget method is being removed, as it is somewhat
confusing, and poorly documented.

Callers which need to get the current thread even when on a threadpool or
behind a TaskQueue were switched to GetCurrentEventTarget in the previous part.

Differential Revision: https://phabricator.services.mozilla.com/D166607
2023-01-16 23:14:11 +00:00
Valentin Gosu e6676a245b 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 df399d18cd 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 9855e2b77b Backed out changeset 837b1f1e4939 (bug 1806831) for causing background related failures CLOSED TREE 2023-01-03 15:17:35 +02:00
Valentin Gosu 265b52fb1f 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
Nika Layzell 0ff3b55986 Bug 1806332 - Dispatch CacheOutputCloseListener to main thread when already there, r=kershaw,necko-reviewers
This should avoid the crash caused by the CacheOutputCloseListener being
fired on the main thread too late during shutdown by keeping the
previous behaviour when on the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D165062
2022-12-20 20:18:46 +00:00
Nika Layzell 6abdeea3e4 Bug 1799222 - Part 2: Dispatch background task for CacheOutputCloseListener::OnOutputClosed, r=necko-reviewers,kershaw
Previously this would dispatch to the current thread, which could in
some cases be a threadpool thread, meaning that the runnable would
not run until the threadpool thread exits. This switches the code over
to always dispatch to the StreamTransportService instead.

Depends on D161349

Differential Revision: https://phabricator.services.mozilla.com/D164504
2022-12-16 17:09:17 +00:00
edgul 57acf63da4 Bug 1745972 - Added assertions to verify additions and removals of mRecs. r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D161215
2022-12-12 21:32:12 +00:00
Valentin Gosu 8f4daa25f7 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 4cb6d25f2d 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 92d3050ecb 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
Dana Keeler 1a2ff46b6e Bug 1791633 - separate nsITLSSocketControl from nsITransportSecurityInfo r=necko-reviewers,kershaw,jschanck
Depends on D160311

Differential Revision: https://phabricator.services.mozilla.com/D160313
2022-11-16 16:37:29 +00:00
Valentin Gosu ef7edc4d4d 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
Marian-Vasile Laza 9c44d165bb Backed out 3 changesets (bug 1791633) for causing bustages on TransportSecurityInfo.cpp. CLOSED TREE
Backed out changeset 23b864e14db0 (bug 1791633)
Backed out changeset 0bcba3375ec0 (bug 1791633)
Backed out changeset ab0ea0d68f5c (bug 1791633)
2022-11-15 23:51:58 +02:00
Dana Keeler 0a13b94a8f Bug 1791633 - separate nsITLSSocketControl from nsITransportSecurityInfo r=necko-reviewers,kershaw,jschanck
Depends on D160311

Differential Revision: https://phabricator.services.mozilla.com/D160313
2022-11-15 20:03:29 +00:00
Butkovits Atila f3f66bf7e5 Backed out 3 changesets (bug 1791633) for causing build bustages at nsHttpConnectionMgr.cpp:. CLOSED TREE
Backed out changeset ee9744982673 (bug 1791633)
Backed out changeset f5a4bfdaba40 (bug 1791633)
Backed out changeset f57131b9cfe2 (bug 1791633)
2022-11-15 08:07:16 +02:00
Dana Keeler a7fbd7a3a0 Bug 1791633 - separate nsITLSSocketControl from nsITransportSecurityInfo r=necko-reviewers,kershaw,jschanck
Depends on D160311

Differential Revision: https://phabricator.services.mozilla.com/D160313
2022-11-15 05:34:40 +00:00
Randell Jesup 4c109a25fb Bug 1207753 - netwerk/cache2 thread-safety annotations r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D160392
2022-11-12 00:00:49 +00:00
Cristian Tuns ee55bd7851 Backed out changeset 6a036b7abe73 (bug 1207753) for causing build bustages CacheFile.h CLOSED TREE 2022-11-11 15:26:46 -05:00
Randell Jesup 4c09f799cd Bug 1207753 - netwerk/cache2 thread-safety annotations r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D160392
2022-11-11 20:07:26 +00:00
Kagami Sascha Rosylight d20dd96f8f 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 292ecbe28d Bug 1794376 - Rename BlockingIOWatcher and simplify code r=edgul
We don't need mEvent to wait for IO completion. Instead, we just cancel
it immediately.

Differential Revision: https://phabricator.services.mozilla.com/D159846
2022-10-28 12:36:48 +00:00
Valentin Gosu a5d6d45941 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 62af8960d0 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
Kagami Sascha Rosylight fac20df060 Bug 1796085 - Part 1: Define MOZ_BACKGROUNDTASKS macro globally r=smaug,necko-reviewers,application-update-reviewers,nalexander,valentin
There are 10+ separate macro definition for this, we can do it globally instead.

Differential Revision: https://phabricator.services.mozilla.com/D156911
2022-10-19 12:04:08 +00:00
Dana Keeler 9c1b9475f3 Bug 1793841 - deserialize nsITransportSecurityInfo without already having an instance of it r=jschanck,necko-reviewers,dragana
This is an important step in making nsITransportSecurityInfo constant.

Depends on D157994

Differential Revision: https://phabricator.services.mozilla.com/D157995
2022-10-18 21:25:03 +00:00
Mark Banner 2ffde1e92f 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
Mainly automated changes. Some manual ESLint fixes and whitespace cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D158452
2022-10-18 11:21:26 +00:00
Noemi Erli 5a21645f73 Backed out 2 changesets (bug 1793841) for causing Gtest failures CLOSED TREE
Backed out changeset 4d39c423b92e (bug 1793841)
Backed out changeset 5cfb5f595add (bug 1793841)
2022-10-18 04:29:44 +03:00
Dana Keeler 0d78f1f283 Bug 1793841 - deserialize nsITransportSecurityInfo without already having an instance of it r=jschanck,necko-reviewers,dragana
This is an important step in making nsITransportSecurityInfo constant.

Depends on D157994

Differential Revision: https://phabricator.services.mozilla.com/D157995
2022-10-18 00:18:09 +00:00
Kagami Sascha Rosylight 232d5682ef Bug 1784840 - Convert all background tasks to ESM r=nalexander,application-update-reviewers,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D156950
2022-10-15 18:24:37 +00:00
Mark Banner dcf3abed55 Bug 1788038 - Turn on ESLint rule for prefer-boolean-length-check for netwerk. r=necko-reviewers,dragana
Depends on D155965

Differential Revision: https://phabricator.services.mozilla.com/D155966
2022-09-05 22:01:07 +00:00
Manuel Bucher 25837aaf2e 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 7e916cece1 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
edguloien 6f463ede32 Bug 1745972 - Dispatch cache wrapper deletion to caller thread to acquire lock before deletion and safety-removal from frecency array. r=kershaw,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D151764
2022-08-29 17:29:32 +00:00
Dana Keeler ed171d40cf Bug 1784098 - make nsICacheEntry.securityInfo explicit as nsITransportSecurityInfo r=kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D154472
2022-08-23 03:37:18 +00:00
Narcis Beleuzu 5fb7ed6946 Backed out 4 changesets (bug 1784098) for bustages on nsCOMPtr.h . CLOSED TREE
Backed out changeset d22ac7bcb472 (bug 1784098)
Backed out changeset a97052238dba (bug 1784098)
Backed out changeset a2bb8ecd6170 (bug 1784098)
Backed out changeset 16ab6547619c (bug 1784098)
2022-08-22 20:50:21 +03:00
Dana Keeler 51aa6b77a8 Bug 1784098 - make nsICacheEntry.securityInfo explicit as nsITransportSecurityInfo r=kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D154472
2022-08-22 16:32:02 +00:00
Valentin Gosu 6389d6bc6c Bug 1705676 - Use CachePurgeLock to prevent multiple background tasks deleting the same folder. r=nalexander,necko-reviewers,dragana
This patch uses a CachePurgeLock for every directory it deletes.
Because we can't possibly know if a folder was already deleted before we
aquire the lock or if it never existed (without the use of a log file) we
can assume that if a folder isn't there after the timeout has expired it's
already been purged by a different cleanup task.

Depends on D132164

Differential Revision: https://phabricator.services.mozilla.com/D132165
2022-08-15 07:07:46 +00:00
Valentin Gosu aaeda3ef3b Bug 1705676 - Add CachePurgeLock to lock access to the purged cache directory r=nalexander,necko-reviewers,dragana
Depends on D132595

Differential Revision: https://phabricator.services.mozilla.com/D132164
2022-08-15 07:07:45 +00:00
Valentin Gosu 00ed953e23 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 89d1e07b8b 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
Bryan Thrall f9c451035e Bug 1768679 - Expose cache fetch count as uint32_t r=dragana,necko-reviewers
The value is stored as uint32_t, and there doesn't seem to be a need to convert
it to int.

Differential Revision: https://phabricator.services.mozilla.com/D147888
2022-08-04 16:20:17 +00:00