tor-browser

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

commit 1d9354174aa8fb27929059ca435eddf802639d32
parent 63333e6ccd4c9887f9b7a64646257016ba70da8c
Author: Tooru Fujisawa <arai_a@mac.com>
Date:   Mon, 20 Oct 2025 09:06:25 +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 @@ -3300,12 +3300,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( @@ -3345,7 +3345,7 @@ void ScriptLoader::MaybePrepareModuleForCacheBeforeExecute( } if (aRequest->PassedConditionForEitherCache()) { - aRequest->MarkModuleForCache(); + aRequest->MarkForCache(); } for (auto* r = mCacheableDependencyModules.getFirst(); r; r = r->getNext()) { @@ -3357,7 +3357,7 @@ void ScriptLoader::MaybePrepareModuleForCacheBeforeExecute( } MOZ_ASSERT(!dep->IsMarkedForEitherCache()); - dep->MarkModuleForCache(); + dep->MarkForCache(); } } @@ -3476,7 +3476,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 @@ -83,8 +83,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 @@ -244,11 +244,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; }