mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 07:01:19 +00:00
deCOMtaminate nsIDocument by changing methods to use return value instead of out-params, eliminating unused nsresult return values, moving some members to nsIDocument and inlining the getters/setters. Bug 222134, r=bzbarsky, sr=jst.
This commit is contained in:
parent
00bf6f48c3
commit
ab49f6f8f3
@ -482,7 +482,7 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
|
||||
if (doc) {
|
||||
doc->GetBaseURL(getter_AddRefs(baseURI));
|
||||
baseURI = doc->GetBaseURL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,9 +102,7 @@ static nsresult SetUpEncoder(nsIDOMNode *aRoot, const char* aCharset, nsIDocumen
|
||||
if (aCharset) {
|
||||
charset = aCharset;
|
||||
} else {
|
||||
rv = document->GetDocumentCharacterSet(charset);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
charset = document->GetDocumentCharacterSet();
|
||||
}
|
||||
rv = encoder->SetCharset(charset);
|
||||
if (NS_FAILED(rv))
|
||||
@ -150,10 +148,9 @@ nsresult CheckSameOrigin(nsIDOMNode *aRoot)
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(owner_doc));
|
||||
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
nsCOMPtr<nsIURI> root_uri;
|
||||
|
||||
doc->GetPrincipal(getter_AddRefs(principal));
|
||||
nsIPrincipal *principal = doc->GetPrincipal();
|
||||
|
||||
if (principal) {
|
||||
principal->GetURI(getter_AddRefs(root_uri));
|
||||
|
@ -402,9 +402,7 @@ nsXMLHttpRequest::ConvertBodyToText(PRUnichar **aOutBuffer)
|
||||
nsCAutoString dataCharset;
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(mDocument));
|
||||
if (document) {
|
||||
rv = document->GetDocumentCharacterSet(dataCharset);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
dataCharset = document->GetDocumentCharacterSet();
|
||||
} else {
|
||||
if (NS_FAILED(DetectCharset(dataCharset)) || dataCharset.IsEmpty()) {
|
||||
// MS documentation states UTF-8 is default for responseText
|
||||
@ -609,7 +607,7 @@ nsXMLHttpRequest::GetLoadGroup(nsILoadGroup **aLoadGroup)
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = GetDocumentFromScriptContext(mScriptContext);
|
||||
if (doc) {
|
||||
doc->GetDocumentLoadGroup(aLoadGroup);
|
||||
*aLoadGroup = doc->GetDocumentLoadGroup().get(); // already_AddRefed
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -630,7 +628,7 @@ nsXMLHttpRequest::GetBaseURI(nsIURI **aBaseURI)
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = GetDocumentFromScriptContext(mScriptContext);
|
||||
if (doc) {
|
||||
doc->GetBaseURL(aBaseURI);
|
||||
NS_IF_ADDREF(*aBaseURI = doc->GetBaseURL());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user