author | Tooru Fujisawa <arai_a@mac.com> |
Wed, 14 Feb 2024 02:01:36 +0000 (17 months ago) | |
changeset 695591 | d3d41616259c271fb372b504addc1b05dea6d98b |
parent 695590 | 0fff927336814aa029170d9ee5bbc3c342e96061 |
child 695592 | 5937cea3bd8178552cb1051ac9515867ad821788 |
push id | 199962 |
push user | arai_a@mac.com |
push date | Wed, 14 Feb 2024 02:06:15 +0000 (17 months ago) |
treeherder | autoland@8afc625dd4fd [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jonco |
bugs | 1803810 |
milestone | 124.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/loader/LoadContextBase.cpp +++ b/js/loader/LoadContextBase.cpp @@ -1,16 +1,16 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/dom/ScriptLoadContext.h" -#include "mozilla/loader/ComponentModuleLoader.h" +#include "mozilla/loader/SyncModuleLoader.h" #include "mozilla/dom/WorkerLoadContext.h" #include "mozilla/dom/worklet/WorkletModuleLoader.h" // WorkletLoadContext #include "js/loader/LoadContextBase.h" #include "js/loader/ScriptLoadRequest.h" namespace JS::loader { //////////////////////////////////////////////////////////////// @@ -37,19 +37,19 @@ void LoadContextBase::GetProfilerLabel(n aOutString.Append("Unknown Script Element"); } mozilla::dom::ScriptLoadContext* LoadContextBase::AsWindowContext() { MOZ_ASSERT(IsWindowContext()); return static_cast<mozilla::dom::ScriptLoadContext*>(this); } -mozilla::loader::ComponentLoadContext* LoadContextBase::AsComponentContext() { - MOZ_ASSERT(IsComponentContext()); - return static_cast<mozilla::loader::ComponentLoadContext*>(this); +mozilla::loader::SyncLoadContext* LoadContextBase::AsSyncContext() { + MOZ_ASSERT(IsSyncContext()); + return static_cast<mozilla::loader::SyncLoadContext*>(this); } mozilla::dom::WorkerLoadContext* LoadContextBase::AsWorkerContext() { MOZ_ASSERT(IsWorkerContext()); return static_cast<mozilla::dom::WorkerLoadContext*>(this); } mozilla::dom::WorkletLoadContext* LoadContextBase::AsWorkletContext() {
--- a/js/loader/LoadContextBase.h +++ b/js/loader/LoadContextBase.h @@ -12,32 +12,32 @@ namespace mozilla::dom { class ScriptLoadContext; class WorkerLoadContext; class WorkletLoadContext; } // namespace mozilla::dom namespace mozilla::loader { -class ComponentLoadContext; +class SyncLoadContext; } namespace JS::loader { class ScriptLoadRequest; /* * LoadContextBase * * LoadContexts augment the loading of a ScriptLoadRequest. This class * is used as a base for all LoadContexts, and provides shared functionality. * */ -enum class ContextKind { Window, Component, Worker, Worklet }; +enum class ContextKind { Window, Sync, Worker, Worklet }; class LoadContextBase : public nsISupports { private: ContextKind mKind; protected: virtual ~LoadContextBase() = default; @@ -51,18 +51,18 @@ class LoadContextBase : public nsISuppor // Used to output a string for the Gecko Profiler. virtual void GetProfilerLabel(nsACString& aOutString); // Casting to the different contexts bool IsWindowContext() const { return mKind == ContextKind::Window; } mozilla::dom::ScriptLoadContext* AsWindowContext(); - bool IsComponentContext() const { return mKind == ContextKind::Component; } - mozilla::loader::ComponentLoadContext* AsComponentContext(); + bool IsSyncContext() const { return mKind == ContextKind::Sync; } + mozilla::loader::SyncLoadContext* AsSyncContext(); bool IsWorkerContext() const { return mKind == ContextKind::Worker; } mozilla::dom::WorkerLoadContext* AsWorkerContext(); bool IsWorkletContext() const { return mKind == ContextKind::Worklet; } mozilla::dom::WorkletLoadContext* AsWorkletContext(); RefPtr<JS::loader::ScriptLoadRequest> mRequest;
--- a/js/loader/ScriptLoadRequest.cpp +++ b/js/loader/ScriptLoadRequest.cpp @@ -125,20 +125,19 @@ bool ScriptLoadRequest::HasWorkerLoadCon return HasLoadContext() && mLoadContext->IsWorkerContext(); } mozilla::dom::ScriptLoadContext* ScriptLoadRequest::GetScriptLoadContext() { MOZ_ASSERT(mLoadContext); return mLoadContext->AsWindowContext(); } -mozilla::loader::ComponentLoadContext* -ScriptLoadRequest::GetComponentLoadContext() { +mozilla::loader::SyncLoadContext* ScriptLoadRequest::GetSyncLoadContext() { MOZ_ASSERT(mLoadContext); - return mLoadContext->AsComponentContext(); + return mLoadContext->AsSyncContext(); } mozilla::dom::WorkerLoadContext* ScriptLoadRequest::GetWorkerLoadContext() { MOZ_ASSERT(mLoadContext); return mLoadContext->AsWorkerContext(); } mozilla::dom::WorkletLoadContext* ScriptLoadRequest::GetWorkletLoadContext() {
--- a/js/loader/ScriptLoadRequest.h +++ b/js/loader/ScriptLoadRequest.h @@ -33,17 +33,17 @@ namespace mozilla::dom { class ScriptLoadContext; class WorkerLoadContext; class WorkletLoadContext; enum class RequestPriority : uint8_t; } // namespace mozilla::dom namespace mozilla::loader { -class ComponentLoadContext; +class SyncLoadContext; } // namespace mozilla::loader namespace JS { namespace loader { class LoadContextBase; class ModuleLoadRequest; class ScriptLoadRequestList; @@ -189,17 +189,17 @@ class ScriptLoadRequest : public nsISupp void DropBytecodeCacheReferences(); bool HasLoadContext() const { return mLoadContext; } bool HasScriptLoadContext() const; bool HasWorkerLoadContext() const; mozilla::dom::ScriptLoadContext* GetScriptLoadContext(); - mozilla::loader::ComponentLoadContext* GetComponentLoadContext(); + mozilla::loader::SyncLoadContext* GetSyncLoadContext(); mozilla::dom::WorkerLoadContext* GetWorkerLoadContext(); mozilla::dom::WorkletLoadContext* GetWorkletLoadContext(); const LoadedScript* getLoadedScript() const { return mLoadedScript.get(); } LoadedScript* getLoadedScript() { return mLoadedScript.get(); }
rename from js/xpconnect/loader/ComponentModuleLoader.cpp rename to js/xpconnect/loader/SyncModuleLoader.cpp --- a/js/xpconnect/loader/ComponentModuleLoader.cpp +++ b/js/xpconnect/loader/SyncModuleLoader.cpp @@ -1,102 +1,99 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ComponentModuleLoader.h" +#include "SyncModuleLoader.h" #include "nsISupportsImpl.h" #include "js/loader/ModuleLoadRequest.h" #include "js/RootingAPI.h" // JS::Rooted #include "js/PropertyAndElement.h" // JS_SetProperty #include "js/Value.h" // JS::Value, JS::NumberValue #include "mozJSModuleLoader.h" using namespace JS::loader; namespace mozilla { namespace loader { ////////////////////////////////////////////////////////////// -// ComponentScriptLoader +// SyncScriptLoader ////////////////////////////////////////////////////////////// -NS_IMPL_ISUPPORTS0(ComponentScriptLoader) +NS_IMPL_ISUPPORTS0(SyncScriptLoader) -nsIURI* ComponentScriptLoader::GetBaseURI() const { return nullptr; } +nsIURI* SyncScriptLoader::GetBaseURI() const { return nullptr; } -void ComponentScriptLoader::ReportErrorToConsole(ScriptLoadRequest* aRequest, - nsresult aResult) const {} +void SyncScriptLoader::ReportErrorToConsole(ScriptLoadRequest* aRequest, + nsresult aResult) const {} -void ComponentScriptLoader::ReportWarningToConsole( +void SyncScriptLoader::ReportWarningToConsole( ScriptLoadRequest* aRequest, const char* aMessageName, const nsTArray<nsString>& aParams) const {} -nsresult ComponentScriptLoader::FillCompileOptionsForRequest( +nsresult SyncScriptLoader::FillCompileOptionsForRequest( JSContext* cx, ScriptLoadRequest* aRequest, JS::CompileOptions* aOptions, JS::MutableHandle<JSScript*> aIntroductionScript) { return NS_OK; } ////////////////////////////////////////////////////////////// -// ComponentModuleLoader +// SyncModuleLoader ////////////////////////////////////////////////////////////// -NS_IMPL_ADDREF_INHERITED(ComponentModuleLoader, JS::loader::ModuleLoaderBase) -NS_IMPL_RELEASE_INHERITED(ComponentModuleLoader, JS::loader::ModuleLoaderBase) +NS_IMPL_ADDREF_INHERITED(SyncModuleLoader, JS::loader::ModuleLoaderBase) +NS_IMPL_RELEASE_INHERITED(SyncModuleLoader, JS::loader::ModuleLoaderBase) -NS_IMPL_CYCLE_COLLECTION_INHERITED(ComponentModuleLoader, +NS_IMPL_CYCLE_COLLECTION_INHERITED(SyncModuleLoader, JS::loader::ModuleLoaderBase, mLoadRequests) -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ComponentModuleLoader) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SyncModuleLoader) NS_INTERFACE_MAP_END_INHERITING(JS::loader::ModuleLoaderBase) -ComponentModuleLoader::ComponentModuleLoader( - ComponentScriptLoader* aScriptLoader, nsIGlobalObject* aGlobalObject) +SyncModuleLoader::SyncModuleLoader(SyncScriptLoader* aScriptLoader, + nsIGlobalObject* aGlobalObject) : ModuleLoaderBase(aScriptLoader, aGlobalObject) {} -ComponentModuleLoader::~ComponentModuleLoader() { - MOZ_ASSERT(mLoadRequests.isEmpty()); -} +SyncModuleLoader::~SyncModuleLoader() { MOZ_ASSERT(mLoadRequests.isEmpty()); } -already_AddRefed<ModuleLoadRequest> ComponentModuleLoader::CreateStaticImport( +already_AddRefed<ModuleLoadRequest> SyncModuleLoader::CreateStaticImport( nsIURI* aURI, ModuleLoadRequest* aParent) { - RefPtr<ComponentLoadContext> context = new ComponentLoadContext(); + RefPtr<SyncLoadContext> context = new SyncLoadContext(); RefPtr<ModuleLoadRequest> request = new ModuleLoadRequest( aURI, aParent->ReferrerPolicy(), aParent->mFetchOptions, dom::SRIMetadata(), aParent->mURI, context, false, /* is top level */ false, /* is dynamic import */ this, aParent->mVisitedSet, aParent->GetRootModule()); request->NoCacheEntryFound(); return request.forget(); } -already_AddRefed<ModuleLoadRequest> ComponentModuleLoader::CreateDynamicImport( +already_AddRefed<ModuleLoadRequest> SyncModuleLoader::CreateDynamicImport( JSContext* aCx, nsIURI* aURI, LoadedScript* aMaybeActiveScript, JS::Handle<JSString*> aSpecifier, JS::Handle<JSObject*> aPromise) { - RefPtr<ComponentLoadContext> context = new ComponentLoadContext(); + RefPtr<SyncLoadContext> context = new SyncLoadContext(); RefPtr<ModuleLoadRequest> request = new ModuleLoadRequest( aURI, aMaybeActiveScript->ReferrerPolicy(), aMaybeActiveScript->GetFetchOptions(), dom::SRIMetadata(), aMaybeActiveScript->BaseURL(), context, /* aIsTopLevel = */ true, /* aIsDynamicImport = */ true, this, ModuleLoadRequest::NewVisitedSetForTopLevelImport(aURI), nullptr); request->SetDynamicImport(aMaybeActiveScript, aSpecifier, aPromise); request->NoCacheEntryFound(); return request.forget(); } -void ComponentModuleLoader::OnDynamicImportStarted( - ModuleLoadRequest* aRequest) { +void SyncModuleLoader::OnDynamicImportStarted(ModuleLoadRequest* aRequest) { MOZ_ASSERT(aRequest->IsDynamicImport()); MOZ_ASSERT(!mLoadRequests.Contains(aRequest)); if (aRequest->IsFetching()) { // This module is newly imported. // // DynamicImportRequests() can contain multiple requests when a dynamic // import is performed while evaluating the top-level script of other @@ -123,22 +120,22 @@ void ComponentModuleLoader::OnDynamicImp // This module had already been imported. MOZ_ASSERT(DynamicImportRequests().isEmpty()); MOZ_ASSERT(mLoadRequests.isEmpty()); } ProcessDynamicImport(aRequest); } -bool ComponentModuleLoader::CanStartLoad(ModuleLoadRequest* aRequest, - nsresult* aRvOut) { +bool SyncModuleLoader::CanStartLoad(ModuleLoadRequest* aRequest, + nsresult* aRvOut) { return mozJSModuleLoader::IsTrustedScheme(aRequest->mURI); } -nsresult ComponentModuleLoader::StartFetch(ModuleLoadRequest* aRequest) { +nsresult SyncModuleLoader::StartFetch(ModuleLoadRequest* aRequest) { MOZ_ASSERT(aRequest->HasLoadContext()); aRequest->mBaseURL = aRequest->mURI; // Loading script source and compilation are intertwined in // mozJSModuleLoader. Perform both operations here but only report load // failures. Compilation failure is reported in CompileFetchedModule. @@ -181,17 +178,17 @@ nsresult ComponentModuleLoader::StartFet JS_ClearPendingException(cx); } } return rv; } // Otherwise remember the results in this context so we can report them later. - ComponentLoadContext* context = aRequest->GetComponentLoadContext(); + SyncLoadContext* context = aRequest->GetSyncLoadContext(); context->mRv = rv; if (threwException) { context->mExceptionValue.init(cx); if (!jsapi.StealException(&context->mExceptionValue)) { return NS_ERROR_OUT_OF_MEMORY; } } if (script) { @@ -202,54 +199,54 @@ nsresult ComponentModuleLoader::StartFet if (!aRequest->IsDynamicImport()) { // NOTE: Dynamic import is stored into mDynamicImportRequests. mLoadRequests.AppendElement(aRequest); } return NS_OK; } -nsresult ComponentModuleLoader::CompileFetchedModule( +nsresult SyncModuleLoader::CompileFetchedModule( JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::CompileOptions& aOptions, ModuleLoadRequest* aRequest, JS::MutableHandle<JSObject*> aModuleOut) { // Compilation already happened in StartFetch. Report the result here. - ComponentLoadContext* context = aRequest->GetComponentLoadContext(); + SyncLoadContext* context = aRequest->GetSyncLoadContext(); nsresult rv = context->mRv; if (context->mScript) { aModuleOut.set(JS::GetModuleObject(context->mScript)); context->mScript = nullptr; } if (NS_FAILED(rv)) { JS_SetPendingException(aCx, context->mExceptionValue); context->mExceptionValue = JS::UndefinedValue(); } MOZ_ASSERT(JS_IsExceptionPending(aCx) == NS_FAILED(rv)); MOZ_ASSERT(bool(aModuleOut) == NS_SUCCEEDED(rv)); return rv; } -void ComponentModuleLoader::MaybeReportLoadError(JSContext* aCx) { +void SyncModuleLoader::MaybeReportLoadError(JSContext* aCx) { if (JS_IsExceptionPending(aCx)) { // Do not override. return; } if (mLoadException.isUndefined()) { return; } JS_SetPendingException(aCx, mLoadException); mLoadException = JS::UndefinedValue(); } -void ComponentModuleLoader::OnModuleLoadComplete(ModuleLoadRequest* aRequest) {} +void SyncModuleLoader::OnModuleLoadComplete(ModuleLoadRequest* aRequest) {} -nsresult ComponentModuleLoader::ProcessRequests() { +nsresult SyncModuleLoader::ProcessRequests() { // Work list to drive module loader since this is all synchronous. while (!mLoadRequests.isEmpty()) { RefPtr<ScriptLoadRequest> request = mLoadRequests.StealFirst(); nsresult rv = OnFetchComplete(request->AsModuleRequest(), NS_OK); if (NS_FAILED(rv)) { mLoadRequests.CancelRequestsAndClear(); return rv; }
rename from js/xpconnect/loader/ComponentModuleLoader.h rename to js/xpconnect/loader/SyncModuleLoader.h --- a/js/xpconnect/loader/ComponentModuleLoader.h +++ b/js/xpconnect/loader/SyncModuleLoader.h @@ -1,63 +1,63 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef mozilla_loader_ComponentModuleLoader_h -#define mozilla_loader_ComponentModuleLoader_h +#ifndef mozilla_loader_SyncModuleLoader_h +#define mozilla_loader_SyncModuleLoader_h #include "js/loader/LoadContextBase.h" #include "js/loader/ModuleLoaderBase.h" #include "SkipCheckForBrokenURLOrZeroSized.h" class mozJSModuleLoader; namespace mozilla { namespace loader { -class ComponentScriptLoader : public JS::loader::ScriptLoaderInterface { +class SyncScriptLoader : public JS::loader::ScriptLoaderInterface { public: NS_DECL_ISUPPORTS private: - ~ComponentScriptLoader() = default; + ~SyncScriptLoader() = default; nsIURI* GetBaseURI() const override; void ReportErrorToConsole(ScriptLoadRequest* aRequest, nsresult aResult) const override; void ReportWarningToConsole(ScriptLoadRequest* aRequest, const char* aMessageName, const nsTArray<nsString>& aParams) const override; nsresult FillCompileOptionsForRequest( JSContext* cx, ScriptLoadRequest* aRequest, JS::CompileOptions* aOptions, JS::MutableHandle<JSScript*> aIntroductionScript) override; }; -class ComponentModuleLoader : public JS::loader::ModuleLoaderBase { +class SyncModuleLoader : public JS::loader::ModuleLoaderBase { public: NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ComponentModuleLoader, + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SyncModuleLoader, JS::loader::ModuleLoaderBase) - ComponentModuleLoader(ComponentScriptLoader* aScriptLoader, - nsIGlobalObject* aGlobalObject); + SyncModuleLoader(SyncScriptLoader* aScriptLoader, + nsIGlobalObject* aGlobalObject); [[nodiscard]] nsresult ProcessRequests(); void MaybeReportLoadError(JSContext* aCx); private: - ~ComponentModuleLoader(); + ~SyncModuleLoader(); already_AddRefed<ModuleLoadRequest> CreateStaticImport( nsIURI* aURI, ModuleLoadRequest* aParent) override; already_AddRefed<ModuleLoadRequest> CreateDynamicImport( JSContext* aCx, nsIURI* aURI, LoadedScript* aMaybeActiveScript, JS::Handle<JSString*> aSpecifier, JS::Handle<JSObject*> aPromise) override; @@ -77,22 +77,21 @@ class ComponentModuleLoader : public JS: JS::loader::ScriptLoadRequestList mLoadRequests; // If any of module scripts failed to load, exception is set here until it's // reported by MaybeReportLoadError. JS::PersistentRooted<JS::Value> mLoadException; }; -// Data specific to ComponentModuleLoader that is associated with each load +// Data specific to SyncModuleLoader that is associated with each load // request. -class ComponentLoadContext : public JS::loader::LoadContextBase { +class SyncLoadContext : public JS::loader::LoadContextBase { public: - ComponentLoadContext() - : LoadContextBase(JS::loader::ContextKind::Component) {} + SyncLoadContext() : LoadContextBase(JS::loader::ContextKind::Sync) {} public: // The result of compiling a module script. These fields are used temporarily // before being passed to the module loader. nsresult mRv; SkipCheckForBrokenURLOrZeroSized mSkipCheck; @@ -101,9 +100,9 @@ class ComponentLoadContext : public JS:: JS::PersistentRooted<JS::Value> mExceptionValue; JS::PersistentRooted<JSScript*> mScript; }; } // namespace loader } // namespace mozilla -#endif // mozilla_loader_ComponentModuleLoader_h +#endif // mozilla_loader_SyncModuleLoader_h
--- a/js/xpconnect/loader/moz.build +++ b/js/xpconnect/loader/moz.build @@ -2,24 +2,24 @@ # vim: set filetype=python: # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ "AutoMemMap.cpp", "ChromeScriptLoader.cpp", - "ComponentModuleLoader.cpp", "JSMEnvironmentProxy.cpp", "ModuleEnvironmentProxy.cpp", "mozJSLoaderUtils.cpp", "mozJSSubScriptLoader.cpp", "nsImportModule.cpp", "ScriptCacheActors.cpp", "ScriptPreloader.cpp", + "SyncModuleLoader.cpp", "URLPreloader.cpp", ] # mozJSModuleLoader.cpp cannot be built in unified mode because it uses # windows.h SOURCES += [ "mozJSModuleLoader.cpp", ] @@ -38,19 +38,19 @@ EXPORTS.mozilla += [ ] EXPORTS.mozilla.dom += [ "PrecompiledScript.h", ] EXPORTS.mozilla.loader += [ "AutoMemMap.h", - "ComponentModuleLoader.h", "ScriptCacheActors.h", "SkipCheckForBrokenURLOrZeroSized.h", + "SyncModuleLoader.h", ] EXTRA_JS_MODULES += [ "ComponentUtils.sys.mjs", "XPCOMUtils.sys.mjs", ] FINAL_LIBRARY = "xul"
--- a/js/xpconnect/loader/mozJSModuleLoader.cpp +++ b/js/xpconnect/loader/mozJSModuleLoader.cpp @@ -297,17 +297,17 @@ class MOZ_STACK_CLASS ModuleLoaderInfo { explicit ModuleLoaderInfo(const nsACString& aLocation, SkipCheckForBrokenURLOrZeroSized aSkipCheck = SkipCheckForBrokenURLOrZeroSized::No) : mLocation(&aLocation), mIsModule(false), mSkipCheck(aSkipCheck) {} explicit ModuleLoaderInfo(JS::loader::ModuleLoadRequest* aRequest) : mLocation(nullptr), mURI(aRequest->mURI), mIsModule(true), - mSkipCheck(aRequest->GetComponentLoadContext()->mSkipCheck) {} + mSkipCheck(aRequest->GetSyncLoadContext()->mSkipCheck) {} SkipCheckForBrokenURLOrZeroSized getSkipCheckForBrokenURLOrZeroSized() const { return mSkipCheck; } void resetChannelWithCheckForBrokenURLOrZeroSized() { MOZ_ASSERT(mSkipCheck == SkipCheckForBrokenURLOrZeroSized::Yes); mSkipCheck = SkipCheckForBrokenURLOrZeroSized::No; @@ -634,18 +634,18 @@ void mozJSModuleLoader::CreateLoaderGlob return; } // Set the location information for the new global, so that tools like // about:memory may use that information xpc::SetLocationForGlobal(global, aLocation); MOZ_ASSERT(!mModuleLoader); - RefPtr<ComponentScriptLoader> scriptLoader = new ComponentScriptLoader; - mModuleLoader = new ComponentModuleLoader(scriptLoader, backstagePass); + RefPtr<SyncScriptLoader> scriptLoader = new SyncScriptLoader; + mModuleLoader = new SyncModuleLoader(scriptLoader, backstagePass); backstagePass->InitModuleLoader(mModuleLoader); aGlobal.set(global); } JSObject* mozJSModuleLoader::GetSharedGlobal(JSContext* aCx) { if (!mLoaderGlobal) { JS::RootedObject globalObj(aCx); @@ -665,17 +665,17 @@ JSObject* mozJSModuleLoader::GetSharedGl JS_FireOnNewGlobalObject(aes.cx(), globalObj); } return mLoaderGlobal; } /* static */ nsresult mozJSModuleLoader::LoadSingleModuleScript( - ComponentModuleLoader* aModuleLoader, JSContext* aCx, + SyncModuleLoader* aModuleLoader, JSContext* aCx, JS::loader::ModuleLoadRequest* aRequest, MutableHandleScript aScriptOut) { AUTO_PROFILER_MARKER_TEXT( "ChromeUtils.importESModule static import", JS, MarkerOptions(MarkerStack::Capture(), MarkerInnerWindowIdFromJSContext(aCx)), nsContentUtils::TruncatedURLForDisplay(aRequest->mURI)); ModuleLoaderInfo info(aRequest); @@ -1806,17 +1806,17 @@ nsresult mozJSModuleLoader::ImportESModu nsCOMPtr<nsIPrincipal> principal = mModuleLoader->GetGlobalObject()->PrincipalOrNull(); MOZ_ASSERT(principal); RefPtr<ScriptFetchOptions> options = new ScriptFetchOptions( CORS_NONE, /* aNonce = */ u""_ns, dom::RequestPriority::Auto, ParserMetadata::NotParserInserted, principal); - RefPtr<ComponentLoadContext> context = new ComponentLoadContext(); + RefPtr<SyncLoadContext> context = new SyncLoadContext(); context->mSkipCheck = aSkipCheck; RefPtr<VisitedURLSet> visitedSet = ModuleLoadRequest::NewVisitedSetForTopLevelImport(uri); RefPtr<ModuleLoadRequest> request = new ModuleLoadRequest( uri, dom::ReferrerPolicy::No_referrer, options, dom::SRIMetadata(), /* aReferrer = */ nullptr, context,
--- a/js/xpconnect/loader/mozJSModuleLoader.h +++ b/js/xpconnect/loader/mozJSModuleLoader.h @@ -2,17 +2,17 @@ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozJSModuleLoader_h #define mozJSModuleLoader_h -#include "ComponentModuleLoader.h" +#include "SyncModuleLoader.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/FileLocation.h" #include "mozilla/MemoryReporting.h" #include "mozilla/StaticPtr.h" #include "nsIMemoryReporter.h" #include "nsISupports.h" #include "nsIURI.h" #include "nsClassHashtable.h" @@ -112,20 +112,20 @@ class mozJSModuleLoader final : public n nsresult Unload(const nsACString& aResourceURI); nsresult IsModuleLoaded(const nsACString& aResourceURI, bool* aRetval); nsresult IsJSModuleLoaded(const nsACString& aResourceURI, bool* aRetval); nsresult IsESModuleLoaded(const nsACString& aResourceURI, bool* aRetval); bool IsLoaderGlobal(JSObject* aObj) { return mLoaderGlobal == aObj; } bool IsDevToolsLoader() const { return this == sDevToolsLoader; } - // Public methods for use from ComponentModuleLoader. + // Public methods for use from SyncModuleLoader. static bool IsTrustedScheme(nsIURI* aURI); static nsresult LoadSingleModuleScript( - mozilla::loader::ComponentModuleLoader* aModuleLoader, JSContext* aCx, + mozilla::loader::SyncModuleLoader* aModuleLoader, JSContext* aCx, JS::loader::ModuleLoadRequest* aRequest, JS::MutableHandleScript aScriptOut); size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); bool DefineJSServices(JSContext* aCx, JS::Handle<JSObject*> aGlobal); protected: @@ -253,12 +253,12 @@ class mozJSModuleLoader final : public n bool mInitialized; #ifdef DEBUG bool mIsInitializingLoaderGlobal = false; #endif JS::PersistentRooted<JSObject*> mLoaderGlobal; JS::PersistentRooted<JSObject*> mServicesObj; - RefPtr<mozilla::loader::ComponentModuleLoader> mModuleLoader; + RefPtr<mozilla::loader::SyncModuleLoader> mModuleLoader; }; #endif