Bug 1244340 - Part 1: Use origin attributes as cstor arg for LoadContext r=sicking

This commit is contained in:
Yoshi Huang 2016-05-19 15:49:41 +08:00
parent 0028508811
commit 8ace8c51a5
3 changed files with 13 additions and 8 deletions

View File

@ -93,14 +93,14 @@ public:
MOZ_ASSERT(aUsePrivateBrowsing == (aAttrs.mPrivateBrowsingId != 0));
}
// Constructor taking reserved appId for the safebrowsing cookie.
explicit LoadContext(uint32_t aAppId)
// Constructor taking reserved origin attributes.
explicit LoadContext(DocShellOriginAttributes& aAttrs)
: mTopFrameElement(nullptr)
, mNestedFrameId(0)
, mIsContent(false)
, mUsePrivateBrowsing(false)
, mUsePrivateBrowsing(aAttrs.mPrivateBrowsingId != 0)
, mUseRemoteTabs(false)
, mOriginAttributes(aAppId, false)
, mOriginAttributes(aAttrs)
#ifdef DEBUG
, mIsNotNull(true)
#endif

View File

@ -52,6 +52,7 @@
#include "nsContentUtils.h"
using mozilla::BasePrincipal;
using mozilla::DocShellOriginAttributes;
using mozilla::PrincipalOriginAttributes;
using mozilla::Preferences;
using mozilla::TimeStamp;
@ -1282,8 +1283,9 @@ PendingLookup::SendRemoteQueryInternal()
// Set the Safebrowsing cookie jar, so that the regular Google cookie is not
// sent with this request. See bug 897516.
nsCOMPtr<nsIInterfaceRequestor> loadContext =
new mozilla::LoadContext(NECKO_SAFEBROWSING_APP_ID);
DocShellOriginAttributes attrs;
attrs.mAppId = NECKO_SAFEBROWSING_APP_ID;
nsCOMPtr<nsIInterfaceRequestor> loadContext = new mozilla::LoadContext(attrs);
rv = mChannel->SetNotificationCallbacks(loadContext);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -24,6 +24,8 @@
#include "nsContentUtils.h"
#include "nsIURLFormatter.h"
using mozilla::DocShellOriginAttributes;
static const char* gQuitApplicationMessage = "quit-application";
// Limit the list file size to 32mb
@ -178,8 +180,9 @@ nsUrlClassifierStreamUpdater::FetchUpdate(nsIURI *aUpdateUrl,
// 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);
DocShellOriginAttributes attrs;
attrs.mAppId = NECKO_SAFEBROWSING_APP_ID;
nsCOMPtr<nsIInterfaceRequestor> sbContext = new mozilla::LoadContext(attrs);
rv = mChannel->SetNotificationCallbacks(sbContext);
NS_ENSURE_SUCCESS(rv, rv);