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

--HG--
extra : rebase_source : 50e4e20b704dc9cf8081f6137df801d6ec0e4533
This commit is contained in:
Andrew McCreight 2015-04-17 15:19:00 +02:00
Родитель bc64533d62
Коммит cc8e505792
4 изменённых файлов: 10 добавлений и 20 удалений

Просмотреть файл

@ -147,7 +147,7 @@ nsAboutRedirector::NewChannel(nsIURI* aURI,
tempChannel->SetOriginalURI(aURI); tempChannel->SetOriginalURI(aURI);
NS_ADDREF(*aResult = tempChannel); tempChannel.forget(aResult);
return rv; return rv;
} }
} }
@ -186,9 +186,6 @@ nsAboutRedirector::GetIndexedDBOriginPostfix(nsIURI* aURI, nsAString& aResult)
nsresult nsresult
nsAboutRedirector::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult) nsAboutRedirector::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{ {
nsAboutRedirector* about = new nsAboutRedirector(); nsRefPtr<nsAboutRedirector> about = new nsAboutRedirector();
NS_ADDREF(about); return about->QueryInterface(aIID, aResult);
nsresult rv = about->QueryInterface(aIID, aResult);
NS_RELEASE(about);
return rv;
} }

Просмотреть файл

@ -105,9 +105,7 @@ nsDefaultURIFixup::CreateExposableURI(nsIURI* aURI, nsIURI** aReturn)
uri->SetUserPass(EmptyCString()); uri->SetUserPass(EmptyCString());
} }
// return the fixed-up URI uri.forget(aReturn);
*aReturn = uri;
NS_ADDREF(*aReturn);
return NS_OK; return NS_OK;
} }

Просмотреть файл

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

Просмотреть файл

@ -540,8 +540,7 @@ nsSHistory::GetTransactionAtIndex(int32_t aIndex, nsISHTransaction ** aResult)
if (NS_SUCCEEDED(rv) && ptr) { if (NS_SUCCEEDED(rv) && ptr) {
cnt++; cnt++;
if (cnt == aIndex) { if (cnt == aIndex) {
*aResult = ptr; ptr.forget(aResult);
NS_ADDREF(*aResult);
break; break;
} }
else { else {