Bug 1238804. Make <base> actually work in a srcdoc document. r=smaug

This commit is contained in:
Boris Zbarsky
2016-01-13 21:36:24 -05:00
parent f4e6afcc41
commit cc0585ca98
3 changed files with 36 additions and 8 deletions

View File

@@ -164,14 +164,15 @@ SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
return;
}
// Resolve the <base> element's href relative to our document URI
// Resolve the <base> element's href relative to our document's
// fallback base URI.
nsAutoString href;
child->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> newBaseURI;
nsContentUtils::NewURIWithDocumentCharset(
getter_AddRefs(newBaseURI), href, aDocument,
aDocument->GetDocumentURI());
aDocument->GetFallbackBaseURI());
// Try to set our base URI. If that fails, try to set base URI to null
nsresult rv = aDocument->SetBaseURI(newBaseURI);