Skip to content

Commit

Permalink
Bug 1864267. Silence warning in BasePrincipal::GetIsLoopbackHost. r=n…
Browse files Browse the repository at this point in the history
…chevobbe

Just starting up a debug build you will get 40 copies of this printed.

The uri that we fail to get host of is about:newtab. One stack looks like this

#2: mozilla::BasePrincipal::GetIsLoopbackHost(bool*)
#3: mozilla::net::LoadInfo::LoadInfo(nsIPrincipal*, nsIPrincipal*, nsINode*, unsigned int, nsIContentPolicy::nsContentPolicyType, mozilla::Maybe<mozilla::dom::ClientInfo> const&, mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> const&, unsigned int, bool
#4: ShouldLoadCachedImage(imgRequest*, mozilla::dom::Document*, nsIPrincipal*, nsIContentPolicy::nsContentPolicyType, bool)
#5: imgLoader::LoadImage(nsIURI*, nsIURI*, nsIReferrerInfo*, nsIPrincipal*, unsigned long long, nsILoadGroup*, imgINotificationObserver*, nsINode*, mozilla::dom::Document*, unsigned int, nsISupports*, nsIContentPolicy::nsContentPolicyType, nsTSubstring<char16
#6: nsContentUtils::LoadImage(nsIURI*, nsINode*, mozilla::dom::Document*, nsIPrincipal*, unsigned long long, nsIReferrerInfo*, imgINotificationObserver*, int, nsTSubstring<char16_t> const&, imgRequestProxy**, nsIContentPolicy::nsContentPolicyType, bool, bool,
#7: mozilla::css::ImageLoader::LoadImage(mozilla::StyleComputedUrl const&, mozilla::dom::Document&)
#8: mozilla::StyleComputedUrl::ResolveImage(mozilla::dom::Document&, mozilla::StyleComputedUrl const*)
#9: nsStyleImageLayers::ResolveImages(mozilla::dom::Document&, nsStyleImageLayers const*)
#10: mozilla::ComputedStyle::StartImageLoads(mozilla::dom::Document&, mozilla::ComputedStyle const*)

Differential Revision: https://phabricator.services.mozilla.com/D193349
  • Loading branch information
tnikkel committed Nov 15, 2023
1 parent 2fd3d09 commit 240eece
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion caps/BasePrincipal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,9 @@ BasePrincipal::GetIsLoopbackHost(bool* aRes) {
nsAutoCString host;
nsresult rv = GetHost(host);
// Swallow potential failure as this method is infallible.
NS_ENSURE_SUCCESS(rv, NS_OK);
if (NS_FAILED(rv)) {
return NS_OK;
}

*aRes = nsMixedContentBlocker::IsPotentiallyTrustworthyLoopbackHost(host);
return NS_OK;
Expand Down

0 comments on commit 240eece

Please sign in to comment.