Bug 1778298 - gradient href should ignore base tag if local r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D151130
This commit is contained in:
Robert Longson 2022-07-06 17:12:23 +00:00
parent 5a69613d97
commit 18bbb02fab
3 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<base href="/"/>
</head>
<body bgcolor="lime">
<svg width="100%" height="100%">
<defs>
<linearGradient id="b">
<stop offset="0" stop-color="lime"/>
<stop offset="1" stop-color="lime"/>
</linearGradient>
<linearGradient id="a" xlink:href="#b"/>
</defs>
<rect width="100%" height="100%" fill="red"/>
<rect width="100%" height="100%" fill="url(#a)"/>
</svg>
</body>
</html>

View File

@ -260,6 +260,7 @@ fuzzy-if(Android,0-18,0-600) == foreignObject-fixedpos-01.html foreignObject-dyn
== getElementById-a-element-01.svg pass.svg
== geometry-properties-in-css.html geometry-properties-in-css-ref.html
== gradient-href-01.html pass.svg
fuzzy(0-3,0-32000) == gradient-live-01a.svg gradient-live-01-ref.svg
fuzzy(0-3,0-32000) == gradient-live-01b.svg gradient-live-01-ref.svg
fuzzy(0-3,0-32000) == gradient-live-01c.svg gradient-live-01-ref.svg

View File

@ -1463,10 +1463,14 @@ nsIFrame* SVGObserverUtils::GetAndObserveTemplate(
// Convert href to an nsIURI
nsIContent* content = aFrame->GetContent();
nsCOMPtr<nsIURI> baseURI = content->GetBaseURI();
if (nsContentUtils::IsLocalRefURL(href)) {
baseURI = GetBaseURLForLocalRef(content, baseURI);
}
nsCOMPtr<nsIURI> targetURI;
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
content->GetUncomposedDoc(),
content->GetBaseURI());
nsContentUtils::NewURIWithDocumentCharset(
getter_AddRefs(targetURI), href, content->GetUncomposedDoc(), baseURI);
// There's no clear refererer policy spec about non-CSS SVG resource
// references. Bug 1415044 to investigate which referrer we should use.