tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit ebec92d70eba098284ff4e8effd8ab4e20404bc2
parent f9e1c5eb8c9a4c082cd5ba7b2f673c50b13c75e4
Author: Tooru Fujisawa <arai_a@mac.com>
Date:   Wed,  1 Oct 2025 08:51:15 +0000

Bug 1991358 - Part 3: Remove ScriptLoadRequest::MarkScriptForCache and ModuleLoadRequest::MarkModuleForCache. r=nbp

Differential Revision: https://phabricator.services.mozilla.com/D266620

Diffstat:
Mdom/script/ScriptLoader.cpp | 10+++++-----
Mdom/script/ScriptLoader.h | 6++----
Mjs/loader/ModuleLoadRequest.h | 2--
Mjs/loader/ScriptLoadRequest.cpp | 5-----
Mjs/loader/ScriptLoadRequest.h | 3---
5 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp @@ -3322,12 +3322,12 @@ nsCString& ScriptLoader::BytecodeMimeTypeFor( } void ScriptLoader::MaybePrepareForCacheBeforeExecute( - ScriptLoadRequest* aRequest, JS::Handle<JSScript*> aScript) { + ScriptLoadRequest* aRequest) { if (!aRequest->PassedConditionForEitherCache()) { return; } - aRequest->MarkScriptForCache(aScript); + aRequest->MarkForCache(); } nsresult ScriptLoader::MaybePrepareForCacheAfterExecute( @@ -3367,7 +3367,7 @@ void ScriptLoader::MaybePrepareModuleForCacheBeforeExecute( } if (aRequest->PassedConditionForEitherCache()) { - aRequest->MarkModuleForCache(); + aRequest->MarkForCache(); } for (auto* r = mCacheableDependencyModules.getFirst(); r; r = r->getNext()) { @@ -3379,7 +3379,7 @@ void ScriptLoader::MaybePrepareModuleForCacheBeforeExecute( } MOZ_ASSERT(!dep->IsMarkedForEitherCache()); - dep->MarkModuleForCache(); + dep->MarkForCache(); } } @@ -3498,7 +3498,7 @@ nsresult ScriptLoader::EvaluateScript(nsIGlobalObject* aGlobalObject, classicScriptValue, introductionScript, erv); if (!erv.Failed()) { - MaybePrepareForCacheBeforeExecute(aRequest, script); + MaybePrepareForCacheBeforeExecute(aRequest); { LOG(("ScriptLoadRequest (%p): Evaluate Script", aRequest)); diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h @@ -710,12 +710,10 @@ class ScriptLoader final : public JS::loader::ScriptLoaderInterface { static nsCString& BytecodeMimeTypeFor( JS::loader::LoadedScript* aLoadedScript); - // Decide whether to encode bytecode for given script load request, - // and store the script into the request if necessary. + // Decide whether to encode bytecode for given script load request. // // This method must be called before executing the script. - void MaybePrepareForCacheBeforeExecute(ScriptLoadRequest* aRequest, - JS::Handle<JSScript*> aScript); + void MaybePrepareForCacheBeforeExecute(ScriptLoadRequest* aRequest); // Queue the script load request for caching if we decided to cache it, or // cleanup the script load request fields otherwise. diff --git a/js/loader/ModuleLoadRequest.h b/js/loader/ModuleLoadRequest.h @@ -85,8 +85,6 @@ class ModuleLoadRequest final : public ScriptLoadRequest { return mRootModule; } - void MarkModuleForCache() { MarkForCache(); } - // Convenience methods to call into the module loader for this request. void CancelDynamicImport(nsresult aResult) { diff --git a/js/loader/ScriptLoadRequest.cpp b/js/loader/ScriptLoadRequest.cpp @@ -230,11 +230,6 @@ void ScriptLoadRequest::SetPendingFetchingError() { mState = State::PendingFetchingError; } -void ScriptLoadRequest::MarkScriptForCache(JSScript* aScript) { - MOZ_ASSERT(!IsModuleRequest()); - MarkForCache(); -} - static bool IsInternalURIScheme(nsIURI* uri) { return uri->SchemeIs("moz-extension") || uri->SchemeIs("resource") || uri->SchemeIs("moz-src") || uri->SchemeIs("chrome"); diff --git a/js/loader/ScriptLoadRequest.h b/js/loader/ScriptLoadRequest.h @@ -239,7 +239,6 @@ class ScriptLoadRequest : public nsISupports, return IsMarkedForDiskCache() || IsMarkedForMemoryCache(); } - protected: void MarkForCache() { MOZ_ASSERT(mDiskCachingPlan == CachingPlan::PassedCondition || mMemoryCachingPlan == CachingPlan::PassedCondition); @@ -253,8 +252,6 @@ class ScriptLoadRequest : public nsISupports, } public: - void MarkScriptForCache(JSScript* aScript); - mozilla::CORSMode CORSMode() const { return mFetchOptions->mCORSMode; } bool HasLoadContext() const { return mLoadContext; }