From c7879bf035f75679e91ce6a9e29ec219007ade94 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Mon, 31 Dec 2007 03:43:42 +0000 Subject: [PATCH] Backing out bug 409885, since this part of Necko happens not to exist. git-svn-id: svn://10.0.0.236/trunk@242202 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLDocument.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index ac219b6b607..4743c4c011a 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -1718,16 +1718,20 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain) return NS_ERROR_FAILURE; } + nsCAutoString newURIString; + if (NS_FAILED(uri->GetScheme(newURIString))) + return NS_ERROR_FAILURE; + nsCAutoString path; + if (NS_FAILED(uri->GetPath(path))) + return NS_ERROR_FAILURE; + newURIString.AppendLiteral("://"); + AppendUTF16toUTF8(aDomain, newURIString); + newURIString.Append(path); + nsCOMPtr newURI; - nsresult rv = uri->Clone(getter_AddRefs(newURI)); - NS_ENSURE_TRUE(newURI, rv); + if (NS_FAILED(NS_NewURI(getter_AddRefs(newURI), newURIString))) + return NS_ERROR_FAILURE; - rv = newURI->SetUserPass(EmptyCString()); - NS_ENSURE_SUCCESS(rv, rv); - - rv = newURI->SetHostPort(NS_ConvertUTF16toUTF8(aDomain)); - NS_ENSURE_SUCCESS(rv, rv); - // Check new domain - must be a superdomain of the current host // For example, a page from foo.bar.com may set domain to bar.com, // but not to ar.com, baz.com, or fi.foo.bar.com. @@ -1758,7 +1762,6 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain) return NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN; } - NS_TryToSetImmutable(newURI); return NodePrincipal()->SetDomain(newURI); }