Fixing bug 227263. Making document.domain return null in stead of throwing an exception when there's no domain to return. r+sr=peterv@propagandism.org.

git-svn-id: svn://10.0.0.236/trunk@151993 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%mozilla.jstenback.com
2004-01-28 23:44:08 +00:00
parent 1081fd4044
commit 421fc415c0

View File

@@ -1804,10 +1804,14 @@ nsHTMLDocument::GetDomain(nsAString& aDomain)
}
nsCAutoString hostName;
if (NS_FAILED(uri->GetHost(hostName)))
return NS_ERROR_FAILURE;
CopyUTF8toUTF16(hostName, aDomain);
if (NS_SUCCEEDED(uri->GetHost(hostName))) {
CopyUTF8toUTF16(hostName, aDomain);
} else {
// If we can't get the host from the URI (e.g. about:, javascript:,
// etc), just return an null string.
SetDOMStringToNull(aDomain);
}
return NS_OK;
}