Commit Graph

673 Commits

Author SHA1 Message Date
Simon Giesecke
191a830575 Bug 1628715 - Part 7: Add MOZ_NONNULL_RETURN to infallible nsTArray::AppendElements. r=xpcom-reviewers,necko-reviewers,nika,valentin
Differential Revision: https://phabricator.services.mozilla.com/D70831
2020-04-24 13:31:14 +00:00
Michal Novotny
9fdf075d81 Bug 1624515 - Fix data race on CacheStorageService::mShutdown r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D71768
2020-04-21 20:33:37 +00:00
Chris Peterson
9db7016a65 Bug 1630511 - Replace MOZ_MUST_USE with [[nodiscard]] in netwerk. r=necko-reviewers,dragana
Also move MOZ_MUST_USE before function declarations' specifiers and return type. While clang and gcc's __attribute__((warn_unused_result)) can appear before, between, or after function specifiers and return types, the [[nodiscard]] attribute must precede the function specifiers.

Differential Revision: https://phabricator.services.mozilla.com/D71144
2020-04-18 06:37:32 +00:00
MahakBansal
4452860213 Bug 1614659 - CacheIndex::Shutdown() should not check if files exist before removing them.r=michal
Differential Revision: https://phabricator.services.mozilla.com/D70094

--HG--
extra : moz-landing-system : lando
2020-04-10 08:14:19 +00:00
Honza Bambas
4f360112b6 Bug 1626809 - Sanitize HTTP disk cache storage context key to prevent leak of private data like URLs, r=njn
Differential Revision: https://phabricator.services.mozilla.com/D69625

--HG--
extra : moz-landing-system : lando
2020-04-09 12:38:09 +00:00
Andreas Farre
63e21eec70 Bug 1620594 - Part 1: Rework NS_ReleaseOnMainThreadSystemGroup. r=nika
To be able to remove SystemGroup, NS_ReleaseOnMainThreadSystemGroup
needs to have its dependency on SystemGroup removed. Since all
releases using SystemGroup would've released on the main thread anyway
we can safely replace NS_ReleaseOnMainThreadSystemGroup with
NS_ReleaseOnMainThread.

Depends on D64390

Differential Revision: https://phabricator.services.mozilla.com/D67631

--HG--
extra : moz-landing-system : lando
2020-04-07 15:16:23 +00:00
anjali1903
4018161e48 Bug 1621251 Replace NS_ADDREF(*var = other) with *var = do_AddRef(other).take() in /netwerk r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D66818

--HG--
extra : moz-landing-system : lando
2020-03-17 15:05:26 +00:00
Michal Novotny
3ab8b4b548 Bug 1614619 - Eviction algorithm should first evict entries of a content type that’s above a limit r=valentin
This patch implements limit for media content type in the cache. When we need to evict something from the cache and media is over the limit, it's evicted first.

Differential Revision: https://phabricator.services.mozilla.com/D64548

--HG--
extra : moz-landing-system : lando
2020-03-02 12:17:32 +00:00
Michal Novotny
f913f3c0b6 Bug 1614610 - Fix missing initialization of CacheIndexStats::mCountByType[] and CacheIndexStats::mSizeByType[] r=valentin
Initialization was missing in CacheIndexStats::CacheIndexStats() and CacheIndexStats::Clear(). Comparison was also added to CacheIndexStats::operator==().

Differential Revision: https://phabricator.services.mozilla.com/D64406

--HG--
extra : moz-landing-system : lando
2020-02-26 17:16:39 +00:00
Michal Novotny
17f7cb5283 Bug 1616507 - Intermittent PID 13265 | SUMMARY: ThreadSanitizer: data race /builds/worker/workspace/build/src/netwerk/cache2/CacheFile.cpp:2362:48 in EntryWouldExceedLimit r=mayhemer
There is a possible race condition between CacheFile::OnFileOpened() called on the cache I/O thread as a result of calling CacheFileIOManager::OpenFile() and CacheFile::EntryWouldExceedLimit() and CacheFile::SetMemoryOnly(), both called on main thread from CacheEntry::OpenOutputStream(). Both methods now grab the CacheFile's lock to synchronize the access.

Differential Revision: https://phabricator.services.mozilla.com/D63826

--HG--
extra : moz-landing-system : lando
2020-02-26 11:56:21 +00:00
Simon Giesecke
aaf6cb4e75 Bug 1617628 - Hide nsBaseHashtable Put overloads in nsRefPtrHashtable subclass. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D63899

--HG--
extra : moz-landing-system : lando
2020-02-25 17:03:36 +00:00
Michal Novotny
47f2a10a01 Bug 1614610 - Have cache occupancy for each content-type in cache index r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D63624

--HG--
extra : moz-landing-system : lando
2020-02-24 09:09:54 +00:00
Simon Giesecke
9350e6b741 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

Differential Revision: https://phabricator.services.mozilla.com/D62604

--HG--
extra : moz-landing-system : lando
2020-02-20 11:40:14 +00:00
Dorel Luca
d5f9df8ee1 Backed out 2 changesets (bug 1613985) for Build bustage on Windows2012. CLOSED TREE
Backed out changeset fd177b40b561 (bug 1613985)
Backed out changeset fb6d62b7f28d (bug 1613985)
2020-02-19 22:22:41 +02:00
Simon Giesecke
59b23375c0 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

Differential Revision: https://phabricator.services.mozilla.com/D62604

--HG--
extra : moz-landing-system : lando
2020-02-19 18:05:38 +00:00
Michal Novotny
5cd74804aa Bug 1614637 - ThreadSanitizer: data race [@ assign_assuming_AddRef] vs. [@ operator bool] in CacheStorageService r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D62550

--HG--
extra : moz-landing-system : lando
2020-02-17 18:44:21 +00:00
Simon Giesecke
b50347f917 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-13 14:38:48 +00:00
Michal Novotny
32b5d4c391 Bug 1614706 - ThreadSanitizer: data race [@ Release] vs. [@ CloseWithStatusLocked] in CacheFileInputStream r=mayhemer
Acquiring the lock is moved from CacheFile::RemoveInput() to CacheFileInputStream::Release(). This fixes the data race and is consistent with CacheFile::RemoveOutput() which is also called under the lock.

Differential Revision: https://phabricator.services.mozilla.com/D62504

--HG--
extra : moz-landing-system : lando
2020-02-12 14:45:36 +00:00
shindli
91aa0518dd 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
Simon Giesecke
f604a47fa5 Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-12 17:24:41 +00:00
Mihai Alexandru Michis
31990b30b7 Backed out changeset 4758bb49e763 (bug 1614637) for causing multiple failures.
CLOSED TREE
2020-02-12 17:04:50 +02:00
Michal Novotny
b1f514bcc7 Bug 1614637 - ThreadSanitizer: data race [@ assign_assuming_AddRef] vs. [@ operator bool] in CacheStorageService r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D62550

--HG--
extra : moz-landing-system : lando
2020-02-12 13:55:15 +00:00
Michal Novotny
918ca4b243 Bug 1614629 - Fix freeSpace check in CacheFileIOManager::OverLimitEvictionInternal r=mayhemer
Patch fixes wrong comparison. I also noticed that in bug 979900 I fixed just one freeSpace assignment after GetDiskSpaceAvailable() failure, see https://bugzilla.mozilla.org/show_bug.cgi?id=979900#c14. This patch fixes also other occurrences.

Differential Revision: https://phabricator.services.mozilla.com/D62435

--HG--
extra : moz-landing-system : lando
2020-02-11 16:42:59 +00:00
Eric Rahm
2c08316c5d Bug 1610070 - Part 3: Convert the rest of netwerk/ to use UniquePtr. r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D60341

--HG--
extra : moz-landing-system : lando
2020-02-11 16:20:08 +00:00
Michal Novotny
90759ceddb Bug 1607142 - Hold lock in CacheFile::IsWriteInProgress to avoid data race r=mayhemer
This method is called on cache I/O thread while the members are modified usually on the main thread which results in data race.

Differential Revision: https://phabricator.services.mozilla.com/D60367

--HG--
extra : moz-landing-system : lando
2020-01-23 19:18:06 +00:00
Michal Novotny
7c7d2abfab Bug 1607224 - Data race on CacheFileHandle::mFileSize r=valentin
This patch fixes data race on CacheFileHandle::mFileSize when accessed on main thread by nsHttpChannel::ReportNetVSCacheTelemetry(). All other usages are on cache I/O thread.

Differential Revision: https://phabricator.services.mozilla.com/D60407

--HG--
extra : moz-landing-system : lando
2020-01-21 09:48:11 +00:00
Sylvestre Ledru
187e9bafaf Bug 1519636 - Automatically reformat recent changes using clang-format r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D60354

--HG--
extra : moz-landing-system : lando
2020-01-21 09:51:27 +00:00
Emilio Cobos Álvarez
256c124f94 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
This was done by:

This was done by applying:

```
diff --git a/python/mozbuild/mozbuild/code-analysis/mach_commands.py b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
index 789affde7bbf..fe33c4c7d4d1 100644
--- a/python/mozbuild/mozbuild/code-analysis/mach_commands.py
+++ b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
@@ -2007,7 +2007,7 @@ class StaticAnalysis(MachCommandBase):
         from subprocess import Popen, PIPE, check_output, CalledProcessError

         diff_process = Popen(self._get_clang_format_diff_command(commit), stdout=PIPE)
-        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format]
+        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format, '-sort-includes']

         if not output_file:
             args.append("-i")
```

Then running `./mach clang-format -c <commit-hash>`

Then undoing that patch.

Then running check_spidermonkey_style.py --fixup

Then running `./mach clang-format`

I had to fix four things:

 * I needed to move <utility> back down in GuardObjects.h because I was hitting
   obscure problems with our system include wrappers like this:

0:03.94 /usr/include/stdlib.h:550:14: error: exception specification in declaration does not match previous declaration
0:03.94 extern void *realloc (void *__ptr, size_t __size)
0:03.94              ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/malloc_decls.h:53:1: note: previous declaration is here
0:03.94 MALLOC_DECL(realloc, void*, void*, size_t)
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
0:03.94     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
0:03.94                                ^
0:03.94 <scratch space>:178:1: note: expanded from here
0:03.94 realloc_impl
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozmemory_wrap.h:142:41: note: expanded from macro 'realloc_impl'
0:03.94 #define realloc_impl mozmem_malloc_impl(realloc)

   Which I really didn't feel like digging into.

 * I had to restore the order of TrustOverrideUtils.h and related files in nss
   because the .inc files depend on TrustOverrideUtils.h being included earlier.

 * I had to add a missing include to RollingNumber.h

 * Also had to partially restore include order in JsepSessionImpl.cpp to avoid
   some -WError issues due to some static inline functions being defined in a
   header but not used in the rest of the compilation unit.

Differential Revision: https://phabricator.services.mozilla.com/D60327

--HG--
extra : moz-landing-system : lando
2020-01-20 16:19:48 +00:00
Emilio Cobos Álvarez
aa3a695712 Bug 1609996 - Remove mozilla/Move.h. r=froydnj
rg -l 'mozilla/Move.h' | xargs sed -i 's/#include "mozilla\/Move.h"/#include <utility>/g'

Further manual fixups and cleanups to the include order incoming.

Differential Revision: https://phabricator.services.mozilla.com/D60323

--HG--
extra : moz-landing-system : lando
2020-01-20 16:18:20 +00:00
Johann Hofmann
e074949795 Bug 1591362 - Fix incorrect origin comparison in CacheFileContextEvictor::EvictEntries(). r=baku,mayhemer,michal
Differential Revision: https://phabricator.services.mozilla.com/D59959

--HG--
extra : moz-landing-system : lando
2020-01-20 07:24:37 +00:00
Sylvestre Ledru
cc2040bf21 Bug 1605934 - Use nested namespaces r=sg
Done with:
./mach static-analysis check --checks="-*, modernize-concat-nested-namespaces" --fix .
and then clang-format on the files

Differential Revision: https://phabricator.services.mozilla.com/D58217

--HG--
extra : moz-landing-system : lando
2020-01-18 13:48:34 +00:00
Dorel Luca
506e65bcab Backed out changeset bbb39655cf71 (bug 1605934) for build bustage in widget/gtk/mozwayland/mozwayland.c 2020-01-18 15:39:55 +02:00
Sylvestre Ledru
6689a37527 Bug 1605934 - Use nested namespaces r=sg
Done with:
./mach static-analysis check --checks="-*, modernize-concat-nested-namespaces" --fix .
and then clang-format on the files

Differential Revision: https://phabricator.services.mozilla.com/D58217

--HG--
extra : moz-landing-system : lando
2020-01-18 13:16:39 +00:00
Michal Novotny
b66b7fa491 Bug 1606207 - Remove first-party cache isolation telemetry r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D59352

--HG--
extra : moz-landing-system : lando
2020-01-14 13:53:01 +00:00
Alex Henrie
e71e6666f8 Bug 1608002 - Link to CancelSynchronousIo at compile time. r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D59269

--HG--
extra : moz-landing-system : lando
2020-01-13 18:49:36 +00:00
Eric Rahm
78ee6675cf Bug 1606187 - Part 2b: Update users of nsClassHashtable to handle UniquePtr differences r=KrisWright,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D59042

--HG--
extra : moz-landing-system : lando
2020-01-13 19:18:56 +00:00
Michal Novotny
40a21eea5b Bug 1519126 - Intermittent GECKO(1168) | Assertion failure: !chunk->IsReady() r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D58533

--HG--
extra : moz-landing-system : lando
2020-01-08 14:09:33 +00:00
Chris Peterson
406763af7f Bug 1570499 - Part 1: Replace MOZ_FALLTHROUGH macro with C++17's [[fallthrough]] attribute. r=froydnj
This changeset is a simple find and replace of `MOZ_FALLTHROUGH` and `[[fallthrough]]`.

Unfortunately, the MOZ_FALLTHROUGH_ASSERT macro (to assert on case fallthrough in debug builds) is still necessary after switching from [[clang::fallthrough]] to [[fallthrough]] because:

* MOZ_ASSERT(false) followed by [[fallthrough]] triggers a -Wunreachable-code warning in DEBUG builds
* but MOZ_ASSERT(false) without [[fallthrough]] triggers a -Wimplicit-fallthrough warning in NDEBUG builds.

Differential Revision: https://phabricator.services.mozilla.com/D56440

--HG--
extra : moz-landing-system : lando
2019-12-20 07:16:43 +00:00
Tom Tung
dcf0aeb0a2 Bug 1474608 - P2 - Clear origin attributes data directly on cache2; r=asuth,michal,baku
Differential Revision: https://phabricator.services.mozilla.com/D34324

--HG--
extra : moz-landing-system : lando
2019-12-02 19:47:05 +00:00
Gabriele Svelto
5dc21d568c Bug 1600545 - Remove useless inclusions of header files generated from IDL files in modules/, netwerk/, parser/, security/, startupcache/, storage/, toolkit/, tools/, uriloader/, widget/, xpcom/ and xpfe/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55444

--HG--
extra : moz-landing-system : lando
2019-12-06 09:17:57 +00:00
Michal Novotny
6504573f1b Bug 1601620 - ThreadSanitizer: data race in mozilla::net::CacheFileUtils::CachePerfStats, r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D55972

--HG--
extra : moz-landing-system : lando
2019-12-05 14:49:24 +00:00
Emilio Cobos Álvarez
74327c26b4 Bug 1599615 - Make some necko code less nsresult-happy. r=kershaw,valentin
Stuff that's infallible and not virtual has no reason to return an nsresult.

Differential Revision: https://phabricator.services.mozilla.com/D54831

--HG--
extra : moz-landing-system : lando
2019-12-02 13:21:06 +00:00
Sylvestre Ledru
8f0aec81da Bug 1586674 - Simplify 'static inline uint32_t PRTimeToSeconds(PRTime aTimeUsec)' in CacheEntry.h too r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D48356

--HG--
extra : moz-landing-system : lando
2019-10-07 15:00:14 +00:00
Michal Novotny
85857b979d Bug 1577354 - Assertion failure: decoded.CountChar('\t') == 2, at /netwerk/cache2/CacheFileContextEvictor.cpp:409, r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D43902

--HG--
extra : moz-landing-system : lando
2019-09-02 17:26:08 +00:00
Nicholas Nethercote
18fae65f38 Bug 1563139 - Remove StaticPrefs.h. r=glandium
This requires replacing inclusions of it with inclusions of more specific prefs
files.

The exception is that StaticPrefsAll.h, which is equivalent to StaticPrefs.h,
and is used in `Codegen.py` because doing something smarter is tricky and
suitable for a follow-up. As a result, any change to StaticPrefList.yaml will
still trigger recompilation of all the generated DOM bindings files, but that's
still a big improvement over trigger recompilation of every file that uses
static prefs.

Most of the changes in this commit are very boring. The only changes that are
not boring are modules/libpref/*, Codegen.py, and ServoBindings.toml.

Differential Revision: https://phabricator.services.mozilla.com/D39138

--HG--
extra : moz-landing-system : lando
2019-07-26 01:10:23 +00:00
Nicholas Nethercote
2a3b9bca8d Bug 1562305 - Make privacy.sanitize.sanitizeOnShutdown and privacy.clearOnShutdown.cache static prefs. r=michal
Differential Revision: https://phabricator.services.mozilla.com/D37195

--HG--
extra : moz-landing-system : lando
2019-07-11 04:38:36 +00:00
Nicholas Nethercote
0001b36344 Bug 1562305 - Make browser.cache.max_shutdown_io_lag a static pref. r=michal
Differential Revision: https://phabricator.services.mozilla.com/D37192

--HG--
extra : moz-landing-system : lando
2019-07-11 04:38:36 +00:00
Nicholas Nethercote
0d47e90e70 Bug 1562305 - Remove browser.cache.compression_level pref. r=michal
It's unused.

Differential Revision: https://phabricator.services.mozilla.com/D37191

--HG--
extra : moz-landing-system : lando
2019-07-11 04:13:45 +00:00
Nicholas Nethercote
7f3b5b80c6 Bug 1562305 - Make browser.cache.disk.max_{,priority_}chunks_memory_usage static prefs. r=michal
Differential Revision: https://phabricator.services.mozilla.com/D37190

--HG--
extra : moz-landing-system : lando
2019-07-11 04:13:21 +00:00
Nicholas Nethercote
eb1b20a058 Bug 1562305 - Make browser.cache.memory.max_entry_size a static pref. r=michal
Differential Revision: https://phabricator.services.mozilla.com/D37189

--HG--
extra : moz-landing-system : lando
2019-07-11 04:12:59 +00:00