static nsresult GetOperatingSystemVersion(nsPresContext* aPresContext, const nsMediaFeature* aFeature, nsCSSValue& aResult) { aResult.Reset(); if (ShouldResistFingerprinting(aPresContext)) { return NS_OK; } #ifdef XP_WIN int32_t metricResult; if (NS_SUCCEEDED( LookAndFeel::GetInt(LookAndFeel::eIntID_OperatingSystemVersionIdentifier, &metricResult))) { for (size_t i = 0; i < ArrayLength(osVersionStrings); ++i) { if (metricResult == osVersionStrings[i].id) { aResult.SetStringValue(nsDependentString(osVersionStrings[i].name), eCSSUnit_Ident); break; } } } #endif return NS_OK; }
static void GetOperatingSystemVersion(nsIDocument* aDocument, const nsMediaFeature* aFeature, nsCSSValue& aResult) { aResult.Reset(); MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly); if (nsContentUtils::ShouldResistFingerprinting(aDocument)) { return; } #ifdef XP_WIN int32_t metricResult; if (NS_SUCCEEDED( LookAndFeel::GetInt(LookAndFeel::eIntID_OperatingSystemVersionIdentifier, &metricResult))) { for (size_t i = 0; i < ArrayLength(osVersionStrings); ++i) { if (metricResult == osVersionStrings[i].id) { aResult.SetStringValue(nsDependentString(osVersionStrings[i].name), eCSSUnit_Ident); break; } } } #endif }
static nsresult GetWindowsTheme(nsPresContext* aPresContext, const nsMediaFeature* aFeature, nsCSSValue& aResult) { aResult.Reset(); if (ShouldResistFingerprinting(aPresContext)) { return NS_OK; } #ifdef XP_WIN uint8_t windowsThemeId = nsCSSRuleProcessor::GetWindowsThemeIdentifier(); // Classic mode should fail to match. if (windowsThemeId == LookAndFeel::eWindowsTheme_Classic) return NS_OK; // Look up the appropriate theme string for (size_t i = 0; i < ArrayLength(themeStrings); ++i) { if (windowsThemeId == themeStrings[i].id) { aResult.SetStringValue(nsDependentString(themeStrings[i].name), eCSSUnit_Ident); break; } } #endif return NS_OK; }
static void GetWindowsTheme(nsIDocument* aDocument, const nsMediaFeature* aFeature, nsCSSValue& aResult) { aResult.Reset(); MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly); if (nsContentUtils::ShouldResistFingerprinting(aDocument)) { return; } #ifdef XP_WIN uint8_t windowsThemeId = GetWindowsThemeIdentifier(); // Classic mode should fail to match. if (windowsThemeId == LookAndFeel::eWindowsTheme_Classic) return; // Look up the appropriate theme string for (size_t i = 0; i < ArrayLength(themeStrings); ++i) { if (windowsThemeId == themeStrings[i].id) { aResult.SetStringValue(nsDependentString(themeStrings[i].name), eCSSUnit_Ident); break; } } #endif }