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

2357 Коммитов

Автор SHA1 Сообщение Дата
Jon Coppeard db96c56df8 Bug 1536061 - Part 4: Add some tests for incremental iteration of the holder map r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D127679
2021-10-10 11:06:51 +00:00
Jon Coppeard f001c8f0fe Bug 1734362 - Add some tests for JS holder / GC integration r=mccr8
This tests that JS holders get marked gray by GC and updated when moved by
compacting GC. The latter would have caught the problem reported in bug
1731432.

Differential Revision: https://phabricator.services.mozilla.com/D127670
2021-10-08 14:00:02 +00:00
Csoregi Natalia 03c4091654 Backed out 5 changesets (bug 1734392, bug 1734362) for bustages on TestJSHolderMap.cpp. CLOSED TREE
Backed out changeset 53f7d8f6758a (bug 1734392)
Backed out changeset c55d9ca8c869 (bug 1734392)
Backed out changeset cd61ff016587 (bug 1734392)
Backed out changeset 211f5803783a (bug 1734362)
Backed out changeset 5f118a3deafc (bug 1734362)
2021-10-08 14:45:33 +03:00
Jon Coppeard 835249bd4a Bug 1734362 - Add some tests for JS holder / GC integration r=mccr8
This tests that JS holders get marked gray by GC and updated when moved by
compacting GC. The latter would have caught the problem reported in bug
1731432.

Differential Revision: https://phabricator.services.mozilla.com/D127670
2021-10-08 08:53:28 +00:00
Jens Stutte 7700e81876 Bug 1731564: Use motivated SpinEventLoopUntil inside xpcom/*. r=xpcom-reviewers,nika
Depends on D127236

Differential Revision: https://phabricator.services.mozilla.com/D127237
2021-10-07 08:06:16 +00:00
Marian-Vasile Laza 18fb16c542 Backed out 18 changesets (bug 1731564) for causing build bustages on SpinEventLoopUntil. CLOSED TREE
Backed out changeset 0464dbdc8584 (bug 1731564)
Backed out changeset 0d996df13545 (bug 1731564)
Backed out changeset 5630a0e7a109 (bug 1731564)
Backed out changeset 37b41d187cdb (bug 1731564)
Backed out changeset d37700fa60b6 (bug 1731564)
Backed out changeset b0ce7db44b99 (bug 1731564)
Backed out changeset aa5ec3aa1535 (bug 1731564)
Backed out changeset 73b648f1fa70 (bug 1731564)
Backed out changeset bb8fb0f9833e (bug 1731564)
Backed out changeset 0d8905144f5d (bug 1731564)
Backed out changeset 2cfb094a1ec3 (bug 1731564)
Backed out changeset 78d3b0257a6a (bug 1731564)
Backed out changeset e9d32926e93c (bug 1731564)
Backed out changeset 874cab520ce5 (bug 1731564)
Backed out changeset d8071cc32bd9 (bug 1731564)
Backed out changeset 283c5393cbbc (bug 1731564)
Backed out changeset 317bc38e3de5 (bug 1731564)
Backed out changeset 53e3f4862439 (bug 1731564)
2021-10-07 00:09:19 +03:00
Jens Stutte 7737c4488a Bug 1731564: Use motivated SpinEventLoopUntil inside xpcom/*. r=xpcom-reviewers,nika
Depends on D127236

Differential Revision: https://phabricator.services.mozilla.com/D127237
2021-10-06 19:45:18 +00:00
Mike Hommey 845953db24 Bug 1733308 - Allow to disable unified builds in xpcom/tests/windows. r=firefox-build-system-reviewers,andi
There's nothing wrong there.

Differential Revision: https://phabricator.services.mozilla.com/D127043
2021-10-01 01:49:19 +00:00
Mike Hommey 2d21eb6e9e Bug 1733308 - Fix non-unified builds errors in xpcom/tests/gtest. r=xpcom-reviewers,mccr8
objdir/dist/include/mozilla/Queue.h:251:31: error: use of undeclared identifier 'moz_xcalloc'
xpcom/base/nsCOMPtr.h:436:5: error: static_assert failed due to requirement '1 < sizeof (TestForIID<nsIEventTarget>(nullptr))' "nsCOMPtr only works for types with IIDs.  Either use RefPtr; add an IID to your type with NS_DECLARE_STATIC_IID_ACCESSOR/NS_DEFINE_STATIC_IID_ACCESSOR; or make the nsCOMPtr point to a base class with an IID."
xpcom/tests/gtest/TestDelayedRunnable.cpp:16:28: error: field has incomplete type '(anonymous namespace)::ReleaseDetector'
xpcom/tests/gtest/TestDelayedRunnable.cpp:16:3: error: 'explicit' can only appear on non-static member functions
xpcom/tests/gtest/TestDelayedRunnable.cpp:16:40: error: expected ')'
xpcom/tests/gtest/TestDelayedRunnable.cpp:16:61: error: use of undeclared identifier 'aActive'
xpcom/tests/gtest/TestDelayedRunnable.cpp:28:3: error: no template named 'Atomic'; did you mean 'mozilla::Atomic'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:34:3: error: no template named 'Atomic'; did you mean 'mozilla::Atomic'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:36:18: error: use of undeclared identifier 'TaskQueue'; did you mean 'taskQueue'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:36:18: error: variable 'taskQueue' declared with deduced type 'auto' cannot appear in its own initializer
xpcom/tests/gtest/TestDelayedRunnable.cpp:36:48: error: use of undeclared identifier 'MediaThreadType'
xpcom/tests/gtest/TestDelayedRunnable.cpp:36:48: error: use of undeclared identifier 'MediaThreadType'; did you mean 'mozilla::MediaThreadType'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:38:51: error: no matching conversion for functional-style cast from 'Atomic<bool> *' to '(anonymous namespace)::ReleaseDetector'
xpcom/tests/gtest/TestDelayedRunnable.cpp:54:3: error: no template named 'Atomic'; did you mean 'mozilla::Atomic'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:58:51: error: no matching conversion for functional-style cast from 'Atomic<bool> *' to '(anonymous namespace)::ReleaseDetector'
xpcom/tests/gtest/TestDelayedRunnable.cpp:88:3: error: use of undeclared identifier 'Unused'; did you mean 'mozilla::Unused'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:104:3: error: use of undeclared identifier 'Unused'; did you mean 'mozilla::Unused'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:109:10: error: unknown type name 'SharedThreadPool'; did you mean 'mozilla::SharedThreadPool'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:109:35: error: use of undeclared identifier 'SharedThreadPool'
xpcom/tests/gtest/TestDelayedRunnable.cpp:109:35: error: use of undeclared identifier 'SharedThreadPool'; did you mean 'mozilla::SharedThreadPool'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:110:25: error: use of function template name with no prior declaration in function call with explicit template arguments is a C++20 extension [-Werror,-Wc++20-extensions]
xpcom/tests/gtest/TestDelayedRunnable.cpp:110:36: error: unknown type name 'TaskQueue'; did you mean 'mozilla::TaskQueue'?
xpcom/tests/gtest/TestDelayedRunnable.cpp:112:36: error: unknown type name 'TaskQueue'; did you mean 'mozilla::TaskQueue'?
xpcom/tests/gtest/TestFileNTFSSpecialPaths.cpp:18:28: error: use of undeclared identifier 'do_CreateInstance'
xpcom/tests/gtest/TestFileNTFSSpecialPaths.cpp:26:28: error: use of undeclared identifier 'do_CreateInstance'
xpcom/tests/gtest/TestFileNTFSSpecialPaths.cpp:39:28: error: use of undeclared identifier 'do_CreateInstance'
xpcom/tests/gtest/TestFileNTFSSpecialPaths.cpp:279:28: error: use of undeclared identifier 'do_CreateInstance'
xpcom/tests/gtest/TestFilePreferencesWin.cpp:113:26: error: use of undeclared identifier 'do_CreateInstance'
xpcom/tests/gtest/TestFilePreferencesWin.cpp:140:26: error: use of undeclared identifier 'do_CreateInstance'
xpcom/tests/gtest/TestFilePreferencesWin.cpp:156:31: error: use of undeclared identifier 'NS_OS_TEMP_DIR'
xpcom/tests/gtest/TestJSHolderMap.cpp:50:28: error: unknown type name 'JSHolderMap'
xpcom/tests/gtest/TestJSHolderMap.cpp:52:35: error: use of undeclared identifier 'i'
xpcom/tests/gtest/TestJSHolderMap.cpp:52:45: error: use of undeclared identifier 'i'
xpcom/tests/gtest/TestJSHolderMap.cpp:52:8: error: use of undeclared identifier 'JSHolderMap'
xpcom/tests/gtest/TestJSHolderMap.cpp:52:8: error: use of undeclared identifier 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'?
xpcom/tests/gtest/TestJSHolderMap.cpp:53:24: error: use of undeclared identifier 'i'
xpcom/tests/gtest/TestJSHolderMap.cpp:54:24: error: use of undeclared identifier 'i'
xpcom/tests/gtest/TestJSHolderMap.cpp:68:3: error: unknown type name 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'?
xpcom/tests/gtest/TestJSHolderMap.cpp:73:3: error: unknown type name 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'?
xpcom/tests/gtest/TestJSHolderMap.cpp:99:3: error: unknown type name 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'?
xpcom/tests/gtest/TestJSHolderMap.cpp:104:9: error: use of undeclared identifier 'JSHolderMap'
xpcom/tests/gtest/TestJSHolderMap.cpp:104:9: error: use of undeclared identifier 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'?
xpcom/tests/gtest/TestJSHolderMap.cpp:125:41: error: use of undeclared identifier 'MakeUnique'
xpcom/tests/gtest/TestJSHolderMap.cpp:147:3: error: unknown type name 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'?
xpcom/tests/gtest/TestJSHolderMap.cpp:151:41: error: use of undeclared identifier 'MakeUnique'
xpcom/tests/gtest/TestRWLock.cpp:92:3: error: no template named 'Maybe'; did you mean 'mozilla::Maybe'?
xpcom/tests/gtest/TestRWLock.cpp:95:23: error: use of undeclared identifier 'SyncRunnable'; did you mean 'mozilla::SyncRunnable'?
xpcom/tests/gtest/TestRWLock.cpp:103:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:107:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:111:7: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:120:7: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:130:5: error: unknown type name 'AutoWriteLock'; did you mean 'mozilla::AutoWriteLock'?
xpcom/tests/gtest/TestRWLock.cpp:133:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:137:7: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:142:3: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:146:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:155:5: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'?
xpcom/tests/gtest/TestRWLock.cpp:159:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:163:7: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'?
xpcom/tests/gtest/TestRWLock.cpp:172:7: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'?
xpcom/tests/gtest/TestRWLock.cpp:182:5: error: unknown type name 'AutoReadLock'; did you mean 'mozilla::AutoReadLock'?
xpcom/tests/gtest/TestRWLock.cpp:184:5: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'?
xpcom/tests/gtest/TestRWLock.cpp:188:7: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'?
xpcom/tests/gtest/TestRWLock.cpp:194:5: error: unknown type name 'AutoWriteLock'; did you mean 'mozilla::AutoWriteLock'?
xpcom/tests/gtest/TestRWLock.cpp:197:5: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'?
xpcom/tests/gtest/TestRWLock.cpp:201:7: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'?

Differential Revision: https://phabricator.services.mozilla.com/D127042
2021-10-01 01:49:19 +00:00
Mike Hommey dcfb8d38be Bug 1732208 - Silence the unused-but-set-variable warning in xpcom. r=xpcom-reviewers,mccr8
xpcom/tests/gtest/TestAvailableMemoryWatcherWin.cpp(130,22): error: variable 'x' set but not used [-Werror,-Wunused-but-set-variable]
    volatile uint8_t x = 0;
                     ^
xpcom/tests/gtest/TestAvailableMemoryWatcherWin.cpp(152,12): error: variable 'consumed' set but not used [-Werror,-Wunused-but-set-variable]
    size_t consumed = 0;
           ^
xpcom/tests/gtest/TestSTLWrappers.cpp:48:7: error: variable 'rv' set but not used [-Werror,-Wunused-but-set-variable]
  int rv = 1;
      ^

Differential Revision: https://phabricator.services.mozilla.com/D126462
2021-09-28 00:02:48 +00:00
Jon Coppeard be7071699c Bug 1730534 - Part 5: Add some basic unit tests for JSHolderMap r=mccr8
Depends on D125431

Differential Revision: https://phabricator.services.mozilla.com/D126668
2021-09-27 16:41:53 +00:00
Byron Campen 50c3cf7a3c Bug 1651268: Make sure the pre-run code for FindExpirationTime waits for timers to fire on all threads. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D125603
2021-09-20 16:45:53 +00:00
kriswright e1c01499b6 Bug 1731098 - Include nsIThread in TestMultiplexInputStream.cpp r=xpcom-reviewers,nika
When adding new gtests I came across this build failure:

```
 0:12.59 In file included from Unified_cpp_xpcom_tests_gtest2.cpp:2:
 0:12.59 /home/kriswright/src/mozilla-unified/xpcom/tests/gtest/TestMultiplexInputStream.cpp:349:45: error: no viable conversion from 'nsCOMPtr<nsIThread>' to 'nsIEventTarget *'
```

It looks like this file needs to include nsIThread in its #includes.

Differential Revision: https://phabricator.services.mozilla.com/D125851
2021-09-16 16:56:39 +00:00
Jens Stutte 87de42e070 Bug 1726813: Ensure AppShutdown remains in sync with shutdown notifications in the parent process. r=xpcom-reviewers,nika,dom-worker-reviewers,asuth
The goal here is to ensure we can always rely on `AppShutdown::GetShutdownPhase` to be in sync with the "real" application status, mainly this was needed for xpcshell tests to not break if we add assertions on our shutdown state on some global singletons.

We keep the existing observer notification topics but force them (on the parent process) to be issued through the new `advanceShutdownPhase` function of the startup service using the `ShutdownPhase` enum. This way we can synchronize `AppShutdown`'s internal status accordingly.

Some further notes:

  # The `MOZ_ASSERT(AppShutdown::IsNoOrLegalShutdownTopic(aTopic));` in `NotifyObservers` helped a lot to identify missing cases. I think we should keep it in order to stay safe.
  # Introducing the `cenum IDLShutdownPhase` helps to keep the knowledge about the mapping from shutdown phases to observer topics exclusively inside AppShutdown.cpp. Still callers must know what they do in order to choose a proper phase, of course.
  # However we must be aware that `AppShutdown` this way can be kept in sync with the shutdown notifications only in the parent process and that `GetCurrentShutdownPhase` might not give the correct result in child processes. We might want to file a follow up bug that adds some asserts to avoid improper use of `AppShutdown` functions in child processes (but I do not want to make this patch bigger as needed to solve the blocking dependency for bug 1697972).
  # The socket process is one example of a child process that "overloads" shutdown topics. I was wondering if it is the right call to use the very same topic names here to request shutdown to the socket process or if it should have its own topics. Those topics triggered the assert and thus I had to disable it for child processes, for now.
  # This goes together with the more general approach to define process type specific shutdown phases (and hence mappings to topics) as drafted very roughly in bug 1697745.
  # This patch seemed to trigger a known intermittent more often, thus the change here in `ServiceWorkerManager`.

Differential Revision: https://phabricator.services.mozilla.com/D124350
2021-09-15 07:25:29 +00:00
Byron Campen 212446b536 Bug 1729921: Cancel with a sync dispatch to the target thread in these tests. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D125118
2021-09-10 19:08:25 +00:00
Gerald Squelart 132dffb9d9 Bug 1663382 - Add NS_Convert... constructors taking a Span - r=florian
Add `NS_ConvertUTF16toUTF8::NS_ConvertUTF16toUTF8(const Span<const char16_t>)` and `NS_ConvertUTF16toUTF8::NS_ConvertUTF8toUTF16(const Span<const char>)` explicit constructors.
This is consistent with `NS_ConvertASCIItoUTF16` that already had one.
More importantly, other constructors were calling `AppendUTF{16,8}To{8,16}` functions taking a `Span`, so for cases where the caller already has a `Span` it's most efficient to have constructors accepting that `Span` directly.

Differential Revision: https://phabricator.services.mozilla.com/D125146
2021-09-10 11:43:47 +00:00
Andreas Pehrson 4c15c8eb1d Bug 1727563 - Implement TryLock methods and RAII helpers for RWLock. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D124066
2021-09-08 10:40:07 +00:00
Byron Campen [:bwc] 4aee661e93 Bug 1726177: Update IDL file to better reflect previous behavior, and cover this behavior in the test-case. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D123813
2021-09-03 21:59:00 +00:00
Iulian Moraru 28f6ed5050 Backed out 2 changesets (bug 1726177) for causing gtest failures on TestTimers.cpp. CLOSED TREE
Backed out changeset 82ec582992fd (bug 1726177)
Backed out changeset 50952e0327ee (bug 1726177)
2021-09-02 03:09:10 +03:00
Byron Campen [:bwc] d912c972f5 Bug 1726177: Update IDL file to better reflect previous behavior, and cover this behavior in the test-case. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D123813
2021-09-01 21:46:48 +00:00
Cristian Tuns 8410d730ff Backed out changeset 38c2002963c9 bug(1727563) for causing gtest crashes on RWLock. CLOSED TREE DONTBUILD 2021-09-01 06:54:36 -04:00
Andreas Pehrson e6b64b97b1 Bug 1727563 - Implement TryLock methods and RAII helpers for RWLock. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D124066
2021-09-01 10:11:44 +00:00
Andreas Pehrson ca7808acf7 Bug 1727558 - Implement an RAII class for Mutex::TryLock. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D124058
2021-09-01 10:10:24 +00:00
Andi-Bogdan Postelnicu 2fc4f70e9b Bug 1725145 - Preparation for the hybrid build env. r=necko-reviewers,firefox-build-system-reviewers,valentin,glandium
Automatically generated path that adds flag `REQUIRES_UNIFIED_BUILD = True` to `moz.build`
when the module governed by the build config file is not buildable outside on the unified environment.

This needs to be done in order to have a hybrid build system that adds the possibility of combing
unified build components with ones that are built outside of the unified eco system.

Differential Revision: https://phabricator.services.mozilla.com/D122345
2021-08-25 10:46:17 +00:00
Kagami Sascha Rosylight eddf271c1f Bug 1726648 - Add a helper to trim brackets from nsID r=mccr8,smaug
Differential Revision: https://phabricator.services.mozilla.com/D123163
2021-08-23 10:54:11 +00:00
Iulian Moraru a16afaadfe Backed out changeset d21b3f88a2b4 (bug 1726648) for causing build bustages. CLOSED TREE 2021-08-23 04:12:02 +03:00
Kagami Sascha Rosylight 0c5086660f Bug 1726648 - Add a helper to trim brackets from nsID r=mccr8,smaug
Differential Revision: https://phabricator.services.mozilla.com/D123163
2021-08-23 00:35:40 +00:00
Haik Aftandilian 6e49780b6e Bug 1722758 - Patch 2 - Add a new encoding mode to be used for Apple NSURL compatibility r=necko-reviewers,valentin
Add a new encoding mode to be used to encode an already-encoded URL to be compatible with Apple's NSURL.

Add a function for creating an nsIURI with NSURL compatible encoding from a URL string.

Differential Revision: https://phabricator.services.mozilla.com/D122651
2021-08-20 18:54:03 +00:00
Valentin Gosu 0cfda7bb4a Bug 1705659 - Static-analysis check auto fix for auth code r=necko-reviewers,dragana
Depends on D112604

Differential Revision: https://phabricator.services.mozilla.com/D112605
2021-08-12 12:39:25 +00:00
Toshihito Kikuchi faa1254982 Bug 1722268 - Increase the timeout thresholds in AvailableMemoryWatcherFixture. r=gsvelto
Due to slower performance with ASan, this patch increases the thresholds.

Differential Revision: https://phabricator.services.mozilla.com/D121757
2021-08-07 07:06:12 +00:00
Toshihito Kikuchi 7237c89b3d Bug 1715858 - Part3. Add a new category memory_watcher to the event ping. r=KrisWright
The new event is recoreded when we detect the system's memory is no longer low.
Each event object contains three numbers:

  1) how many times a tab was unloaded during the low-memory situation
  2) how many memory-pressure events were dispatched during the low-memory
     situation
  3) how long we were in the low-memory situation in seconds

These need to be collected as the event ping because the memory situation
may repeatedly be switched between low-memory and high-memory.  We want to
collect it every time the memory situation gets back to normal.  If we collect
it as the main ping (like Histogram), all numbers are summed up and we cannot
evaluate each low-memory period.

Differential Revision: https://phabricator.services.mozilla.com/D120021
2021-07-22 21:15:01 +00:00
Toshihito Kikuchi 5b5b5faee4 Bug 1720503 - Start a timer when the physical memory is low but the commit space is not low. r=haik,KrisWright
When the physical memory is low, Windows OS triggers the memory notification callback,
but we don't take any action if the commit space is not low because it is not the case
of a potential OOM crash.  The problem is in that case, we unregister the wait handle
and exit from the callback.  This means we lose a way to watch memory after that.

The proposed fix is to start a timer before exiting the callback.  We could re-register
the callback, but it could be triggered too quickly if the low-physical-but-high-commit-space
situation lasts long.  After the timer starts, the first timer handler (interval: 10 sec)
checks the commit space again, and if the commit space is still not low at that time,
we re-register the callback and stop the timer.

One tricky situation we need to consider is we don't actually start the timer while
the user is inactive.  In that case, we mark the flag `mNeedToRestartTimerOnUserInteracting`
and start the timer when the user becomes active later.  With that, `OnHighMemory` can
be executed even when we didn't in the low-memory situation.  So we need to check another
flag `mUnderMemoryPressure` and record the telemetry and send a memory-pressure-stop event
only when we were in the low-memory situation.

Differential Revision: https://phabricator.services.mozilla.com/D120022
2021-07-22 01:35:43 +00:00
Tooru Fujisawa cc92ef732d Bug 1708448 - Move property and element functions into js/public/PropertyAndElement.h. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D119619
2021-07-13 11:52:42 +00:00
Paul Bone 2ff6954e0f Bug 1718184 - pt 1. IdleTaskRunner now uses TimeDuration r=nika
Differential Revision: https://phabricator.services.mozilla.com/D118791
2021-07-13 01:42:32 +00:00
Toshihito Kikuchi 67f9ed45ff Bug 1701368 - Part7: Add GTest to test nsAvailableMemoryWatcher. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D117675
2021-07-06 22:31:00 +00:00
Toshihito Kikuchi b3df452cb8 Bug 1701368 - Part3: Remove the MemPressure_Ongoing request. r=gsvelto
We had `NS_DispatchMemoryPressure` and `NS_DispatchEventualMemoryPressure`
to dispatch a memory-pressure event which took `MemPressure_New` and
`MemPressure_Ongoing` to translate into "low-memory" and "low-memory-ongoing"
message respectively.

With that model, we could end up sending a wrong message if somebody
called the API with `MemPressure_Ongoing` without sending `MemPressure_New`.
To avoid that, this patch removes `MemPressure_Ongoing` and makes
the API decide whether it should dispatch a "new" event or "ongoing" event.

Differential Revision: https://phabricator.services.mozilla.com/D119122
2021-07-06 22:30:58 +00:00
Butkovits Atila 785829138d Backed out 7 changesets (bug 1701368) for causing build bustages on TestMemoryPressure.cpp. CLOSED TREE
Backed out changeset 3be9f410b666 (bug 1701368)
Backed out changeset 907317341862 (bug 1701368)
Backed out changeset 38fb1e114a53 (bug 1701368)
Backed out changeset f3a475931a13 (bug 1701368)
Backed out changeset 98046adfc310 (bug 1701368)
Backed out changeset d773413513cf (bug 1701368)
Backed out changeset feca7daa9c96 (bug 1701368)
2021-07-07 00:21:34 +03:00
Toshihito Kikuchi 7868eaa3d1 Bug 1701368 - Part7: Add GTest to test nsAvailableMemoryWatcher. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D117675
2021-07-06 18:59:10 +00:00
Toshihito Kikuchi 238b1bf932 Bug 1701368 - Part3: Remove the MemPressure_Ongoing request. r=gsvelto
We had `NS_DispatchMemoryPressure` and `NS_DispatchEventualMemoryPressure`
to dispatch a memory-pressure event which took `MemPressure_New` and
`MemPressure_Ongoing` to translate into "low-memory" and "low-memory-ongoing"
message respectively.

With that model, we could end up sending a wrong message if somebody
called the API with `MemPressure_Ongoing` without sending `MemPressure_New`.
To avoid that, this patch removes `MemPressure_Ongoing` and makes
the API decide whether it should dispatch a "new" event or "ongoing" event.

Differential Revision: https://phabricator.services.mozilla.com/D119122
2021-07-06 18:59:08 +00:00
Nika Layzell 5731c1747c Bug 1717526 - String's implicit conversion operator causes COW relocations, r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D118430
2021-06-23 01:57:00 +00:00
Alexandru Michis e3d24b013a Backed out changeset 3beb01f5d643 (bug 1717526) for causing gtest failures in SpanTest.from_xpcom_collections
CLOSED TREE
2021-06-23 01:58:49 +03:00
Nika Layzell c14de7eabc Bug 1717526 - String's implicit conversion operator causes COW relocations, r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D118430
2021-06-22 21:18:03 +00:00
Nika Layzell eaa7724180 Bug 1714226 - Return the number of removed elements from nsTArray::RemoveElementsBy, r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D116664
2021-06-22 18:17:17 +00:00
Butkovits Atila 83f57b5c69 Backed out 22 changesets (bug 1714226, bug 1706374, bug 1713148) for causing build bustages on MessageChannel.cpp. CLOSED TREE
Backed out changeset ea469eaa54ca (bug 1713148)
Backed out changeset fd8523d5126e (bug 1713148)
Backed out changeset f2e5309c914c (bug 1713148)
Backed out changeset 2da57973ed55 (bug 1713148)
Backed out changeset 677e1ee99bb2 (bug 1713148)
Backed out changeset b4c0619e79bf (bug 1706374)
Backed out changeset c02fa459e77d (bug 1706374)
Backed out changeset 72dc6537cf0b (bug 1706374)
Backed out changeset 48088463c656 (bug 1706374)
Backed out changeset b09ae4c3a94b (bug 1706374)
Backed out changeset 04422175004b (bug 1706374)
Backed out changeset 110b2384e7d1 (bug 1706374)
Backed out changeset ab2b086abbd4 (bug 1706374)
Backed out changeset ffde07f73249 (bug 1706374)
Backed out changeset c6303af17ff4 (bug 1706374)
Backed out changeset 02249671c2f9 (bug 1706374)
Backed out changeset a6a5d05b5636 (bug 1706374)
Backed out changeset e21b6defb805 (bug 1706374)
Backed out changeset c72c5be9ddb1 (bug 1706374)
Backed out changeset 23cd961575a6 (bug 1706374)
Backed out changeset b412d6e9e145 (bug 1706374)
Backed out changeset a8ec285d6472 (bug 1714226)
2021-06-22 04:03:56 +03:00
Nika Layzell 55b81f9748 Bug 1714226 - Return the number of removed elements from nsTArray::RemoveElementsBy, r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D116664
2021-06-21 21:53:05 +00:00
Csoregi Natalia 0a9e50b29c Bug 1714561 - Fix black lint. r=fix CLOSED TREE 2021-06-07 18:52:35 +03:00
Jon Coppeard 97ba8e2712 Bug 1714561 - Add test that single-zone JS holders can contain a pointer into the atoms zone r=mccr8
Depends on D116848

Differential Revision: https://phabricator.services.mozilla.com/D116978
2021-06-07 15:19:30 +00:00
Brindusan Cristian ca49f15f7d Backed out 14 changesets (bug 1705659, bug 472823, bug 669675) as requested by valentin for causing regressions. CLOSED TREE
Backed out changeset d920aa17a468 (bug 669675)
Backed out changeset adad38c05584 (bug 1705659)
Backed out changeset 361c177ed131 (bug 1705659)
Backed out changeset 46e559f45338 (bug 1705659)
Backed out changeset 3c9556a8df55 (bug 1705659)
Backed out changeset a179695a56c9 (bug 1705659)
Backed out changeset e688986c7011 (bug 1705659)
Backed out changeset de990e6c944d (bug 1705659)
Backed out changeset 0ea348abee78 (bug 1705659)
Backed out changeset 2f0aacbd42b1 (bug 1705659)
Backed out changeset c977551bad6e (bug 1705659)
Backed out changeset 5449d9e08034 (bug 1705659)
Backed out changeset b6b51bc167ac (bug 1705659)
Backed out changeset 27e709923ecb (bug 472823)
2021-05-31 13:16:34 +03:00
Kris Wright 68285a5475 Bug 1704887 - Fix a UAF in the DelayedRunnable gtests. r=xpcom-reviewers,nika
In the gtest for these patches, we can encounter a hang in the following steps:
- Monitor waits in the main thread (for async steps to finish)
- Offthread, monitor waits for the timer to fire
- Timer notifies the waiting monitors
- Monitor on the main thread continues first, wrapping up the test. It assumes all async steps are finished.
- The offthread monitor wait follows, but at this point the main thread has dereferenced the monitor. Because of this race, we run into a UAF and hang on the offthread monitor.

My solution for this is to use two monitors, and notify the outer one after we have=completed all of the async steps including the wait for the timer notification. This should avoid a race between the inner `monitor.wait()` and the free at the end of the tests.

Tentative try push for the fix: https://treeherder.mozilla.org/jobs?repo=try&revision=307960b2899b320ef5a82d276b86d633a9653941

Differential Revision: https://phabricator.services.mozilla.com/D116163
2021-05-28 19:05:30 +00:00
Andreas Pehrson 31a1263a94 Bug 1704887 - Add gtest for TaskQueue impl. r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D112875
2021-05-28 19:05:28 +00:00