mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Bug 1447935 - P1. CreatePairwiseEntitylist uses loading principal when a channel doesn't have an associated top-level window r=baku
loads in appcache doesn't have a top-level window, use loading principal instead. Differential Revision: https://phabricator.services.mozilla.com/D80186
This commit is contained in:
parent
b355fcc4bf
commit
5c5dfa4064
@ -336,12 +336,26 @@ nsresult UrlClassifierCommon::CreatePairwiseEntityListURI(nsIChannel* aChannel,
|
||||
auto clientPrincipalOrErr = clientInfo->GetPrincipal();
|
||||
if (clientPrincipalOrErr.isOk()) {
|
||||
nsCOMPtr<nsIPrincipal> principal = clientPrincipalOrErr.unwrap();
|
||||
auto* basePrin = BasePrincipal::Cast(principal);
|
||||
rv = basePrin->GetURI(getter_AddRefs(topWinURI));
|
||||
Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||
if (principal) {
|
||||
auto* basePrin = BasePrincipal::Cast(principal);
|
||||
rv = basePrin->GetURI(getter_AddRefs(topWinURI));
|
||||
Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!topWinURI) {
|
||||
UC_LOG(
|
||||
("CreatePairwiseWhiteListURI: No top-level window associated with "
|
||||
"channel, get URI from loading principal instead"));
|
||||
nsCOMPtr<nsIPrincipal> principal = loadInfo->GetLoadingPrincipal();
|
||||
if (principal) {
|
||||
auto* basePrin = BasePrincipal::Cast(principal);
|
||||
rv = basePrin->GetURI(getter_AddRefs(topWinURI));
|
||||
Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!topWinURI) {
|
||||
@ -354,7 +368,7 @@ nsresult UrlClassifierCommon::CreatePairwiseEntityListURI(nsIChannel* aChannel,
|
||||
uri->GetAsciiSpec(spec);
|
||||
spec.Truncate(
|
||||
std::min(spec.Length(), UrlClassifierCommon::sMaxSpecLength));
|
||||
UC_LOG(("CreatePairwiseEntityListURI: No window URI associated with %s",
|
||||
UC_LOG(("CreatePairwiseEntityListURI: No top-level URI associated with %s",
|
||||
spec.get()));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user