tor-browser

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

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

Bug 1994617 - Part 3: Use CachingPlan::NotCacheable for inline scripts. r=nbp

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

Diffstat:
Mdom/script/ScriptLoader.cpp | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp @@ -2688,6 +2688,17 @@ void ScriptLoader::CalculateCacheFlag(ScriptLoadRequest* aRequest) { using mozilla::TimeDuration; using mozilla::TimeStamp; + if (aRequest->GetScriptLoadContext()->mIsInline) { + LOG(("ScriptLoadRequest (%p): Bytecode-cache: Skip all: Inline script", + aRequest)); + aRequest->MarkNotCacheable(); + MOZ_ASSERT(!aRequest->getLoadedScript()->HasDiskCacheReference()); + // NOTE: An inline script tag can have an SRI, but we don't calculate it + // for this case. + MOZ_ASSERT(aRequest->SRIAndBytecode().empty()); + return; + } + if (aRequest->IsBytecode()) { LOG(("ScriptLoadRequest (%p): Bytecode-cache: Skip all: IsBytecode", aRequest)); @@ -3238,10 +3249,6 @@ ScriptLoader::CacheBehavior ScriptLoader::GetCacheBehavior( return CacheBehavior::DoNothing; } - if (aRequest->GetScriptLoadContext()->mIsInline) { - 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