Bug 1533328 - Part 4: Only call ResetTimeZone resp. tzset when the time zone was actually changed. r=jorendorff

Differential Revision: https://phabricator.services.mozilla.com/D37251

--HG--
extra : moz-landing-system : lando
This commit is contained in:
André Bargull 2019-08-20 09:07:53 +00:00
parent fd325a124b
commit 119b53687b

View File

@ -775,7 +775,9 @@ void nsRFPService::UpdateRFPPref() {
UpdateTimers();
if (StaticPrefs::privacy_resistFingerprinting()) {
bool privacyResistFingerprinting =
StaticPrefs::privacy_resistFingerprinting();
if (privacyResistFingerprinting) {
PR_SetEnv("TZ=UTC");
} else if (sInitialized) {
// We will not touch the TZ value if 'privacy.resistFingerprinting' is false
@ -808,15 +810,19 @@ void nsRFPService::UpdateRFPPref() {
}
}
// localtime_r (and other functions) may not call tzset, so do this here after
// changing TZ to ensure all <time.h> functions use the new time zone.
// If and only if the time zone was changed above, propagate the change to the
// <time.h> functions and the JS runtime.
if (privacyResistFingerprinting || sInitialized) {
// localtime_r (and other functions) may not call tzset, so do this here
// after changing TZ to ensure all <time.h> functions use the new time zone.
#if defined(XP_WIN)
_tzset();
_tzset();
#else
tzset();
tzset();
#endif
nsJSUtils::ResetTimeZone();
nsJSUtils::ResetTimeZone();
}
}
void nsRFPService::StartShutdown() {