commit 25350f05abd9ae7b5b426da4f02214b019122c47
parent 74480486333e130675183a0f20b69b08dec741a0
Author: Tooru Fujisawa <arai_a@mac.com>
Date: Tue, 2 Dec 2025 01:25:51 +0000
Bug 2002199 - Part 2: Remove {LoadedScript,LoadedScriptDelegate}::IsSource. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D273969
Diffstat:
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
@@ -2780,7 +2780,7 @@ void ScriptLoader::CalculateCacheFlag(ScriptLoadRequest* aRequest) {
aRequest));
aRequest->MarkNotCacheable();
MOZ_ASSERT(!aRequest->getLoadedScript()->HasDiskCacheReference());
- MOZ_ASSERT_IF(aRequest->IsSource(),
+ MOZ_ASSERT_IF(aRequest->IsTextSource(),
aRequest->HasNoSRIOrSRIAndSerializedStencil());
return;
}
@@ -2826,7 +2826,7 @@ void ScriptLoader::CalculateCacheFlag(ScriptLoadRequest* aRequest) {
"!LoadedScript::HasDiskCacheReference",
aRequest));
aRequest->MarkSkippedDiskCaching();
- MOZ_ASSERT_IF(aRequest->IsSource(),
+ MOZ_ASSERT_IF(aRequest->IsTextSource(),
aRequest->HasNoSRIOrSRIAndSerializedStencil());
return;
}
@@ -3172,7 +3172,7 @@ void ScriptLoader::InstantiateClassicScriptFromMaybeEncodedSource(
return;
}
- MOZ_ASSERT(aRequest->IsSource());
+ MOZ_ASSERT(aRequest->IsTextSource());
CollectDelazifications collectDelazifications =
aRequest->PassedConditionForEitherCache() ? CollectDelazifications::Yes
: CollectDelazifications::No;
@@ -4133,7 +4133,7 @@ nsresult ScriptLoader::OnStreamComplete(
// If we are loading from source, store the cache info channel and
// save the computed SRI hash or a dummy SRI hash in case we are going to
// save the this script in the disk cache.
- if (aRequest->IsSource() &&
+ if (aRequest->IsTextSource() &&
StaticPrefs::dom_script_loader_bytecode_cache_enabled()) {
aRequest->getLoadedScript()->mCacheInfo = cacheInfo;
LOG(("ScriptLoadRequest (%p): nsICacheInfoChannel = %p", aRequest,
@@ -4202,7 +4202,7 @@ nsresult ScriptLoader::VerifySRI(ScriptLoadRequest* aRequest,
nsresult ScriptLoader::SaveSRIHash(
ScriptLoadRequest* aRequest, SRICheckDataVerifier* aSRIDataVerifier) const {
- MOZ_ASSERT(aRequest->IsSource());
+ MOZ_ASSERT(aRequest->IsTextSource());
JS::TranscodeBuffer& sri = aRequest->SRI();
MOZ_ASSERT(sri.empty());
diff --git a/js/loader/LoadedScript.h b/js/loader/LoadedScript.h
@@ -148,7 +148,6 @@ class LoadedScript : public nsIMemoryReporter {
bool IsUnknownDataType() const { return mDataType == DataType::eUnknown; }
bool IsTextSource() const { return mDataType == DataType::eTextSource; }
- bool IsSource() const { return IsTextSource(); }
bool IsSerializedStencil() const {
return mDataType == DataType::eSerializedStencil;
}
@@ -233,7 +232,7 @@ class LoadedScript : public nsIMemoryReporter {
// ---- For SRI-only consumers ----
- bool CanHaveSRIOnly() const { return IsSource() || IsCachedStencil(); }
+ bool CanHaveSRIOnly() const { return IsTextSource() || IsCachedStencil(); }
bool HasSRI() {
MOZ_ASSERT(CanHaveSRIOnly());
@@ -315,7 +314,7 @@ class LoadedScript : public nsIMemoryReporter {
void DropDiskCacheReferenceAndSRI() {
DropDiskCacheReference();
- if (IsSource()) {
+ if (IsTextSource()) {
DropSRI();
}
}
@@ -494,7 +493,6 @@ class LoadedScriptDelegate {
return GetLoadedScript()->IsUnknownDataType();
}
bool IsTextSource() const { return GetLoadedScript()->IsTextSource(); }
- bool IsSource() const { return GetLoadedScript()->IsSource(); }
bool IsSerializedStencil() const {
return GetLoadedScript()->IsSerializedStencil();
}