diff --git a/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp b/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp index 3e3b6807bf16..0b6c0a7b9059 100644 --- a/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp +++ b/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp @@ -707,16 +707,22 @@ nsresult FeatureData::InitializeList( nsIUrlClassifierFeature::URIType URIType; nsresult rv = mFeature->GetURIByListType(aChannel, aListType, &URIType, getter_AddRefs(uri)); - if (NS_WARN_IF(NS_FAILED(rv)) || !uri) { + if (NS_WARN_IF(NS_FAILED(rv))) { if (UC_LOG_ENABLED()) { nsAutoCString errorName; GetErrorName(rv, errorName); - UC_LOG(("FeatureData::InitializeList got an unexpected error (rv=%s)", - errorName.get())); + UC_LOG(("FeatureData::InitializeList[%p] got an unexpected error (rv=%s)", + this, errorName.get())); } return rv; } + if (!uri) { + // Return success when the URI is empty to conitnue to do the lookup. + UC_LOG(("FeatureData::InitializeList[%p] got an empty URL", this)); + return NS_OK; + } + nsCOMPtr innermostURI = NS_GetInnermostURI(uri); if (NS_WARN_IF(!innermostURI)) { return NS_ERROR_FAILURE; diff --git a/netwerk/url-classifier/UrlClassifierCommon.cpp b/netwerk/url-classifier/UrlClassifierCommon.cpp index 7b85cdcd88bb..c51258b7f024 100644 --- a/netwerk/url-classifier/UrlClassifierCommon.cpp +++ b/netwerk/url-classifier/UrlClassifierCommon.cpp @@ -338,7 +338,17 @@ nsresult UrlClassifierCommon::CreatePairwiseWhiteListURI(nsIChannel* aChannel, // Craft a whitelist URL like "toplevel.page/?resource=third.party.domain" nsAutoCString pageHostname, resourceDomain; rv = topWinURI->GetHost(pageHostname); - NS_ENSURE_SUCCESS(rv, rv); + if (NS_FAILED(rv)) { + // When the top-level page doesn't support GetHost, for example, about:home, + // we don't return an error here; instead, we return success to make sure + // that the lookup process calling this API continues to run. + UC_LOG( + ("CreatePairwiseWhiteListURI: Cannot get host from the top-level " + "(channel=%p)", + aChannel)); + return NS_OK; + } + rv = chanPrincipal->GetBaseDomain(resourceDomain); NS_ENSURE_SUCCESS(rv, rv); nsAutoCString whitelistEntry = NS_LITERAL_CSTRING("http://") + pageHostname +