summaryrefslogtreecommitdiffstats
path: root/dom/workers
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /dom/workers
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/workers')
-rw-r--r--dom/workers/RuntimeService.cpp17
-rw-r--r--dom/workers/WorkerIPCUtils.h6
-rw-r--r--dom/workers/WorkerPrivate.cpp7
-rw-r--r--dom/workers/WorkerScope.cpp10
-rw-r--r--dom/workers/WorkerScope.h4
-rw-r--r--dom/workers/remoteworkers/RemoteWorkerChild.cpp7
-rw-r--r--dom/workers/test/WorkerDebugger.console_debugger.js2
-rw-r--r--dom/workers/test/bug1014466_worker.js2
-rw-r--r--dom/workers/test/notification_permission_worker.js2
-rw-r--r--dom/workers/test/notification_worker.js2
-rw-r--r--dom/workers/test/notification_worker_child-child.js2
-rw-r--r--dom/workers/test/onLine_worker_child.js5
-rw-r--r--dom/workers/test/onLine_worker_head.js2
-rw-r--r--dom/workers/test/promise_worker.js2
-rw-r--r--dom/workers/test/test_worker_interfaces.js10
15 files changed, 67 insertions, 13 deletions
diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
index 3d6a883867..02efb12053 100644
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -369,6 +369,14 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
PREF("gc_min_empty_chunk_count", JSGC_MIN_EMPTY_CHUNK_COUNT),
PREF("gc_max_empty_chunk_count", JSGC_MAX_EMPTY_CHUNK_COUNT),
PREF("gc_compacting", JSGC_COMPACTING_ENABLED),
+ PREF("gc_parallel_marking", JSGC_PARALLEL_MARKING_ENABLED),
+ PREF("gc_parallel_marking_threshold_mb",
+ JSGC_PARALLEL_MARKING_THRESHOLD_MB),
+ // Note: Workers do not currently trigger eager minor GC, but if that is
+ // desired the following parameters should be added:
+ // javascript.options.mem.nursery_eager_collection_threshold_kb
+ // javascript.options.mem.nursery_eager_collection_threshold_percent
+ // javascript.options.mem.nursery_eager_collection_timeout_ms
};
#undef PREF
@@ -439,6 +447,7 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
case JSGC_MIN_EMPTY_CHUNK_COUNT:
case JSGC_MAX_EMPTY_CHUNK_COUNT:
case JSGC_HEAP_GROWTH_FACTOR:
+ case JSGC_PARALLEL_MARKING_THRESHOLD_MB:
UpdateCommonJSGCMemoryOption(rts, pref->fullName, pref->key);
break;
default:
@@ -1410,10 +1419,16 @@ nsresult RuntimeService::Init() {
Preferences::GetInt(PREF_WORKERS_MAX_PER_DOMAIN, MAX_WORKERS_PER_DOMAIN);
gMaxWorkersPerDomain = std::max(0, maxPerDomain);
- if (NS_WARN_IF(!IndexedDatabaseManager::GetOrCreate())) {
+ IndexedDatabaseManager* idm = IndexedDatabaseManager::GetOrCreate();
+ if (NS_WARN_IF(!idm)) {
return NS_ERROR_UNEXPECTED;
}
+ rv = idm->EnsureLocale();
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
+ }
+
// PerformanceService must be initialized on the main-thread.
PerformanceService::GetOrCreate();
diff --git a/dom/workers/WorkerIPCUtils.h b/dom/workers/WorkerIPCUtils.h
index 0be45b307f..a93fad5b02 100644
--- a/dom/workers/WorkerIPCUtils.h
+++ b/dom/workers/WorkerIPCUtils.h
@@ -6,7 +6,7 @@
#ifndef _mozilla_dom_WorkerIPCUtils_h
#define _mozilla_dom_WorkerIPCUtils_h
-#include "ipc/EnumSerializer.h"
+#include "mozilla/dom/BindingIPCUtils.h"
// Undo X11/X.h's definition of None
#undef None
@@ -17,9 +17,7 @@ namespace IPC {
template <>
struct ParamTraits<mozilla::dom::WorkerType>
- : public ContiguousEnumSerializer<mozilla::dom::WorkerType,
- mozilla::dom::WorkerType::Classic,
- mozilla::dom::WorkerType::EndGuard_> {};
+ : public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::WorkerType> {};
} // namespace IPC
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
index 78de4adc3a..a8643981aa 100644
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -2804,7 +2804,12 @@ nsresult WorkerPrivate::GetLoadInfo(
AssertIsOnMainThread();
// Make sure that the IndexedDatabaseManager is set up
- Unused << NS_WARN_IF(!IndexedDatabaseManager::GetOrCreate());
+ IndexedDatabaseManager* idm = IndexedDatabaseManager::GetOrCreate();
+ if (idm) {
+ Unused << NS_WARN_IF(NS_FAILED(idm->EnsureLocale()));
+ } else {
+ NS_WARNING("Failed to get IndexedDatabaseManager!");
+ }
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
MOZ_ASSERT(ssm);
diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp
index 159829f4a8..92d6c89dca 100644
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -404,6 +404,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(WorkerGlobalScope,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCrypto)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPerformance)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWebTaskScheduler)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTrustedTypePolicyFactory)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNavigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFontFaceSet)
@@ -420,6 +421,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(WorkerGlobalScope,
tmp->mWebTaskScheduler->Disconnect();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWebTaskScheduler)
}
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mTrustedTypePolicyFactory)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocation)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mNavigator)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFontFaceSet)
@@ -868,6 +870,14 @@ void WorkerGlobalScope::StorageAccessPermissionGranted() {
mCacheStorage = nullptr;
}
+TrustedTypePolicyFactory* WorkerGlobalScope::TrustedTypes() {
+ if (!mTrustedTypePolicyFactory) {
+ mTrustedTypePolicyFactory = MakeRefPtr<TrustedTypePolicyFactory>(this);
+ }
+
+ return mTrustedTypePolicyFactory;
+}
+
bool WorkerGlobalScope::WindowInteractionAllowed() const {
AssertIsOnWorkerThread();
return mWindowInteractionsAllowed > 0;
diff --git a/dom/workers/WorkerScope.h b/dom/workers/WorkerScope.h
index 7e00f9b59b..12a97e12c3 100644
--- a/dom/workers/WorkerScope.h
+++ b/dom/workers/WorkerScope.h
@@ -22,6 +22,7 @@
#include "mozilla/dom/ImageBitmapSource.h"
#include "mozilla/dom/PerformanceWorker.h"
#include "mozilla/dom/SafeRefPtr.h"
+#include "mozilla/dom/TrustedTypePolicyFactory.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
@@ -352,6 +353,8 @@ class WorkerGlobalScope : public WorkerGlobalScopeBase {
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void OnVsync(const VsyncEvent& aVsync) {}
+ TrustedTypePolicyFactory* TrustedTypes();
+
protected:
~WorkerGlobalScope();
@@ -376,6 +379,7 @@ class WorkerGlobalScope : public WorkerGlobalScopeBase {
RefPtr<cache::CacheStorage> mCacheStorage;
RefPtr<DebuggerNotificationManager> mDebuggerNotificationManager;
RefPtr<WebTaskSchedulerWorker> mWebTaskScheduler;
+ RefPtr<TrustedTypePolicyFactory> mTrustedTypePolicyFactory;
uint32_t mWindowInteractionsAllowed = 0;
bool mIsEligibleForMessaging{true};
};
diff --git a/dom/workers/remoteworkers/RemoteWorkerChild.cpp b/dom/workers/remoteworkers/RemoteWorkerChild.cpp
index a644439a8d..feb294f3fc 100644
--- a/dom/workers/remoteworkers/RemoteWorkerChild.cpp
+++ b/dom/workers/remoteworkers/RemoteWorkerChild.cpp
@@ -232,7 +232,12 @@ nsresult RemoteWorkerChild::ExecWorkerOnMainThread(RemoteWorkerData&& aData) {
// Ensure that the IndexedDatabaseManager is initialized so that if any
// workers do any IndexedDB calls that all of IDB's prefs/etc. are
// initialized.
- Unused << NS_WARN_IF(!IndexedDatabaseManager::GetOrCreate());
+ IndexedDatabaseManager* idm = IndexedDatabaseManager::GetOrCreate();
+ if (idm) {
+ Unused << NS_WARN_IF(NS_FAILED(idm->EnsureLocale()));
+ } else {
+ NS_WARNING("Failed to get IndexedDatabaseManager!");
+ }
auto scopeExit =
MakeScopeExit([&] { ExceptionalErrorTransitionDuringExecWorker(); });
diff --git a/dom/workers/test/WorkerDebugger.console_debugger.js b/dom/workers/test/WorkerDebugger.console_debugger.js
index a8b2493200..805b7fb387 100644
--- a/dom/workers/test/WorkerDebugger.console_debugger.js
+++ b/dom/workers/test/WorkerDebugger.console_debugger.js
@@ -1,5 +1,7 @@
"use strict";
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
function ok(a, msg) {
postMessage(JSON.stringify({ type: "status", what: !!a, msg }));
}
diff --git a/dom/workers/test/bug1014466_worker.js b/dom/workers/test/bug1014466_worker.js
index 2161954d2b..e06979d7b3 100644
--- a/dom/workers/test/bug1014466_worker.js
+++ b/dom/workers/test/bug1014466_worker.js
@@ -3,6 +3,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
function ok(a, msg) {
postMessage({ type: "status", status: !!a, msg });
}
diff --git a/dom/workers/test/notification_permission_worker.js b/dom/workers/test/notification_permission_worker.js
index 0e6b96d975..0551247d07 100644
--- a/dom/workers/test/notification_permission_worker.js
+++ b/dom/workers/test/notification_permission_worker.js
@@ -1,3 +1,5 @@
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
function info(message) {
dump("INFO: " + message + "\n");
}
diff --git a/dom/workers/test/notification_worker.js b/dom/workers/test/notification_worker.js
index 87aa02ac05..b97a4eb505 100644
--- a/dom/workers/test/notification_worker.js
+++ b/dom/workers/test/notification_worker.js
@@ -1,3 +1,5 @@
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
function ok(test, message) {
postMessage({ type: "ok", test, message });
}
diff --git a/dom/workers/test/notification_worker_child-child.js b/dom/workers/test/notification_worker_child-child.js
index 236e314e47..9356f1be7a 100644
--- a/dom/workers/test/notification_worker_child-child.js
+++ b/dom/workers/test/notification_worker_child-child.js
@@ -1,3 +1,5 @@
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
function ok(test, message) {
postMessage({ type: "ok", test, message });
}
diff --git a/dom/workers/test/onLine_worker_child.js b/dom/workers/test/onLine_worker_child.js
index 92542c018f..cee3052c90 100644
--- a/dom/workers/test/onLine_worker_child.js
+++ b/dom/workers/test/onLine_worker_child.js
@@ -3,10 +3,7 @@
* http://creativecommons.org/licenses/publicdomain/
*/
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/licenses/publicdomain/
- */
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
function info(text) {
dump("Test for Bug 925437: worker: " + text + "\n");
diff --git a/dom/workers/test/onLine_worker_head.js b/dom/workers/test/onLine_worker_head.js
index 632821b1f4..8c6d601aa5 100644
--- a/dom/workers/test/onLine_worker_head.js
+++ b/dom/workers/test/onLine_worker_head.js
@@ -3,6 +3,8 @@
* http://creativecommons.org/licenses/publicdomain/
*/
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
function info(text) {
dump("Test for Bug 925437: worker: " + text + "\n");
}
diff --git a/dom/workers/test/promise_worker.js b/dom/workers/test/promise_worker.js
index fd4a9177d6..1c2d080e5b 100644
--- a/dom/workers/test/promise_worker.js
+++ b/dom/workers/test/promise_worker.js
@@ -1,5 +1,7 @@
"use strict";
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
function ok(a, msg) {
dump("OK: " + !!a + " => " + a + " " + msg + "\n");
postMessage({ type: "status", status: !!a, msg: a + ": " + msg });
diff --git a/dom/workers/test/test_worker_interfaces.js b/dom/workers/test/test_worker_interfaces.js
index 3ea89ad6b5..efd108f85c 100644
--- a/dom/workers/test/test_worker_interfaces.js
+++ b/dom/workers/test/test_worker_interfaces.js
@@ -1,3 +1,5 @@
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
// This is a list of all interfaces that are exposed to workers.
// Please only add things to this list with great care and proper review
// from the associated module peers.
@@ -132,6 +134,10 @@ let interfaceNamesInGlobalScope = [
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "AbortSignal", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioData", insecureContext: true, nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "AudioDecoder", nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "Blob", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "BroadcastChannel", insecureContext: true },
@@ -180,10 +186,10 @@ let interfaceNamesInGlobalScope = [
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "DOMRectReadOnly", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
- { name: "DOMRequest", insecureContext: true, disabled: true },
- // IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "DOMStringList", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
+ { name: "EncodedAudioChunk", insecureContext: true, nightly: true },
+ // IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "EncodedVideoChunk", insecureContext: true, nightly: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "ErrorEvent", insecureContext: true },