Commit graph

856 commits

Author SHA1 Message Date
Eden Chuang
f4a08bbee6 Bug 1800659 - P2 remove nsICancelableRunnable inheriting form WorkerRunnable. r=asuth
This patch is only remove the inheriting, but keeping Cancel() implmentation.
The Cancel() is needed in some special cases, such as Worker enters Canceling when WorkerScope is not created.

Depends on D176915

Differential Revision: https://phabricator.services.mozilla.com/D173850
2023-06-06 06:36:50 +00:00
Jens Stutte
99112b51a1 Bug 1830278 - CC on worker shutdown until there remains nothing we can collect. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D176651
2023-04-27 12:58:38 +00:00
Jens Stutte
d750aa996c Bug 1826416 - Avoid the use of strong references to check if global scope is alive. r=dom-worker-reviewers,mccr8,asuth
Differential Revision: https://phabricator.services.mozilla.com/D174743
2023-04-12 08:54:09 +00:00
Cristina Horotan
9b84fc74f1 Backed out changeset 0825b12caee2 (bug 1826416) for causing multiple failures at RuntimeService.cpp 2023-04-12 10:40:45 +03:00
Jens Stutte
991535fe21 Bug 1826416 - Avoid the use of strong references to check if global scope is alive. r=dom-worker-reviewers,mccr8,asuth
Differential Revision: https://phabricator.services.mozilla.com/D174743
2023-04-12 07:04:08 +00:00
Jens Stutte
8433b62e54 Bug 1825589 - Relax globalScopeAlive assertion to happen after potentially deferred CC release have happened on JS context destruction. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D174496
2023-04-03 18:44:40 +00:00
Butkovits Atila
c71cfb0024 Backed out changeset b5217784536c (bug 1777921) for causing assertion failures at WorkerPrivate.h. CLOSED TREE 2023-03-31 18:36:39 +03:00
Jens Stutte
1706e4b98c Bug 1777921 - Assert that StrongWorkerRefs are not lazily released during final GC/CC. r=dom-worker-reviewers,smaug,asuth
And relax the check if someone carries away a stale reference to our global scope to happen after the JS context has gone out of scope.

Differential Revision: https://phabricator.services.mozilla.com/D150942
2023-03-31 14:33:15 +00:00
Joshua Marshall
af586cf84d Bug 1805613 - Dump worker info on shutdown hang r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D173430
2023-03-30 13:44:34 +00:00
Yulia
5231b910c8 Bug 1540913 - Part 2: Clear and shutdown ModuleLoader at worker termination; r=asuth,jonco
When running an infinitely-looping dynamic import, it is possible for the module loader to still be
holding on to that module at shutdown. Shutdown on the worker means that we will no longer run the
event loop, which will execute the dynamic import promises necessary to clear the global. The result
is that the global is kept alive. By calling `Shutdown()` we prevent this partially. We additionally
need to address the failure in the module code (next patch).

Differential Revision: https://phabricator.services.mozilla.com/D171683
2023-03-14 18:16:31 +00:00
Jon Coppeard
624da0ed61 Bug 1817757 - Part 1: Remove support for parallel marking from workers r=sfink
Depends on D170374

Differential Revision: https://phabricator.services.mozilla.com/D170375
2023-02-22 08:56:28 +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
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
Jan Varga
fd1df5b54d Bug 1809044 - Implement WorkerEventTarget::RegisterShutdownTask and WorkerEventTarget::UnregisterShutdownTask; r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D166309
2023-01-11 18:52:36 +00:00
Tom Schuster
bf618bbc4a Bug 1774866 - Always allow cloning error stacks. r=nika,sfink,smaug
Differential Revision: https://phabricator.services.mozilla.com/D164577
2022-12-15 19:03:53 +00:00
Nika Layzell
8351f7cc2d Bug 1804093 - Part 5: Eliminate WorkerPrincipal and WorkletPrincipals, r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D163856
2022-12-12 22:08:36 +00:00
Jon Coppeard
641c66c5a4 Bug 1802897 - Part 1: Add a pref for parallel marking, disabled by default r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D163461
2022-12-07 12:58:49 +00:00
Jens Stutte
7065a015e4 Bug 1803540 - Process all events caused as side effect by GCCC during worker shutdown. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D163916
2022-12-07 08:45:44 +00:00
Cristian Tuns
58e3b12e8a Backed out 13 changesets (bug 1802897) for causing build bustages on Marking.cpp CLOSED TREE
Backed out changeset 61a336a6d2c9
Backed out changeset 5c3c2afd76af (bug 1802897)
Backed out changeset 1b2d9c4afee8 (bug 1802897)
Backed out changeset bf236f6a197c (bug 1802897)
Backed out changeset b3e82a32e13e (bug 1802897)
Backed out changeset 9fcff7ae8aac (bug 1802897)
Backed out changeset f21b54985888 (bug 1802897)
Backed out changeset d6c6eaa2508a (bug 1802897)
Backed out changeset ab00bd1ada69 (bug 1802897)
Backed out changeset f98def4568e6 (bug 1802897)
Backed out changeset 68880308ca96 (bug 1802897)
Backed out changeset 73ad67b6e4f6 (bug 1802897)
Backed out changeset 28c061eb2993 (bug 1802897)
2022-12-06 14:44:08 -05:00
Jon Coppeard
0c7ec55801 Bug 1802897 - Part 1: Add a pref for parallel marking, disabled by default r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D163461
2022-12-06 18:19:28 +00:00
Simon Friedberger
3c5991df13 Bug 1549057 - Rename (Gg)etCSP to (Gg)etCsp - r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D159268
2022-10-24 20:38:11 +00:00
Jon Coppeard
0ebad143ef Bug 1770768 - Part 3: Add browser prefs for the new GC parameters r=mccr8,sfink
Differential Revision: https://phabricator.services.mozilla.com/D152864
2022-08-02 10:05:05 +00:00
Muhammad
0bf10d70ab Bug 1737829: Cut over Navigator components to fine-grained RFP Checks r=tjr,asuth
Whereas previously we would pass in the principal of a document,
now we will pass in the document directly. This will work for most use
cases, but not all (like Workers.)

Additionally, for the User Agent, if we do not Resist Fingerprinting
(because there is an exemption), we will fall through to getting the
User-Agent header which uses the coarse RFP check, so we fix that in
a later patch.

Differential Revision: https://phabricator.services.mozilla.com/D138778
2022-07-15 20:39:21 +00:00
Harveer Singh
db48d4e6fe Bug 1777400: Removed expired and probably not so useful telemetry probe 'SERVICE_WORKER_LIFE_TIME'. r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D151509
2022-07-12 22:15:49 +00:00
Matthew Gaudet
d27ba71b5a Bug 1747059 - Correctly select microtask queue when enquing a job in a ShadowRealm in a worker. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D150410
2022-06-28 22:04:19 +00:00
Csoregi Natalia
a6c7516d80 Backed out 9 changesets (bug 1747059, bug 1767525)for causing hazard failures on ShadowRealmGlobalScope.cpp. CLOSED TREE
Backed out changeset ed7aad37f2cf (bug 1747059)
Backed out changeset 40a257fb4788 (bug 1747059)
Backed out changeset f7b049ef3b8c (bug 1747059)
Backed out changeset aad38abc7139 (bug 1747059)
Backed out changeset 8115813e77a5 (bug 1747059)
Backed out changeset e06192e664fd (bug 1747059)
Backed out changeset a198b0893220 (bug 1767525)
Backed out changeset c083f0824619 (bug 1767525)
Backed out changeset 9a3bf794ec6d (bug 1767525)
2022-06-28 02:39:08 +03:00
Matthew Gaudet
c7369b95e1 Bug 1747059 - Correctly select microtask queue when enquing a job in a ShadowRealm in a worker. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D150410
2022-06-27 21:17:37 +00:00
Markus Stange
72a0a91cc9 Bug 1771776 - Use AUTO_PROFILER_LABEL_DYNAMIC_CSTR instead of AUTO_PROFILER_LABEL_DYNAMIC_CSTRING so that the dynamic string is captured even while the profiler is not running. r=florian
Differential Revision: https://phabricator.services.mozilla.com/D148949
2022-06-13 14:12:41 +00:00
Tom Schuster
4525afaf9f Bug 1740263 - Implement the CSP checking callback for WASM. r=dom-worker-reviewers,smaug,freddyb
Differential Revision: https://phabricator.services.mozilla.com/D141979
2022-05-19 14:13:50 +00:00
Iulian Moraru
4d59317ca4 Backed out 6 changesets (bug 1740263) for causing bp-hybrid bustages on nsScriptSecurityManager. CLOSED TREE
Backed out changeset 2f5ec6ad0f81 (bug 1740263)
Backed out changeset a1e7766cdb94 (bug 1740263)
Backed out changeset 3978ccb95455 (bug 1740263)
Backed out changeset e34ba774b3f8 (bug 1740263)
Backed out changeset 8365b10be28e (bug 1740263)
Backed out changeset d923462c9cd0 (bug 1740263)
2022-05-19 03:28:08 +03:00
Tom Schuster
5c808859fa Bug 1740263 - Implement the CSP checking callback for WASM. r=dom-worker-reviewers,smaug,freddyb
Differential Revision: https://phabricator.services.mozilla.com/D141979
2022-05-18 21:39:29 +00:00
Kagami Sascha Rosylight
043f38ccaf Bug 1769290 - Part 4: Apply mozilla-js-handle-rooted-typedef against dom/workers r=mccr8,dom-worker-reviewers,smaug
Changes done by `./mach static-analysis check --checks="-*,mozilla-js-handle-rooted-typedef" --fix --header-filter=dom dom/workers; ./mach clang-format --outgoing`.

Depends on D146453

Differential Revision: https://phabricator.services.mozilla.com/D146454
2022-05-17 19:48:04 +00:00
Jens Stutte
aa8c3727dc Bug 1766572: Part 3 - Make nsTerminator aware of late shutdown phases. r=xpcom-reviewers,nika
In order to get better shutdown hang reporting, we want to distinguish also the last phases, namely `XPCOMShutdownThreads`, `XPCOMShutdownMainThread` and `CCPostLastCycleCollection`.
This also makes `XPCOMShutdownNotified()` obsolete and we need to slightly re-arrange the watchdog function.

Differential Revision: https://phabricator.services.mozilla.com/D145433
2022-05-13 15:47:53 +00:00
asharma
e941cb8cc9 Bug 1752907: Cut over Hardware Concurrency to finer-grained RFP Check r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D137481
2022-05-10 02:20:02 +00:00
Nika Layzell
bd9c7d6105 Bug 1766306 - Stop re-using idle worker threads, r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D144616
2022-04-26 22:11:38 +00:00
Jens Stutte
4b422845c8 Bug 1763390: Destroy the cycle collector explicitely in WorkerThreadPrimaryRunnable before checking the global scope sentinels. r=dom-worker-reviewers,smaug
There is a difference between

a) the cycle collector being shut down and
b) the JSContext being destroyed entirely

We can use weak references to cycle collected objects after the CC is destroyed, but not after the JSContext is destroyed.

Thus we need to move `nsCycleCollector_shutdown();` out of the `~WorkerJSContext()` and ensure we check our sentinels before we destroy it.

Differential Revision: https://phabricator.services.mozilla.com/D143061
2022-04-07 07:38:12 +00:00
Olli Pettay
ebe85cf3fa Bug 1756172, Make also DebuggerScope support weak references, r=asuth
Depends on D141507

Differential Revision: https://phabricator.services.mozilla.com/D142057
2022-03-25 15:36:52 +00:00
Jens Stutte
176025dddc Bug 1756172: Unroot the global scopes only after the last worker event ran. r=dom-worker-reviewers,asuth,smaug
The patch D138442 wanted to guard us against the late use of global scope's reference to WorkerPrivate by nulling it out. The rational behind this was to enforce the invariant, that a `WorkerGlobalScopeBase` derived object should never outlive its `WorkerPrivate`. It turned out that during further worker cleanup at the end of `WorkerThreadPrimaryRunnable::Run` we still process pending events (while the `WorkerPrivate` is still alive) that might want to access the global scope and in particular its `mWorkerPrivate` legitimately.

The purpose of this patch is to:

 - Postpone the unrooting until after the last expected event processing.
 - Enforce the invariant "Lifetime(global scope) < Lifetime(WorkerPrivate)" by asserting that the global scope went away after GC/CC.
 - Do the nulling of global scope's `mWorkerPrivate` only if needed after the CC shut down.
 - Do the nulling of debugger global scope's `mWorkerPrivate` while unrooting as it does not support weak references.

Differential Revision: https://phabricator.services.mozilla.com/D141507
2022-03-25 15:36:51 +00:00
criss
a817ec0742 Backed out 3 changesets (bug 1752907) for casuing failures on browser_navigator.js. CLOSED TREE
Backed out changeset 747092282e35 (bug 1752907)
Backed out changeset e50ad7304c18 (bug 1752907)
Backed out changeset e6c18f35ac5f (bug 1752907)
2022-03-24 19:11:59 +02:00
asharma
430822123f Bug 1752907: Cut over Hardware Concurrency to finer-grained RFP Check r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D137481
2022-03-24 13:43:44 +00:00
Randell Jesup
fcaf70841e 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
2390d257e6 Backed out changeset 12a59e5a50bf (bug 1207753) for causing build bustage CLOSED TREE 2022-03-16 18:32:51 +02:00
Randell Jesup
4b033a5256 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
927ad62c6a Backed out changeset a68ee4b09f92 (bug 1207753) for causing Hazard bustages. CLOSED TREE 2022-03-16 14:38:14 +02:00
Randell Jesup
7d4b5fae04 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
Jens Stutte
07dbd234c9 Bug 1691557: Make gRuntimeService atomic. r=dom-worker-reviewers,jesup
During shutdown gRuntimeService can be accessed from a different thread while it gets destroyed. There should be not too much penalty having this atomic, even if it is for an edge case only.

Differential Revision: https://phabricator.services.mozilla.com/D139819
2022-02-28 15:16:41 +00:00
Jon Coppeard
495e25eed1 Bug 1753958 - Part 3: Add a GCOption for shutdown GCs and use this rather than checking the GCReason r=sfink,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D138555
2022-02-15 09:45:06 +00:00
Sylvestre Ledru
98949ee751 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Norisz Fay
1f6e81e2ce Backed out changeset 370f46a043e4 (bug 1752907) for causing mochitest failures on browser_navigator.js 2022-02-08 00:02:49 +02:00