tor-browser

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

commit 37cf677d0589e05879ad99a7eb4b66bd69002c12
parent fa8a3601f31aa1b3825196c588c058ba2b2a1b97
Author: Tooru Fujisawa <arai_a@mac.com>
Date:   Wed, 29 Oct 2025 09:37:24 +0000

Bug 1994617 - Part 4: Use CachingPlan::NotCacheable for non-http/https. r=nbp

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

Diffstat:
Mdom/script/ScriptLoader.cpp | 19++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp @@ -2699,6 +2699,18 @@ void ScriptLoader::CalculateCacheFlag(ScriptLoadRequest* aRequest) { return; } + if (!aRequest->URI()->SchemeIs("http") && + !aRequest->URI()->SchemeIs("https")) { + LOG(("ScriptLoadRequest (%p): Bytecode-cache: Skip all: Unsupported scheme", + aRequest)); + // Internal resources can be exposed to the web content, but they don't + // have to be cached. + aRequest->MarkNotCacheable(); + MOZ_ASSERT(!aRequest->getLoadedScript()->HasDiskCacheReference()); + MOZ_ASSERT(aRequest->SRIAndBytecode().empty()); + return; + } + if (aRequest->IsBytecode()) { LOG(("ScriptLoadRequest (%p): Bytecode-cache: Skip all: IsBytecode", aRequest)); @@ -3249,13 +3261,6 @@ ScriptLoader::CacheBehavior ScriptLoader::GetCacheBehavior( return CacheBehavior::DoNothing; } - if (!aRequest->URI()->SchemeIs("http") && - !aRequest->URI()->SchemeIs("https")) { - // Internal resources can be exposed to the web content, but they don't - // have to be cached. - return CacheBehavior::DoNothing; - } - if (aRequest->ExpirationTime().IsExpired()) { return CacheBehavior::Evict; }