Bug 1258033 - Part 1: Add IsTrackingProtectionOn for nsILoadContext. r=smaug

MozReview-Commit-ID: 2eQzO6KDLyX
This commit is contained in:
dimi
2016-06-02 10:12:39 +08:00
parent bb5811c20d
commit f5dbedafaa
6 changed files with 57 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/LoadContext.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI
#include "nsContentUtils.h"
#include "xpcpublic.h"
@@ -202,6 +203,23 @@ LoadContext::GetOriginAttributes(JS::MutableHandleValue aAttrs)
return NS_OK;
}
NS_IMETHODIMP
LoadContext::IsTrackingProtectionOn(bool* aIsTrackingProtectionOn)
{
MOZ_ASSERT(mIsNotNull);
if (Preferences::GetBool("privacy.trackingprotection.enabled", false)) {
*aIsTrackingProtectionOn = true;
} else if (mUsePrivateBrowsing &&
Preferences::GetBool("privacy.trackingprotection.pbmode.enabled", false)) {
*aIsTrackingProtectionOn = true;
} else {
*aIsTrackingProtectionOn = false;
}
return NS_OK;
}
//-----------------------------------------------------------------------------
// LoadContext::nsIInterfaceRequestor
//-----------------------------------------------------------------------------