Bug 1408702: Don't honor privacy.resistFingerprinting for media features that aren't accessible to content pages. r?xidorn
This is kind of a band-aid because not all the media features chrome code uses
happen to be banned from content pages. But I'll change that soon.
Meanwhile this fixes scrollbars and such.
MozReview-Commit-ID: IVHljzpxc2z
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -385,25 +385,31 @@ GetTransform3d(nsPresContext* aPresConte
aResult.SetIntValue(1, eCSSUnit_Integer);
}
static void
GetSystemMetric(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
aResult.Reset();
- if (ShouldResistFingerprinting(aPresContext)) {
+
+ const bool isAccessibleFromContentPages =
+ !(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);
+
+ if (isAccessibleFromContentPages &&
+ ShouldResistFingerprinting(aPresContext)) {
// If "privacy.resistFingerprinting" is enabled, then we simply don't
- // return any system-backed media feature values. (No spoofed values returned.)
+ // return any system-backed media feature values. (No spoofed values
+ // returned.)
return;
}
MOZ_ASSERT(aFeature->mValueType == nsMediaFeature::eBoolInteger,
"unexpected type");
- nsAtom *metricAtom = *aFeature->mData.mMetric;
+ nsAtom* metricAtom = *aFeature->mData.mMetric;
bool hasMetric = nsCSSRuleProcessor::HasSystemMetric(metricAtom);
aResult.SetIntValue(hasMetric ? 1 : 0, eCSSUnit_Integer);
}
static void
GetWindowsTheme(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{