mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 19:09:49 +00:00
Reduce string copying from nsGenericHTMLElement::GetHrefURIForAnchors (bug 267506). r+sr=jst.
This commit is contained in:
parent
e28f6af3a9
commit
501e430b34
@ -1538,11 +1538,8 @@ nsContentUtils::NewURIWithDocumentCharset(nsIURI** aResult,
|
||||
nsIDocument* aDocument,
|
||||
nsIURI* aBaseURI)
|
||||
{
|
||||
nsCAutoString originCharset;
|
||||
if (aDocument)
|
||||
originCharset = aDocument->GetDocumentCharacterSet();
|
||||
|
||||
return NS_NewURI(aResult, NS_ConvertUCS2toUTF8(aSpec), originCharset.get(),
|
||||
return NS_NewURI(aResult, aSpec,
|
||||
aDocument ? aDocument->GetDocumentCharacterSet().get() : nsnull,
|
||||
aBaseURI, sIOService);
|
||||
}
|
||||
|
||||
|
@ -1583,16 +1583,16 @@ nsGenericHTMLElement::GetHrefURIForAnchors(nsIURI** aURI)
|
||||
// nsHTMLStyleElement.
|
||||
|
||||
// Get href= attribute (relative URI).
|
||||
nsAutoString relURISpec;
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
GetAttr(kNameSpaceID_None, nsHTMLAtoms::href, relURISpec)) {
|
||||
// We use the nsAttrValue's copy of the URI string to avoid copying.
|
||||
const nsAttrValue* attr = mAttrsAndChildren.GetAttr(nsHTMLAtoms::href);
|
||||
if (attr) {
|
||||
// Get base URI.
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
|
||||
// Get absolute URI.
|
||||
nsresult rv = nsContentUtils::NewURIWithDocumentCharset(aURI,
|
||||
relURISpec,
|
||||
attr->GetStringValue(),
|
||||
GetOwnerDoc(),
|
||||
baseURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user