Bug 1301706 - Check return value of nsIURI::GetSpec. r=mkmelin
This commit is contained in:
Родитель
d252d18dd1
Коммит
fc2995bab0
|
@ -363,11 +363,7 @@ NS_IMETHODIMP nsAbLDAPDirectoryQuery::DoQuery(nsIAbDirectory *aDirectory,
|
|||
{
|
||||
bool equal;
|
||||
rv = mDirectoryUrl->Equals(currentUrl, &equal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCString spec;
|
||||
mDirectoryUrl->GetSpec(spec);
|
||||
currentUrl->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!equal)
|
||||
{
|
||||
|
|
|
@ -658,7 +658,8 @@ nsresult nsMessenger::SaveAttachment(nsIFile *aFile,
|
|||
nsresult rv = NS_NewFileURI(getter_AddRefs(outputURI), aFile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsAutoCString fileUriSpec;
|
||||
outputURI->GetSpec(fileUriSpec);
|
||||
rv = outputURI->GetSpec(fileUriSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
saveState->m_savedFiles.AppendElement(fileUriSpec);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,11 +167,9 @@ nsMsgContentPolicy::ShouldLoad(uint32_t aContentType,
|
|||
NS_ENSURE_ARG_POINTER(aContentLocation);
|
||||
|
||||
#ifdef DEBUG_MsgContentPolicy
|
||||
nsCString spec;
|
||||
(void)aContentLocation->GetSpec(spec);
|
||||
fprintf(stderr, "aContentType: %d\naContentLocation = %s\n",
|
||||
aContentType,
|
||||
spec.get());
|
||||
aContentLocation->GetSpecOrDefault().get());
|
||||
#endif
|
||||
|
||||
#ifndef MOZ_THUNDERBIRD
|
||||
|
@ -230,8 +228,7 @@ nsMsgContentPolicy::ShouldLoad(uint32_t aContentType,
|
|||
return NS_ERROR_INVALID_POINTER;
|
||||
|
||||
#ifdef DEBUG_MsgContentPolicy
|
||||
(void)aRequestingLocation->GetSpec(spec);
|
||||
fprintf(stderr, "aRequestingLocation = %s\n", spec.get());
|
||||
fprintf(stderr, "aRequestingLocation = %s\n", aRequestingLocation->GetSpecOrDefault().get());
|
||||
#endif
|
||||
|
||||
// If the requesting location is safe, accept the content location request.
|
||||
|
@ -293,8 +290,7 @@ nsMsgContentPolicy::ShouldLoad(uint32_t aContentType,
|
|||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
|
||||
#ifdef DEBUG_MsgContentPolicy
|
||||
(void)originatorLocation->GetSpec(spec);
|
||||
fprintf(stderr, "originatorLocation = %s\n", spec.get());
|
||||
fprintf(stderr, "originatorLocation = %s\n", originatorLocation->GetSpecOrDefault().get());
|
||||
#endif
|
||||
|
||||
// Allow content when using a remote page.
|
||||
|
|
|
@ -134,7 +134,8 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetServer(nsIMsgIncomingServer ** aIncomingServe
|
|||
nsCOMPtr<nsIURL> url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
m_baseURL->GetSpec(urlstr);
|
||||
rv = m_baseURL->GetSpec(urlstr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = url->SetSpec(urlstr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = GetScheme(scheme);
|
||||
|
|
|
@ -173,7 +173,10 @@ NS_IMETHODIMP nsMsgAttachmentHandler::GetUri(nsACString& aUri)
|
|||
turl = m_uri;
|
||||
}
|
||||
else
|
||||
mURL->GetSpec(turl);
|
||||
{
|
||||
nsresult rv = mURL->GetSpec(turl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
aUri.Assign(turl);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -739,7 +742,8 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
|
|||
}
|
||||
|
||||
nsCString sourceURISpec;
|
||||
mURL->GetSpec(sourceURISpec);
|
||||
rv = mURL->GetSpec(sourceURISpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#ifdef XP_MACOSX
|
||||
if (!m_bogus_attachment && StringBeginsWith(sourceURISpec, NS_LITERAL_CSTRING("file://")))
|
||||
{
|
||||
|
@ -975,8 +979,8 @@ nsMsgAttachmentHandler::ConvertToAppleEncoding(const nsCString &aFileURI,
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCString newURLSpec;
|
||||
rv = fileURI->GetSpec(newURLSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
fileURI->GetSpec(newURLSpec);
|
||||
|
||||
if (newURLSpec.IsEmpty())
|
||||
{
|
||||
|
|
|
@ -1409,7 +1409,9 @@ msg_pick_real_name (nsMsgAttachmentHandler *attachment, const char16_t *proposed
|
|||
else //Let's extract the name from the URL
|
||||
{
|
||||
nsCString url;
|
||||
attachment->mURL->GetSpec(url);
|
||||
nsresult rv = attachment->mURL->GetSpec(url);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
s = url.get();
|
||||
s2 = PL_strchr (s, ':');
|
||||
|
|
|
@ -437,7 +437,8 @@ nsresult nsMsgCompose::ResetUrisForEmbeddedObjects()
|
|||
if (!newUrl)
|
||||
continue;
|
||||
nsCString spec;
|
||||
newUrl->GetSpec(spec);
|
||||
rv = newUrl->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsString newSrc;
|
||||
// mailbox urls will have ?number=xxx; imap urls won't. We need to
|
||||
// handle both cases because we may be going from a mailbox url to
|
||||
|
|
|
@ -1073,8 +1073,11 @@ nsMsgComposeAndSend::PreProcessPart(nsMsgAttachmentHandler *ma,
|
|||
if (!ma->m_uri.IsEmpty())
|
||||
turl = ma->m_uri;
|
||||
}
|
||||
else
|
||||
ma->mURL->GetSpec(turl);
|
||||
else {
|
||||
status = ma->mURL->GetSpec(turl);
|
||||
if (NS_FAILED(status))
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsCString type(ma->m_type);
|
||||
nsCString realName(ma->m_realName);
|
||||
|
@ -1114,7 +1117,10 @@ nsMsgComposeAndSend::PreProcessPart(nsMsgAttachmentHandler *ma,
|
|||
if (ma->mSendViaCloud)
|
||||
{
|
||||
nsCString urlSpec;
|
||||
ma->mURL->GetSpec(urlSpec);
|
||||
status = ma->mURL->GetSpec(urlSpec);
|
||||
if (NS_FAILED(status))
|
||||
return 0;
|
||||
|
||||
// Need to add some headers so that libmime can restore the cloud info
|
||||
// when loading a draft message.
|
||||
nsCString draftInfo(HEADER_X_MOZILLA_CLOUD_PART": cloudFile; url=");
|
||||
|
@ -1331,7 +1337,8 @@ nsMsgComposeAndSend::GetEmbeddedObjectInfo(nsIDOMNode *node, nsMsgAttachmentData
|
|||
if (!uri)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
uri->GetSpec(spec);
|
||||
rv = uri->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Ok, now get the path to the root doc and tack on the name we
|
||||
// got from the GetSrc() call....
|
||||
|
@ -4167,7 +4174,9 @@ BuildURLAttachmentData(nsIURI *url)
|
|||
|
||||
// Now get a readable name...
|
||||
nsAutoCString spec;
|
||||
url->GetSpec(spec);
|
||||
nsresult rv = url->GetSpec(spec);
|
||||
if (NS_FAILED(rv))
|
||||
return nullptr;
|
||||
if (!spec.IsEmpty())
|
||||
{
|
||||
theName = strrchr(spec.get(), '/');
|
||||
|
|
|
@ -5211,10 +5211,8 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
mailUrl->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
if (session)
|
||||
session->IsFolderOpenInWindow(this, &folderOpen);
|
||||
#ifdef DEBUG_bienvenu1
|
||||
nsCString urlSpec;
|
||||
aUrl->GetSpec(getter_Copies(urlSpec));
|
||||
printf("stop running url %s\n", urlSpec);
|
||||
#ifdef DEBUG_bienvenu
|
||||
printf("stop running url %s\n", aUrl->GetSpecOrDefault().get());
|
||||
#endif
|
||||
|
||||
if (imapUrl)
|
||||
|
|
|
@ -1614,7 +1614,8 @@ bool nsImapProtocol::ProcessCurrentURL()
|
|||
// acknowledge that we are running the url now..
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningUrl, &rv);
|
||||
nsAutoCString urlSpec;
|
||||
mailnewsurl->GetSpec(urlSpec);
|
||||
rv = mailnewsurl->GetSpec(urlSpec);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
Log("ProcessCurrentURL", urlSpec.get(), (validUrl) ? " = currentUrl\n" : " is not valid\n");
|
||||
if (!validUrl)
|
||||
return false;
|
||||
|
@ -2127,9 +2128,7 @@ NS_IMETHODIMP nsImapProtocol::LoadImapUrl(nsIURI * aURL, nsISupports * aConsumer
|
|||
if (aURL)
|
||||
{
|
||||
#ifdef DEBUG_bienvenu
|
||||
nsAutoCString urlSpec;
|
||||
aURL->GetSpec(urlSpec);
|
||||
printf("loading url %s\n", urlSpec.get());
|
||||
printf("loading url %s\n", aURL->GetSpecOrDefault().get());
|
||||
#endif
|
||||
if (TryToRunUrlLocally(aURL, aConsumer))
|
||||
return NS_OK;
|
||||
|
@ -2630,7 +2629,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
|||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningUrl);
|
||||
nsAutoCString urlSpec;
|
||||
if (mailnewsurl)
|
||||
mailnewsurl->GetSpec(urlSpec);
|
||||
urlSpec = mailnewsurl->GetSpecOrDefault();
|
||||
MOZ_LOG(IMAP, LogLevel::Debug,
|
||||
("SHELL: URL %s, OKToFetchByParts %d, allowedToBreakApart %d, ShouldFetchAllParts %d",
|
||||
urlSpec.get(), urlOKToFetchByParts, allowedToBreakApart,
|
||||
|
@ -4368,7 +4367,9 @@ bool nsImapProtocol::CheckNewMail()
|
|||
if (mailnewsUrl)
|
||||
{
|
||||
nsAutoCString urlSpec, unescapedUrlSpec;
|
||||
mailnewsUrl->GetSpec(urlSpec);
|
||||
nsresult rv = mailnewsUrl->GetSpec(urlSpec);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
MsgUnescapeString(urlSpec, 0, unescapedUrlSpec);
|
||||
MOZ_LOG(IMAP, LogLevel::Info, ("%s:%s", logMsg, unescapedUrlSpec.get()));
|
||||
}
|
||||
|
|
|
@ -264,7 +264,8 @@ NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI,
|
|||
mailnewsUrl->SetMsgIsInLocalCache(useLocalCache);
|
||||
|
||||
nsCOMPtr<nsIURI> url = do_QueryInterface(imapUrl);
|
||||
url->GetSpec(urlSpec);
|
||||
rv = url->GetSpec(urlSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
urlSpec.Append("fetch>UID>");
|
||||
urlSpec.Append(hierarchyDelimiter);
|
||||
|
||||
|
@ -583,7 +584,8 @@ nsresult nsImapService::FetchMimePart(nsIImapUrl *aImapUrl,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIURI> url = do_QueryInterface(aImapUrl);
|
||||
url->GetSpec(urlSpec);
|
||||
rv = url->GetSpec(urlSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// rhp: If we are displaying this message for the purpose of printing, we
|
||||
// need to append the header=print option.
|
||||
|
@ -943,7 +945,8 @@ NS_IMETHODIMP nsImapService::AddImapFetchToUrl(nsIURI *aUrl,
|
|||
NS_ENSURE_ARG_POINTER(aUrl);
|
||||
|
||||
nsAutoCString urlSpec;
|
||||
aUrl->GetSpec(urlSpec);
|
||||
nsresult rv = aUrl->GetSpec(urlSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
char hierarchyDelimiter = GetHierarchyDelimiter(aImapMailFolder);
|
||||
|
||||
|
|
|
@ -3152,7 +3152,8 @@ nsMsgLocalMailFolder::OnStartRunningUrl(nsIURI * aUrl)
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAutoCString aSpec;
|
||||
aUrl->GetSpec(aSpec);
|
||||
rv = aUrl->GetSpec(aSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (strstr(aSpec.get(), "uidl="))
|
||||
{
|
||||
nsCOMPtr<nsIPop3Sink> popsink;
|
||||
|
@ -3189,8 +3190,10 @@ nsMsgLocalMailFolder::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
|
|||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
|
||||
nsAutoCString aSpec;
|
||||
if (aUrl)
|
||||
aUrl->GetSpec(aSpec);
|
||||
if (aUrl) {
|
||||
rv = aUrl->GetSpec(aSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (strstr(aSpec.get(), "uidl="))
|
||||
{
|
||||
|
|
|
@ -583,7 +583,8 @@ NS_IMETHODIMP nsMailboxService::NewChannel2(nsIURI *aURI,
|
|||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoCString spec;
|
||||
aURI->GetSpec(spec);
|
||||
rv = aURI->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (spec.Find("?uidl=") >= 0 || spec.Find("&uidl=") >= 0)
|
||||
{
|
||||
|
|
|
@ -165,8 +165,10 @@ NS_IMETHODIMP nsMailboxUrl::GetUri(char ** aURI)
|
|||
// we blow off errors here so that we can open attachments
|
||||
// in .eml files.
|
||||
(void) accountManager->FolderUriForPath(m_filePath, baseUri);
|
||||
if (baseUri.IsEmpty())
|
||||
m_baseURL->GetSpec(baseUri);
|
||||
if (baseUri.IsEmpty()) {
|
||||
rv = m_baseURL->GetSpec(baseUri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsCString baseMessageURI;
|
||||
nsCreateLocalBaseMessageURI(baseUri, baseMessageURI);
|
||||
nsAutoCString uriStr;
|
||||
|
|
|
@ -143,9 +143,8 @@ mime_dump_attachments ( nsMsgAttachmentData *attachData )
|
|||
|
||||
if ( tmp->m_url )
|
||||
{
|
||||
nsAutoCString spec;
|
||||
tmp->m_url->GetSpec(spec);
|
||||
printf("URL : %s\n", spec.get());
|
||||
;
|
||||
printf("URL : %s\n", tmp->m_url->GetSpecOrDefault().get());
|
||||
}
|
||||
|
||||
printf("Desired Type : %s\n", tmp->m_desiredType.get());
|
||||
|
|
|
@ -678,8 +678,14 @@ NotifyEmittersOfAttachmentList(MimeDisplayOptions *opt,
|
|||
}
|
||||
|
||||
nsAutoCString spec;
|
||||
if (tmp->m_url)
|
||||
tmp->m_url->GetSpec(spec);
|
||||
if (tmp->m_url) {
|
||||
nsresult rv = tmp->m_url->GetSpec(spec);
|
||||
if (NS_FAILED(rv)) {
|
||||
++i;
|
||||
++tmp;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoCString sizeStr;
|
||||
if (tmp->m_isExternalLinkAttachment)
|
||||
|
|
|
@ -107,7 +107,8 @@ NS_IMETHODIMP nsNntpUrl::SetSpec(const nsACString &aSpec)
|
|||
else if (scheme.EqualsLiteral("news-message"))
|
||||
{
|
||||
nsAutoCString spec;
|
||||
GetSpec(spec);
|
||||
rv = GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = nsParseNewsMessageURI(spec.get(), m_group, &m_key);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_MALFORMED_URI);
|
||||
}
|
||||
|
@ -138,7 +139,8 @@ nsresult nsNntpUrl::ParseNewsURL()
|
|||
|
||||
// Set group, key for ?group=foo&key=123 uris
|
||||
nsAutoCString spec;
|
||||
GetSpec(spec);
|
||||
rv = GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
int32_t groupPos = spec.Find(kNewsURIGroupQuery); // find ?group=
|
||||
int32_t keyPos = spec.Find(kNewsURIKeyQuery); // find &key=
|
||||
if (groupPos != kNotFound && keyPos != kNotFound)
|
||||
|
@ -377,11 +379,13 @@ NS_IMETHODIMP nsNntpUrl::GetMessageHeader(nsIMsgDBHdr ** aMsgHdr)
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsAutoCString spec(mOriginalSpec);
|
||||
if (spec.IsEmpty())
|
||||
if (spec.IsEmpty()) {
|
||||
// Handle the case where necko directly runs an internal news:// URL,
|
||||
// one that looks like news://host/message-id?group=mozilla.announce&key=15
|
||||
// Other sorts of URLs -- e.g. news://host/message-id -- will not succeed.
|
||||
GetSpec(spec);
|
||||
rv = GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return msgService->MessageURIToMsgHdr(spec.get(), aMsgHdr);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче