Bug 897516 - Implement a separate cookie jar for safebrowsing - cookie separation part. r=mmc

This commit is contained in:
Christoph Kerschbaumer
2013-08-19 12:31:24 -07:00
parent 32023f0b98
commit e94804d13a
6 changed files with 54 additions and 2 deletions

View File

@@ -15,9 +15,13 @@
#include "nsToolkitCompsCID.h"
#include "nsUrlClassifierStreamUpdater.h"
#include "prlog.h"
#include "nsIInterfaceRequestor.h"
#include "mozilla/LoadContext.h"
static const char* gQuitApplicationMessage = "quit-application";
#undef LOG
// NSPR_LOG_MODULES=UrlClassifierStreamUpdater:5
#if defined(PR_LOGGING)
static const PRLogModuleInfo *gUrlClassifierStreamUpdaterLog = nullptr;
@@ -124,6 +128,14 @@ nsUrlClassifierStreamUpdater::FetchUpdate(nsIURI *aUpdateUrl,
mChannel->SetContentType(NS_LITERAL_CSTRING("application/vnd.google.safebrowsing-update"));
}
// Create a custom LoadContext for SafeBrowsing, so we can use callbacks on
// the channel to query the appId which allows separation of safebrowsing
// cookies in a separate jar.
nsCOMPtr<nsIInterfaceRequestor> sbContext =
new mozilla::LoadContext(NECKO_SAFEBROWSING_APP_ID);
rv = mChannel->SetNotificationCallbacks(sbContext);
NS_ENSURE_SUCCESS(rv, rv);
// Make the request
rv = mChannel->AsyncOpen(this, nullptr);
NS_ENSURE_SUCCESS(rv, rv);