Bug 969365 - Do ShouldCheckAppCache with AppID and InBrowser in HttpChannelParent, r=jduell

This commit is contained in:
Honza Bambas 2014-02-07 22:15:25 +01:00
parent 75624f2f6a
commit efab360be6

View File

@ -16,6 +16,7 @@
#include "nsNetUtil.h"
#include "nsISupportsPriority.h"
#include "nsIAuthPromptProvider.h"
#include "nsIScriptSecurityManager.h"
#include "nsSerializationHelper.h"
#include "nsISerializable.h"
#include "nsIAssociatedContentSecurity.h"
@ -249,10 +250,26 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
}
if (setChooseApplicationCache) {
// This works because we've already called SetNotificationCallbacks and
// done mPBOverride logic by this point.
appCacheChan->SetChooseApplicationCache(
NS_ShouldCheckAppCache(uri, NS_UsePrivateBrowsing(mChannel)));
bool inBrowser = false;
uint32_t appId = NECKO_NO_APP_ID;
if (mLoadContext) {
mLoadContext->GetIsInBrowserElement(&inBrowser);
mLoadContext->GetAppId(&appId);
}
bool chooseAppCache = false;
nsCOMPtr<nsIScriptSecurityManager> secMan =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
if (secMan) {
nsCOMPtr<nsIPrincipal> principal;
secMan->GetAppCodebasePrincipal(uri, appId, inBrowser, getter_AddRefs(principal));
// This works because we've already called SetNotificationCallbacks and
// done mPBOverride logic by this point.
chooseAppCache = NS_ShouldCheckAppCache(principal, NS_UsePrivateBrowsing(mChannel));
}
appCacheChan->SetChooseApplicationCache(chooseAppCache);
}
}