Bug 1155759 - Part 1 - Remove some manual refcounting from docshell. r=smaug

This commit is contained in:
Andrew McCreight
2015-04-17 15:19:00 +02:00
parent ac04633840
commit a708ece98d
4 changed files with 10 additions and 20 deletions

View File

@@ -1139,8 +1139,7 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
nsCOMPtr<nsISHistory> shistory;
nsresult rv = GetSessionHistory(getter_AddRefs(shistory));
if (NS_SUCCEEDED(rv) && shistory) {
*aSink = shistory;
NS_ADDREF((nsISupports*)*aSink);
shistory.forget(aSink);
return NS_OK;
}
return NS_NOINTERFACE;
@@ -1158,8 +1157,7 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
nsCOMPtr<nsIEditingSession> editingSession;
mEditorData->GetEditingSession(getter_AddRefs(editingSession));
if (editingSession) {
*aSink = editingSession;
NS_ADDREF((nsISupports*)*aSink);
editingSession.forget(aSink);
return NS_OK;
}
@@ -1757,8 +1755,7 @@ nsDocShell::CreateLoadInfo(nsIDocShellLoadInfo** aLoadInfo)
NS_ENSURE_TRUE(loadInfo, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIDocShellLoadInfo> localRef(loadInfo);
*aLoadInfo = localRef;
NS_ADDREF(*aLoadInfo);
localRef.forget(aLoadInfo);
return NS_OK;
}
@@ -6253,7 +6250,7 @@ nsDocShell::GetOnePermittedSandboxedNavigator(nsIDocShell** aSandboxedNavigator)
NS_ENSURE_ARG_POINTER(aSandboxedNavigator);
nsCOMPtr<nsIDocShell> permittedNavigator =
do_QueryReferent(mOnePermittedSandboxedNavigator);
NS_IF_ADDREF(*aSandboxedNavigator = permittedNavigator);
permittedNavigator.forget(aSandboxedNavigator);
return NS_OK;
}
@@ -11966,8 +11963,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
if (aNewEntry) {
*aNewEntry = nullptr;
if (NS_SUCCEEDED(rv)) {
*aNewEntry = entry;
NS_ADDREF(*aNewEntry);
entry.forget(aNewEntry);
}
}