From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- js/xpconnect/src/XPCJSRuntime.cpp | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'js/xpconnect/src/XPCJSRuntime.cpp') diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index c4d272b950..fd495ec964 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -8,13 +8,13 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/AutoRestore.h" +#include "mozilla/AppShutdown.h" #include "mozilla/MemoryReporting.h" #include "mozilla/UniquePtr.h" #include "xpcprivate.h" #include "xpcpublic.h" #include "XPCMaps.h" -#include "XPCWrapper.h" #include "XPCJSMemoryReporter.h" #include "XrayWrapper.h" #include "WrapperFactory.h" @@ -28,11 +28,9 @@ #include "nsIObserverService.h" #include "mozilla/dom/Document.h" #include "nsIRunnable.h" -#include "nsIPlatformInfo.h" #include "nsPIDOMWindow.h" #include "nsPrintfCString.h" #include "nsScriptSecurityManager.h" -#include "nsThreadPool.h" #include "nsWindowSizes.h" #include "mozilla/BasePrincipal.h" #include "mozilla/Preferences.h" @@ -40,6 +38,7 @@ #include "mozilla/Services.h" #include "mozilla/dom/ScriptLoader.h" #include "mozilla/dom/ScriptSettings.h" +#include "mozilla/glean/GleanMetrics.h" #include "nsContentUtils.h" #include "nsCCUncollectableMarker.h" @@ -613,9 +612,13 @@ JSObject* NACScope(JSObject* global) { return scope; } -JSObject* PrivilegedJunkScope() { return XPCJSRuntime::Get()->LoaderGlobal(); } +JSObject* PrivilegedJunkScope() { + return mozJSModuleLoader::Get()->GetSharedGlobal(); +} -JSObject* CompilationScope() { return XPCJSRuntime::Get()->LoaderGlobal(); } +JSObject* CompilationScope() { + return mozJSModuleLoader::Get()->GetSharedGlobal(); +} nsGlobalWindowInner* WindowOrNull(JSObject* aObj) { MOZ_ASSERT(aObj); @@ -1454,6 +1457,9 @@ static void ReportZoneStats(const JS::ZoneStats& zStats, zStats.regExpSharedsMallocHeap, "Shared compiled regexp data."); + ZRREPORT_BYTES(pathPrefix + "zone-object"_ns, zStats.zoneObject, + "The JS::Zone object itself."); + ZRREPORT_BYTES(pathPrefix + "regexp-zone"_ns, zStats.regexpZone, "The regexp zone and regexp data."); @@ -2638,9 +2644,6 @@ static void SetUseCounterCallback(JSObject* obj, JSUseCounter counter) { case JSUseCounter::WASM_LEGACY_EXCEPTIONS: SetUseCounter(obj, eUseCounter_custom_JS_wasm_legacy_exceptions); break; - case JSUseCounter::LATE_WEEKDAY: - SetUseCounter(obj, eUseCounter_custom_JS_late_weekday); - break; default: MOZ_ASSERT_UNREACHABLE("Unexpected JSUseCounter id"); } @@ -2905,8 +2908,6 @@ void ConstructUbiNode(void* storage, JSObject* ptr) { } void XPCJSRuntime::Initialize(JSContext* cx) { - mLoaderGlobal.init(cx, nullptr); - // these jsids filled in later when we have a JSContext to work with. mStrIDs[0] = JS::PropertyKey::Void(); @@ -3191,20 +3192,6 @@ void XPCJSRuntime::DeleteSingletonScopes() { sandbox->ReleaseWrapper(sandbox); mUnprivilegedJunkScope = nullptr; } - mLoaderGlobal = nullptr; -} - -JSObject* XPCJSRuntime::LoaderGlobal() { - if (!mLoaderGlobal) { - RefPtr loader = mozJSModuleLoader::Get(); - - dom::AutoJSAPI jsapi; - jsapi.Init(); - - mLoaderGlobal = loader->GetSharedGlobal(jsapi.cx()); - MOZ_RELEASE_ASSERT(!JS_IsExceptionPending(jsapi.cx())); - } - return mLoaderGlobal; } uint32_t GetAndClampCPUCount() { -- cgit v1.2.3