Bug 1079338 - Log resources blocked by tracking protection. r=mcmanus,mmc,dcamp

* * *
Bug 1079338 - Put tracking protection logging in the Security tab
This commit is contained in:
Matt Brubeck 2014-10-10 12:19:14 -07:00
parent 382ada86d2
commit 2d90949938
5 changed files with 23 additions and 1 deletions

View File

@ -4679,6 +4679,7 @@ var Utils = {
case "SSL":
case "CORS":
case "Iframe Sandbox":
case "Tracking Protection":
return CATEGORY_SECURITY;
default:

View File

@ -789,6 +789,7 @@ public:
eCOMMON_DIALOG_PROPERTIES,
eMATHML_PROPERTIES,
eSECURITY_PROPERTIES,
eNECKO_PROPERTIES,
PropertiesFile_COUNT
};
static nsresult ReportToConsole(uint32_t aErrorFlags,

View File

@ -3238,7 +3238,8 @@ static const char gPropertiesFiles[nsContentUtils::PropertiesFile_COUNT][56] = {
"chrome://branding/locale/brand.properties",
"chrome://global/locale/commonDialogs.properties",
"chrome://global/locale/mathml/mathml.properties",
"chrome://global/locale/security/security.properties"
"chrome://global/locale/security/security.properties",
"chrome://necko/locale/necko.properties"
};
/* static */ nsresult

View File

@ -5,6 +5,7 @@
#include "nsChannelClassifier.h"
#include "mozIThirdPartyUtil.h"
#include "nsContentUtils.h"
#include "nsNetUtil.h"
#include "nsICacheEntry.h"
#include "nsICachingChannel.h"
@ -16,6 +17,7 @@
#include "nsIIOService.h"
#include "nsIPermissionManager.h"
#include "nsIProtocolHandler.h"
#include "nsIScriptError.h"
#include "nsIScriptSecurityManager.h"
#include "nsISecureBrowserUI.h"
#include "nsISecurityEventSink.h"
@ -26,6 +28,7 @@
#include "prlog.h"
using mozilla::ArrayLength;
using mozilla::Preferences;
#if defined(PR_LOGGING)
@ -359,6 +362,20 @@ nsChannelClassifier::SetBlockedTrackingContent(nsIChannel *channel)
state |= nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT;
eventSink->OnSecurityChange(nullptr, state);
// Log a warning to the web console.
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
nsCString utf8spec;
uri->GetSpec(utf8spec);
NS_ConvertUTF8toUTF16 spec(utf8spec);
const char16_t* params[] = { spec.get() };
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("Tracking Protection"),
doc,
nsContentUtils::eNECKO_PROPERTIES,
"TrackingUriBlocked",
params, ArrayLength(params));
return NS_OK;
}

View File

@ -37,3 +37,5 @@ PhishingAuth=You are about to visit "%1$S". This site may be attempting to trick
PhishingAuthAccept=I understand and will be very careful
SuperfluousAuth=You are about to log in to the site "%1$S" with the username "%2$S", but the website does not require authentication. This may be an attempt to trick you.\n\nIs "%1$S" the site you want to visit?
AutomaticAuth=You are about to log in to the site "%1$S" with the username "%2$S".
TrackingUriBlocked=The resource at "%1$S" was blocked because tracking protection is enabled.