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

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

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

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

@ -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);
}
}

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

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