Bug 1406278: Part 6 - Use subject principal as triggering principal in <source> "srcset" attribute for <picture>. r=bz
MozReview-Commit-ID: DFq3k9PSOgA
This commit is contained in:
@@ -1044,6 +1044,8 @@ HTMLImageElement::PictureSourceSrcsetChanged(nsIContent *aSourceNode,
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
if (aSourceNode == this) {
|
||||
principal = mSrcsetTriggeringPrincipal;
|
||||
} else if (auto* source = HTMLSourceElement::FromContent(aSourceNode)) {
|
||||
principal = source->GetSrcsetTriggeringPrincipal();
|
||||
}
|
||||
mResponsiveSelector->SetCandidatesFromSourceSet(aNewValue, principal);
|
||||
}
|
||||
@@ -1238,6 +1240,8 @@ HTMLImageElement::TryCreateResponsiveSelector(nsIContent *aSourceNode)
|
||||
if (!SourceElementMatches(aSourceNode)) {
|
||||
return false;
|
||||
}
|
||||
auto* source = HTMLSourceElement::FromContent(aSourceNode);
|
||||
principal = source->GetSrcsetTriggeringPrincipal();
|
||||
} else if (aSourceNode->IsHTMLElement(nsGkAtoms::img)) {
|
||||
// Otherwise this is the <img> tag itself
|
||||
MOZ_ASSERT(aSourceNode == this);
|
||||
|
||||
Reference in New Issue
Block a user