Bug 1071497: Use new API to create channels in comm-central, r=Neil, a=jcranmer to reopen tree.

This commit is contained in:
Christoph Kerschbaumer 2014-09-23 15:02:08 -07:00
Родитель 18228a7a5e
Коммит 1dabcc4427
3 изменённых файлов: 37 добавлений и 4 удалений

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

@ -8,6 +8,7 @@
#include "nsNetUtil.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsNullPrincipal.h"
#include "nsISupportsPrimitives.h"
#include "plstr.h"
#include "nsIDOMWindow.h"
@ -111,9 +112,19 @@ nsAbContentHandler::HandleContent(const char *aContentType,
rv = channel->GetURI(getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> nullPrincipal =
do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
// create a stream loader to handle the v-card data
nsCOMPtr<nsIStreamLoader> streamLoader;
rv = NS_NewStreamLoader(getter_AddRefs(streamLoader), uri, this, aWindowContext);
rv = NS_NewStreamLoader(getter_AddRefs(streamLoader),
uri,
this,
nullPrincipal,
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_OTHER,
aWindowContext);
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -7,6 +7,7 @@
#include "msgCore.h" // for pre-compiled headers
#include "nsCOMPtr.h"
#include "nsNullPrincipal.h"
#include <stdio.h>
#include "nscore.h"
#include "nsIFactory.h"
@ -316,9 +317,21 @@ nsURLFetcher::FireURLRequest(nsIURI *aURL, nsIFile *localFile, nsIOutputStream *
nsCOMPtr<nsIURILoader> pURILoader (do_GetService(NS_URI_LOADER_CONTRACTID));
NS_ENSURE_TRUE(pURILoader, NS_ERROR_FAILURE);
nsCOMPtr<nsIPrincipal> nullPrincipal =
do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIChannel> channel;
NS_ENSURE_SUCCESS(NS_NewChannel(getter_AddRefs(channel), aURL, nullptr, nullptr, this), NS_ERROR_FAILURE);
rv = NS_NewChannel(getter_AddRefs(channel),
aURL,
nullPrincipal,
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_OTHER,
nullptr, // aChannelPolicy
nullptr, // aLoadGroup
this); // aCallbacks
NS_ENSURE_SUCCESS(rv, rv);
return pURILoader->OpenURI(channel, false, this);
}

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

@ -715,10 +715,19 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
imapServer->GetIsGMailServer(&m_isGmailServer);
if (!m_mockChannel)
{
nsCOMPtr<nsIPrincipal> nullPrincipal =
do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
// there are several imap operations that aren't initiated via a nsIChannel::AsyncOpen call on the mock channel.
// such as selecting a folder. nsImapProtocol now insists on a mock channel when processing a url.
nsCOMPtr<nsIChannel> channel;
rv = NS_NewChannel(getter_AddRefs(channel), aURL, nullptr, nullptr, nullptr, 0);
rv = NS_NewChannel(getter_AddRefs(channel),
aURL,
nullPrincipal,
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_OTHER);
m_mockChannel = do_QueryInterface(channel);
// Certain imap operations (not initiated by the IO Service via AsyncOpen) can be interrupted by the stop button on the toolbar.