Commit Graph

851 Commits

Author SHA1 Message Date
Jens Stutte
c5fa7ccd1e 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
5ff465c923 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
7a7df1c06d 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
e90e9dc56f 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
09b46d0966 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
58d22da98a 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
3652956b7b 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
f236c54e45 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
d61ced88a2 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
8b0b833dff 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
3ce17fcff1 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
b6897a896a 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
9e110ab0ca 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
e750afe8b6 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
019896256a 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
96d17de98f 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
6b0a251a63 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
a20fc5ddab 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
a3ee48e9ed 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
e2cadaee26 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
e3502a9a5c 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
d91db2b437 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
709d6b57b6 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
3cf965c5c8 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
0a3b024851 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
979c59be19 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
41be94e499 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
753e94b86b 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
bf307ee3d2 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
f06040dcbc 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
ef820bcd63 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
524922ccfd 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
5093e37c21 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
b5a86673fd 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
bf47c3a992 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
3eddb6a4b0 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
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
Jens Stutte
83c1370f4d 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
e9b99a2b4d 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
35a175aa33 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
3e9749ba3d Backed out changeset 370f46a043e4 (bug 1752907) for causing mochitest failures on browser_navigator.js 2022-02-08 00:02:49 +02:00
asharma
68ebf92251 Bug 1752907: Cut over Hardware Concurrency to finer-grained RFP Check r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D137481
2022-02-07 20:26:28 +00:00
Eden Chuang
fe1a5665bf Bug 1744025 - Replace include "mozilla/dom/WorkerPrivate.h" with include "mozilla/dom/WorkerScope.h" where WorkerPrivate->GlobalScope() is called. r=dom-worker-reviewers,smaug,jstutte
#include "mozilla/dom/WorkerScope.h" is removed from WorkerPrivate.h, where calling WorkerPrivate::GlobalScope() without include "WorkerScope.h" makes WorkerScope as an incomplete type.


Depends on 132800

Depends on D132800

Differential Revision: https://phabricator.services.mozilla.com/D133483
2022-01-25 08:53:03 +00:00
Jens Stutte
fcebe158ab Bug 1744025: Use CheckedUnsafePtr<WorkerPrivate> in WorkerPrivate where possible. r=dom-worker-reviewers,asuth
Depends on D132709

Differential Revision: https://phabricator.services.mozilla.com/D132710
2022-01-25 08:53:00 +00:00
Jens Stutte
d600f5b7bb Bug 1741182: Harmonize WorkerRunnable derived classes' overrides of Cancel. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D135679
2022-01-12 14:43:09 +00:00
Tooru Fujisawa
320251f165 Bug 1743623 - Part 4: Stop registering callback for worker override. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D133978
2022-01-11 15:55:51 +00:00