зеркало из https://github.com/mozilla/pjs.git
Reduce string copying from nsGenericHTMLElement::GetHrefURIForAnchors (bug 267506). r+sr=jst.
This commit is contained in:
Родитель
9dc5fde08b
Коммит
8f76cdccdc
|
@ -1538,11 +1538,8 @@ nsContentUtils::NewURIWithDocumentCharset(nsIURI** aResult,
|
||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
nsIURI* aBaseURI)
|
nsIURI* aBaseURI)
|
||||||
{
|
{
|
||||||
nsCAutoString originCharset;
|
return NS_NewURI(aResult, aSpec,
|
||||||
if (aDocument)
|
aDocument ? aDocument->GetDocumentCharacterSet().get() : nsnull,
|
||||||
originCharset = aDocument->GetDocumentCharacterSet();
|
|
||||||
|
|
||||||
return NS_NewURI(aResult, NS_ConvertUCS2toUTF8(aSpec), originCharset.get(),
|
|
||||||
aBaseURI, sIOService);
|
aBaseURI, sIOService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1583,16 +1583,16 @@ nsGenericHTMLElement::GetHrefURIForAnchors(nsIURI** aURI)
|
||||||
// nsHTMLStyleElement.
|
// nsHTMLStyleElement.
|
||||||
|
|
||||||
// Get href= attribute (relative URI).
|
// Get href= attribute (relative URI).
|
||||||
nsAutoString relURISpec;
|
|
||||||
|
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
// We use the nsAttrValue's copy of the URI string to avoid copying.
|
||||||
GetAttr(kNameSpaceID_None, nsHTMLAtoms::href, relURISpec)) {
|
const nsAttrValue* attr = mAttrsAndChildren.GetAttr(nsHTMLAtoms::href);
|
||||||
|
if (attr) {
|
||||||
// Get base URI.
|
// Get base URI.
|
||||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||||
|
|
||||||
// Get absolute URI.
|
// Get absolute URI.
|
||||||
nsresult rv = nsContentUtils::NewURIWithDocumentCharset(aURI,
|
nsresult rv = nsContentUtils::NewURIWithDocumentCharset(aURI,
|
||||||
relURISpec,
|
attr->GetStringValue(),
|
||||||
GetOwnerDoc(),
|
GetOwnerDoc(),
|
||||||
baseURI);
|
baseURI);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче