mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1434215: Simplify some ResistFingerprinting callers in nsMediaFeatures. r=xidorn
The docshell version just redirects to the document one, so no need to ping-pong. MozReview-Commit-ID: AggEoLubCIF
This commit is contained in:
parent
8ab35c14ad
commit
75e0e25aeb
@ -137,12 +137,6 @@ GetHeight(nsIDocument* aDocument, const nsMediaFeature*,
|
||||
aResult.SetFloatValue(CSSPixel::FromAppUnits(size.height), eCSSUnit_Pixel);
|
||||
}
|
||||
|
||||
static bool
|
||||
ShouldResistFingerprinting(nsIDocument* aDocument)
|
||||
{
|
||||
return nsContentUtils::ShouldResistFingerprinting(aDocument->GetDocShell());
|
||||
}
|
||||
|
||||
static bool
|
||||
IsDeviceSizePageSize(nsIDocument* aDocument)
|
||||
{
|
||||
@ -157,7 +151,8 @@ IsDeviceSizePageSize(nsIDocument* aDocument)
|
||||
static nsSize
|
||||
GetDeviceSize(nsIDocument* aDocument)
|
||||
{
|
||||
if (ShouldResistFingerprinting(aDocument) || IsDeviceSizePageSize(aDocument)) {
|
||||
if (nsContentUtils::ShouldResistFingerprinting(aDocument) ||
|
||||
IsDeviceSizePageSize(aDocument)) {
|
||||
return GetSize(aDocument);
|
||||
}
|
||||
|
||||
@ -274,7 +269,7 @@ GetColor(nsIDocument* aDocument, const nsMediaFeature*,
|
||||
// rendered.
|
||||
uint32_t depth = 24;
|
||||
|
||||
if (!ShouldResistFingerprinting(aDocument)) {
|
||||
if (!nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
||||
if (nsDeviceContext* dx = GetDeviceContextFor(aDocument)) {
|
||||
// FIXME: On a monochrome device, return 0!
|
||||
dx->GetDepth(depth);
|
||||
@ -323,7 +318,7 @@ GetResolution(nsIDocument* aDocument, const nsMediaFeature*,
|
||||
float dppx = 1.;
|
||||
|
||||
if (nsDeviceContext* dx = GetDeviceContextFor(aDocument)) {
|
||||
if (ShouldResistFingerprinting(aDocument)) {
|
||||
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
||||
dppx = dx->GetFullZoom();
|
||||
} else {
|
||||
// Get the actual device pixel ratio, which also takes zoom into account.
|
||||
@ -397,7 +392,7 @@ static void
|
||||
GetDevicePixelRatio(nsIDocument* aDocument, const nsMediaFeature*,
|
||||
nsCSSValue& aResult)
|
||||
{
|
||||
if (ShouldResistFingerprinting(aDocument)) {
|
||||
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
||||
aResult.SetFloatValue(1.0, eCSSUnit_Number);
|
||||
return;
|
||||
}
|
||||
@ -454,7 +449,8 @@ GetSystemMetric(nsIDocument* aDocument, const nsMediaFeature* aFeature,
|
||||
MOZ_ASSERT(!isAccessibleFromContentPages ||
|
||||
*aFeature->mName == nsGkAtoms::_moz_touch_enabled);
|
||||
|
||||
if (isAccessibleFromContentPages && ShouldResistFingerprinting(aDocument)) {
|
||||
if (isAccessibleFromContentPages &&
|
||||
nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
||||
// If "privacy.resistFingerprinting" is enabled, then we simply don't
|
||||
// return any system-backed media feature values. (No spoofed values
|
||||
// returned.)
|
||||
@ -476,7 +472,7 @@ GetWindowsTheme(nsIDocument* aDocument, const nsMediaFeature* aFeature,
|
||||
aResult.Reset();
|
||||
|
||||
MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);
|
||||
if (ShouldResistFingerprinting(aDocument)) {
|
||||
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -505,7 +501,7 @@ GetOperatingSystemVersion(nsIDocument* aDocument, const nsMediaFeature* aFeature
|
||||
aResult.Reset();
|
||||
|
||||
MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);
|
||||
if (ShouldResistFingerprinting(aDocument)) {
|
||||
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user