Skip to content
Snippets Groups Projects
Commit 38999857 authored by Arthur Edelstein's avatar Arthur Edelstein Committed by Georg Koppen
Browse files

Bug #17207: Hide mime types and plugins when resisting fingerprinting

parent 80d233db
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
#include "nsIMIMEInfo.h"
#include "Navigator.h"
#include "nsServiceManagerUtils.h"
#include "nsContentUtils.h"
#include "nsPluginTags.h"
using namespace mozilla;
......@@ -40,6 +41,12 @@ nsMimeTypeArray::~nsMimeTypeArray()
{
}
static bool
ResistFingerprinting() {
return !nsContentUtils::ThreadsafeIsCallerChrome() &&
nsContentUtils::ResistFingerprinting();
}
JSObject*
nsMimeTypeArray::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
......@@ -78,6 +85,10 @@ nsMimeTypeArray::IndexedGetter(uint32_t aIndex, bool &aFound)
{
aFound = false;
if (ResistFingerprinting()) {
return nullptr;
}
EnsurePluginMimeTypes();
if (aIndex >= mMimeTypes.Length()) {
......@@ -108,6 +119,10 @@ nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound)
{
aFound = false;
if (ResistFingerprinting()) {
return nullptr;
}
EnsurePluginMimeTypes();
nsString lowerName(aName);
......@@ -174,6 +189,10 @@ nsMimeTypeArray::NameIsEnumerable(const nsAString& aName)
uint32_t
nsMimeTypeArray::Length()
{
if (ResistFingerprinting()) {
return 0;
}
EnsurePluginMimeTypes();
return mMimeTypes.Length();
......
......@@ -19,6 +19,7 @@
#include "nsIWeakReference.h"
#include "mozilla/Services.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsContentUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
......@@ -42,6 +43,12 @@ nsPluginArray::~nsPluginArray()
{
}
static bool
ResistFingerprinting() {
return !nsContentUtils::ThreadsafeIsCallerChrome() &&
nsContentUtils::ResistFingerprinting();
}
nsPIDOMWindow*
nsPluginArray::GetParentObject() const
{
......@@ -166,7 +173,7 @@ nsPluginArray::IndexedGetter(uint32_t aIndex, bool &aFound)
{
aFound = false;
if (!AllowPlugins()) {
if (!AllowPlugins() || ResistFingerprinting()) {
return nullptr;
}
......@@ -213,7 +220,7 @@ nsPluginArray::NamedGetter(const nsAString& aName, bool &aFound)
{
aFound = false;
if (!AllowPlugins()) {
if (!AllowPlugins() || ResistFingerprinting()) {
return nullptr;
}
......@@ -233,7 +240,7 @@ nsPluginArray::NameIsEnumerable(const nsAString& aName)
uint32_t
nsPluginArray::Length()
{
if (!AllowPlugins()) {
if (!AllowPlugins() || ResistFingerprinting()) {
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment