Bug 1565767 part 5. Remove some unnecesary refcounting at nsIContent::GetBaseURI callsites. r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D37973

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-07-15 18:29:05 +00:00
Родитель 75aa8f554d
Коммит 374137e8d8
26 изменённых файлов: 48 добавлений и 62 удалений

Просмотреть файл

@ -152,10 +152,10 @@ already_AddRefed<nsIURI> ImageAccessible::GetLongDescURI() const {
longdesc.FindChar('\r') != -1 || longdesc.FindChar('\n') != -1) { longdesc.FindChar('\r') != -1 || longdesc.FindChar('\n') != -1) {
return nullptr; return nullptr;
} }
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), longdesc, nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), longdesc,
mContent->OwnerDoc(), baseURI); mContent->OwnerDoc(),
mContent->GetBaseURI());
return uri.forget(); return uri.forget();
} }

Просмотреть файл

@ -205,12 +205,11 @@ already_AddRefed<nsIURI> XULLinkAccessible::AnchorURIAt(
nsAutoString href; nsAutoString href;
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href); mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
dom::Document* document = mContent->OwnerDoc(); dom::Document* document = mContent->OwnerDoc();
nsCOMPtr<nsIURI> anchorURI; nsCOMPtr<nsIURI> anchorURI;
NS_NewURI(getter_AddRefs(anchorURI), href, NS_NewURI(getter_AddRefs(anchorURI), href,
document->GetDocumentCharacterSet(), baseURI); document->GetDocumentCharacterSet(), mContent->GetBaseURI());
return anchorURI.forget(); return anchorURI.forget();
} }

Просмотреть файл

@ -273,9 +273,9 @@ static void ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback,
nsWhitespaceTokenizer tokenizer(value); nsWhitespaceTokenizer tokenizer(value);
while (tokenizer.hasMoreTokens()) { while (tokenizer.hasMoreTokens()) {
nsCOMPtr<nsIURI> uri, baseURI = aContent->GetBaseURI(); nsCOMPtr<nsIURI> uri;
ios->NewURI(NS_ConvertUTF16toUTF8(tokenizer.nextToken()), charset.get(), NS_NewURI(getter_AddRefs(uri), tokenizer.nextToken(), charset.get(),
baseURI, getter_AddRefs(uri)); aContent->GetBaseURI());
// if we can't generate a valid URI, then there is nothing to do // if we can't generate a valid URI, then there is nothing to do
if (!uri) { if (!uri) {
continue; continue;

Просмотреть файл

@ -445,7 +445,7 @@ void nsFrameLoader::LoadFrame(bool aOriginalSrc) {
return; return;
} }
nsCOMPtr<nsIURI> base_uri = mOwnerContent->GetBaseURI(); nsIURI* base_uri = mOwnerContent->GetBaseURI();
auto encoding = doc->GetDocumentCharacterSet(); auto encoding = doc->GetDocumentCharacterSet();
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
@ -635,8 +635,7 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
if (isSrcdoc) { if (isSrcdoc) {
loadState->SetSrcdocData(srcdoc); loadState->SetSrcdocData(srcdoc);
nsCOMPtr<nsIURI> baseURI = mOwnerContent->GetBaseURI(); loadState->SetBaseURI(mOwnerContent->GetBaseURI());
loadState->SetBaseURI(baseURI);
} }
nsCOMPtr<nsIReferrerInfo> referrerInfo = new ReferrerInfo(); nsCOMPtr<nsIReferrerInfo> referrerInfo = new ReferrerInfo();

Просмотреть файл

@ -104,7 +104,7 @@ bool nsHTMLContentSerializer::SerializeHTMLAttributes(
// Would be nice to handle OBJECT tags, but that gets more complicated // Would be nice to handle OBJECT tags, but that gets more complicated
// since we have to search the tag list for CODEBASE as well. For now, // since we have to search the tag list for CODEBASE as well. For now,
// just leave them relative. // just leave them relative.
nsCOMPtr<nsIURI> uri = aElement->GetBaseURI(); nsIURI* uri = aElement->GetBaseURI();
if (uri) { if (uri) {
nsAutoString absURI; nsAutoString absURI;
rv = NS_MakeAbsoluteURI(absURI, valueStr, uri); rv = NS_MakeAbsoluteURI(absURI, valueStr, uri);

Просмотреть файл

@ -1353,7 +1353,7 @@ nsresult nsImageLoadingContent::StringToURI(const nsAString& aSpec,
// (1) Get the base URI // (1) Get the base URI
nsIContent* thisContent = AsContent(); nsIContent* thisContent = AsContent();
nsCOMPtr<nsIURI> baseURL = thisContent->GetBaseURI(); nsIURI* baseURL = thisContent->GetBaseURI();
// (2) Get the charset // (2) Get the charset
auto encoding = aDocument->GetDocumentCharacterSet(); auto encoding = aDocument->GetDocumentCharacterSet();

Просмотреть файл

@ -1492,7 +1492,7 @@ nsObjectLoadingContent::UpdateObjectParameters() {
/// ///
nsAutoString codebaseStr; nsAutoString codebaseStr;
nsCOMPtr<nsIURI> docBaseURI = thisElement->GetBaseURI(); nsIURI* docBaseURI = thisElement->GetBaseURI();
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::codebase, codebaseStr); thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::codebase, codebaseStr);
if (!codebaseStr.IsEmpty()) { if (!codebaseStr.IsEmpty()) {
@ -1508,6 +1508,11 @@ nsObjectLoadingContent::UpdateObjectParameters() {
} }
} }
// If we failed to build a valid URI, use the document's base URI
if (!newBaseURI) {
newBaseURI = docBaseURI;
}
nsAutoString rawTypeAttr; nsAutoString rawTypeAttr;
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr); thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr);
if (!rawTypeAttr.IsEmpty()) { if (!rawTypeAttr.IsEmpty()) {
@ -1518,11 +1523,6 @@ nsObjectLoadingContent::UpdateObjectParameters() {
CopyUTF16toUTF8(mime, newMime); CopyUTF16toUTF8(mime, newMime);
} }
// If we failed to build a valid URI, use the document's base URI
if (!newBaseURI) {
newBaseURI = docBaseURI;
}
/// ///
/// URI /// URI
/// ///

Просмотреть файл

@ -1286,9 +1286,9 @@ bool nsTreeSanitizer::SanitizeURL(mozilla::dom::Element* aElement,
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
uint32_t flags = nsIScriptSecurityManager::DISALLOW_INHERIT_PRINCIPAL; uint32_t flags = nsIScriptSecurityManager::DISALLOW_INHERIT_PRINCIPAL;
nsCOMPtr<nsIURI> baseURI = aElement->GetBaseURI();
nsCOMPtr<nsIURI> attrURI; nsCOMPtr<nsIURI> attrURI;
nsresult rv = NS_NewURI(getter_AddRefs(attrURI), v, nullptr, baseURI); nsresult rv =
NS_NewURI(getter_AddRefs(attrURI), v, nullptr, aElement->GetBaseURI());
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
if (mCidEmbedsOnly && kNameSpaceID_None == aNamespace) { if (mCidEmbedsOnly && kNameSpaceID_None == aNamespace) {
if (nsGkAtoms::src == aLocalName || nsGkAtoms::background == aLocalName) { if (nsGkAtoms::src == aLocalName || nsGkAtoms::background == aLocalName) {
@ -1383,9 +1383,8 @@ void nsTreeSanitizer::SanitizeChildren(nsINode* aRoot) {
nsContentUtils::GetNodeTextContent(node, false, styleText); nsContentUtils::GetNodeTextContent(node, false, styleText);
nsAutoString sanitizedStyle; nsAutoString sanitizedStyle;
nsCOMPtr<nsIURI> baseURI = node->GetBaseURI();
if (SanitizeStyleSheet(styleText, sanitizedStyle, aRoot->OwnerDoc(), if (SanitizeStyleSheet(styleText, sanitizedStyle, aRoot->OwnerDoc(),
baseURI)) { node->GetBaseURI())) {
nsContentUtils::SetNodeTextContent(node, sanitizedStyle, true); nsContentUtils::SetNodeTextContent(node, sanitizedStyle, true);
} else { } else {
// If the node had non-text child nodes, this operation zaps those. // If the node had non-text child nodes, this operation zaps those.

Просмотреть файл

@ -277,7 +277,7 @@ bool nsXHTMLContentSerializer::SerializeAttributes(
// but that gets more complicated since we have to // but that gets more complicated since we have to
// search the tag list for CODEBASE as well. // search the tag list for CODEBASE as well.
// For now, just leave them relative. // For now, just leave them relative.
nsCOMPtr<nsIURI> uri = aElement->GetBaseURI(); nsIURI* uri = aElement->GetBaseURI();
if (uri) { if (uri) {
nsAutoString absURI; nsAutoString absURI;
rv = NS_MakeAbsoluteURI(absURI, valueStr, uri); rv = NS_MakeAbsoluteURI(absURI, valueStr, uri);

Просмотреть файл

@ -1485,7 +1485,7 @@ nsresult HTMLFormElement::GetActionURL(nsIURI** aActionURL,
actionURL = docURI; actionURL = docURI;
} else { } else {
nsCOMPtr<nsIURI> baseURL = GetBaseURI(); nsIURI* baseURL = GetBaseURI();
NS_ASSERTION(baseURL, "No Base URL found in Form Submit!\n"); NS_ASSERTION(baseURL, "No Base URL found in Form Submit!\n");
if (!baseURL) { if (!baseURL) {
return NS_OK; // No base URL -> exit early, see Bug 30721 return NS_OK; // No base URL -> exit early, see Bug 30721

Просмотреть файл

@ -135,10 +135,9 @@ bool HTMLMenuElement::CanLoadIcon(nsIContent* aContent,
Document* doc = aContent->OwnerDoc(); Document* doc = aContent->OwnerDoc();
nsCOMPtr<nsIURI> baseURI = aContent->GetBaseURI();
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), aIcon, doc, nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), aIcon, doc,
baseURI); aContent->GetBaseURI());
if (!uri) { if (!uri) {
return false; return false;

Просмотреть файл

@ -186,9 +186,8 @@ void HTMLScriptElement::FreezeExecutionAttrs(Document* aOwnerDoc) {
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) { if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
// Empty src should be treated as invalid URL. // Empty src should be treated as invalid URL.
if (!src.IsEmpty()) { if (!src.IsEmpty()) {
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(mUri), src, nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(mUri), src,
OwnerDoc(), baseURI); OwnerDoc(), GetBaseURI());
if (!mUri) { if (!mUri) {
AutoTArray<nsString, 2> params = {NS_LITERAL_STRING("src"), src}; AutoTArray<nsString, 2> params = {NS_LITERAL_STRING("src"), src};

Просмотреть файл

@ -863,10 +863,9 @@ bool nsGenericHTMLElement::ParseBackgroundAttribute(int32_t aNamespaceID,
aAttribute == nsGkAtoms::background && !aValue.IsEmpty()) { aAttribute == nsGkAtoms::background && !aValue.IsEmpty()) {
// Resolve url to an absolute url // Resolve url to an absolute url
Document* doc = OwnerDoc(); Document* doc = OwnerDoc();
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
nsresult rv = nsContentUtils::NewURIWithDocumentCharset( nsresult rv = nsContentUtils::NewURIWithDocumentCharset(
getter_AddRefs(uri), aValue, doc, baseURI); getter_AddRefs(uri), aValue, doc, GetBaseURI());
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return false; return false;
} }
@ -2685,9 +2684,9 @@ nsresult nsGenericHTMLElement::NewURIFromString(const nsAString& aURISpec,
nsCOMPtr<Document> doc = OwnerDoc(); nsCOMPtr<Document> doc = OwnerDoc();
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsresult rv = nsresult rv =
nsContentUtils::NewURIWithDocumentCharset(aURI, aURISpec, doc, baseURI); nsContentUtils::NewURIWithDocumentCharset(aURI, aURISpec, doc,
GetBaseURI());
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
bool equal; bool equal;

Просмотреть файл

@ -930,12 +930,11 @@ bool nsMathMLElement::IsLink(nsIURI** aURI) const {
} }
if (hasHref) { if (hasHref) {
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
// Get absolute URI // Get absolute URI
nsAutoString hrefStr; nsAutoString hrefStr;
href->ToString(hrefStr); href->ToString(hrefStr);
nsContentUtils::NewURIWithDocumentCharset(aURI, hrefStr, OwnerDoc(), nsContentUtils::NewURIWithDocumentCharset(aURI, hrefStr, OwnerDoc(),
baseURI); GetBaseURI());
// must promise out param is non-null if we return true // must promise out param is non-null if we return true
return !!*aURI; return !!*aURI;
} }

Просмотреть файл

@ -276,12 +276,12 @@ bool SVGAElement::IsLink(nsIURI** aURI) const {
eCaseMatters) != Element::ATTR_VALUE_NO_MATCH && eCaseMatters) != Element::ATTR_VALUE_NO_MATCH &&
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate, sActuateVals, FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate, sActuateVals,
eCaseMatters) != Element::ATTR_VALUE_NO_MATCH) { eCaseMatters) != Element::ATTR_VALUE_NO_MATCH) {
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
// Get absolute URI // Get absolute URI
nsAutoString str; nsAutoString str;
const uint8_t idx = useBareHref ? HREF : XLINK_HREF; const uint8_t idx = useBareHref ? HREF : XLINK_HREF;
mStringAttributes[idx].GetAnimValue(str, this); mStringAttributes[idx].GetAnimValue(str, this);
nsContentUtils::NewURIWithDocumentCharset(aURI, str, OwnerDoc(), baseURI); nsContentUtils::NewURIWithDocumentCharset(aURI, str, OwnerDoc(),
GetBaseURI());
// must promise out param is non-null if we return true // must promise out param is non-null if we return true
return !!*aURI; return !!*aURI;
} }

Просмотреть файл

@ -356,9 +356,8 @@ bool SVGAnimationElement::IsEventAttributeNameInternal(nsAtom* aName) {
void SVGAnimationElement::UpdateHrefTarget(const nsAString& aHrefStr) { void SVGAnimationElement::UpdateHrefTarget(const nsAString& aHrefStr) {
nsCOMPtr<nsIURI> targetURI; nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), aHrefStr, nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), aHrefStr,
OwnerDoc(), baseURI); OwnerDoc(), GetBaseURI());
// Bug 1415044 to investigate which referrer we should use // Bug 1415044 to investigate which referrer we should use
mHrefTarget.ResetToURIFragmentID(this, targetURI, mHrefTarget.ResetToURIFragmentID(this, targetURI,
OwnerDoc()->GetDocumentURI(), OwnerDoc()->GetDocumentURI(),

Просмотреть файл

@ -59,7 +59,7 @@ SVGFEImageElement::~SVGFEImageElement() { DestroyImageLoadingContent(); }
nsresult SVGFEImageElement::LoadSVGImage(bool aForce, bool aNotify) { nsresult SVGFEImageElement::LoadSVGImage(bool aForce, bool aNotify) {
// resolve href attribute // resolve href attribute
nsCOMPtr<nsIURI> baseURI = GetBaseURI(); nsIURI* baseURI = GetBaseURI();
nsAutoString href; nsAutoString href;
if (mStringAttributes[HREF].IsExplicitlySet()) { if (mStringAttributes[HREF].IsExplicitlySet()) {

Просмотреть файл

@ -128,7 +128,7 @@ already_AddRefed<Promise> SVGImageElement::Decode(ErrorResult& aRv) {
nsresult SVGImageElement::LoadSVGImage(bool aForce, bool aNotify) { nsresult SVGImageElement::LoadSVGImage(bool aForce, bool aNotify) {
// resolve href attribute // resolve href attribute
nsCOMPtr<nsIURI> baseURI = GetBaseURI(); nsIURI* baseURI = GetBaseURI();
nsAutoString href; nsAutoString href;
if (mStringAttributes[HREF].IsExplicitlySet()) { if (mStringAttributes[HREF].IsExplicitlySet()) {

Просмотреть файл

@ -191,9 +191,8 @@ SVGPathElement* SVGMPathElement::GetReferencedPath() {
void SVGMPathElement::UpdateHrefTarget(nsIContent* aParent, void SVGMPathElement::UpdateHrefTarget(nsIContent* aParent,
const nsAString& aHrefStr) { const nsAString& aHrefStr) {
nsCOMPtr<nsIURI> targetURI; nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), aHrefStr, nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), aHrefStr,
OwnerDoc(), baseURI); OwnerDoc(), GetBaseURI());
// Stop observing old target (if any) // Stop observing old target (if any)
if (mPathTracker.get()) { if (mPathTracker.get()) {

Просмотреть файл

@ -129,8 +129,7 @@ void SVGScriptElement::FreezeExecutionAttrs(Document* aOwnerDoc) {
// Empty src should be treated as invalid URL. // Empty src should be treated as invalid URL.
if (!src.IsEmpty()) { if (!src.IsEmpty()) {
nsCOMPtr<nsIURI> baseURI = GetBaseURI(); NS_NewURI(getter_AddRefs(mUri), src, nullptr, GetBaseURI());
NS_NewURI(getter_AddRefs(mUri), src, nullptr, baseURI);
if (!mUri) { if (!mUri) {
AutoTArray<nsString, 2> params = {isHref AutoTArray<nsString, 2> params = {isHref

Просмотреть файл

@ -2415,7 +2415,7 @@ void nsImageFrame::GetDocumentCharacterSet(nsACString& aCharset) const {
} }
void nsImageFrame::SpecToURI(const nsAString& aSpec, nsIURI** aURI) { void nsImageFrame::SpecToURI(const nsAString& aSpec, nsIURI** aURI) {
nsCOMPtr<nsIURI> baseURI; nsIURI* baseURI = nullptr;
if (mContent) { if (mContent) {
baseURI = mContent->GetBaseURI(); baseURI = mContent->GetBaseURI();
} }

Просмотреть файл

@ -1007,7 +1007,7 @@ nsresult Loader::CreateSheet(nsIURI* aURI, nsIContent* aLinkingContent,
if (!*aSheet) { if (!*aSheet) {
aSheetState = eSheetNeedsParser; aSheetState = eSheetNeedsParser;
nsIURI* sheetURI; nsIURI* sheetURI;
nsCOMPtr<nsIURI> baseURI; nsIURI* baseURI;
nsIURI* originalURI; nsIURI* originalURI;
if (!aURI) { if (!aURI) {
// Inline style. Use the document's base URL so that @import in // Inline style. Use the document's base URL so that @import in

Просмотреть файл

@ -119,8 +119,7 @@ already_AddRefed<nsIURI> StyleComputedUrl::ResolveLocalRef(nsIURI* aURI) const {
already_AddRefed<nsIURI> StyleComputedUrl::ResolveLocalRef( already_AddRefed<nsIURI> StyleComputedUrl::ResolveLocalRef(
const nsIContent* aContent) const { const nsIContent* aContent) const {
nsCOMPtr<nsIURI> url = aContent->GetBaseURI(); return ResolveLocalRef(aContent->GetBaseURI());
return ResolveLocalRef(url);
} }
imgRequestProxy* StyleComputedUrl::LoadImage(Document& aDocument) { imgRequestProxy* StyleComputedUrl::LoadImage(Document& aDocument) {

Просмотреть файл

@ -1372,9 +1372,9 @@ SVGGeometryElement* SVGObserverUtils::GetAndObserveTextPathsPath(
} }
nsCOMPtr<nsIURI> targetURI; nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> base = content->GetBaseURI(); nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
nsContentUtils::NewURIWithDocumentCharset( content->GetUncomposedDoc(),
getter_AddRefs(targetURI), href, content->GetUncomposedDoc(), base); content->GetBaseURI());
// There's no clear refererer policy spec about non-CSS SVG resource // There's no clear refererer policy spec about non-CSS SVG resource
// references Bug 1415044 to investigate which referrer we should use // references Bug 1415044 to investigate which referrer we should use
@ -1422,9 +1422,9 @@ nsIFrame* SVGObserverUtils::GetAndObserveTemplate(
// Convert href to an nsIURI // Convert href to an nsIURI
nsIContent* content = aFrame->GetContent(); nsIContent* content = aFrame->GetContent();
nsCOMPtr<nsIURI> targetURI; nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> base = content->GetBaseURI(); nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
nsContentUtils::NewURIWithDocumentCharset( content->GetUncomposedDoc(),
getter_AddRefs(targetURI), href, content->GetUncomposedDoc(), base); content->GetBaseURI());
// There's no clear refererer policy spec about non-CSS SVG resource // There's no clear refererer policy spec about non-CSS SVG resource
// references. Bug 1415044 to investigate which referrer we should use. // references. Bug 1415044 to investigate which referrer we should use.
@ -1457,10 +1457,10 @@ Element* SVGObserverUtils::GetAndObserveBackgroundImage(nsIFrame* aFrame,
nsAutoString elementId = nsAutoString elementId =
NS_LITERAL_STRING("#") + nsDependentAtomString(aHref); NS_LITERAL_STRING("#") + nsDependentAtomString(aHref);
nsCOMPtr<nsIURI> targetURI; nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> base = aFrame->GetContent()->GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset( nsContentUtils::NewURIWithDocumentCharset(
getter_AddRefs(targetURI), elementId, getter_AddRefs(targetURI), elementId,
aFrame->GetContent()->GetUncomposedDoc(), base); aFrame->GetContent()->GetUncomposedDoc(),
aFrame->GetContent()->GetBaseURI());
RefPtr<URLAndReferrerInfo> url = new URLAndReferrerInfo( RefPtr<URLAndReferrerInfo> url = new URLAndReferrerInfo(
targetURI, aFrame->GetContent()->OwnerDoc()->GetDocumentURI(), targetURI, aFrame->GetContent()->OwnerDoc()->GetDocumentURI(),
aFrame->GetContent()->OwnerDoc()->GetReferrerPolicy()); aFrame->GetContent()->OwnerDoc()->GetReferrerPolicy());

Просмотреть файл

@ -238,10 +238,9 @@ void nsImageBoxFrame::UpdateImage() {
mContent, getter_AddRefs(triggeringPrincipal), contentPolicyType, mContent, getter_AddRefs(triggeringPrincipal), contentPolicyType,
&requestContextID); &requestContextID);
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), src, doc, nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), src, doc,
baseURI); mContent->GetBaseURI());
if (uri) { if (uri) {
nsresult rv = nsContentUtils::LoadImage( nsresult rv = nsContentUtils::LoadImage(
uri, mContent, doc, triggeringPrincipal, requestContextID, uri, mContent, doc, triggeringPrincipal, requestContextID,

Просмотреть файл

@ -1913,11 +1913,9 @@ nsresult nsTreeBodyFrame::GetImage(int32_t aRowIndex, nsTreeColumn* aCol,
styleRequest->SyncClone(imgNotificationObserver, doc, styleRequest->SyncClone(imgNotificationObserver, doc,
getter_AddRefs(imageRequest)); getter_AddRefs(imageRequest));
} else { } else {
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsCOMPtr<nsIURI> srcURI; nsCOMPtr<nsIURI> srcURI;
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(srcURI), nsContentUtils::NewURIWithDocumentCharset(
imageSrc, doc, baseURI); getter_AddRefs(srcURI), imageSrc, doc, mContent->GetBaseURI());
if (!srcURI) return NS_ERROR_FAILURE; if (!srcURI) return NS_ERROR_FAILURE;
// XXXbz what's the origin principal for this stuff that comes from our // XXXbz what's the origin principal for this stuff that comes from our