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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user