зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1845940 - Call RecomputeResistFingerprinting in Document::SetPrincipals. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184943
This commit is contained in:
Родитель
b39196091d
Коммит
b1f29a3a3d
|
@ -152,3 +152,43 @@ add_task(async function test_timezone_exempt_wrong_domain() {
|
|||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_timezone_exmpt_browser() {
|
||||
SpecialPowers.Cu.getJSTestingFunctions().setTimeZone("PST8PDT");
|
||||
is(
|
||||
Intl.DateTimeFormat("en-US").resolvedOptions().timeZone,
|
||||
"PST8PDT",
|
||||
"Default time zone should have changed"
|
||||
);
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["privacy.resistFingerprinting", true]],
|
||||
});
|
||||
|
||||
is(
|
||||
Intl.DateTimeFormat("en-US").resolvedOptions().timeZone,
|
||||
"PST8PDT",
|
||||
"Timezone in chrome should be unaffected by resistFingerprinting"
|
||||
);
|
||||
|
||||
let newWindow = Services.ww.openWindow(
|
||||
null,
|
||||
AppConstants.BROWSER_CHROME_URL,
|
||||
"_blank",
|
||||
"chrome,dialog=no,all,alwaysRaised",
|
||||
null
|
||||
);
|
||||
|
||||
is(
|
||||
newWindow.Intl.DateTimeFormat("en-US").resolvedOptions().timeZone,
|
||||
"PST8PDT",
|
||||
"Timezone in new chrome window should be unaffected by resistFingerprinting"
|
||||
);
|
||||
|
||||
newWindow.close();
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
|
||||
// Reset timezone
|
||||
SpecialPowers.Cu.getJSTestingFunctions().setTimeZone(undefined);
|
||||
});
|
||||
|
|
|
@ -2787,10 +2787,10 @@ nsresult Document::Init(nsIPrincipal* aPrincipal,
|
|||
|
||||
if (aPrincipal) {
|
||||
SetPrincipals(aPrincipal, aPartitionedPrincipal);
|
||||
} else {
|
||||
RecomputeResistFingerprinting();
|
||||
}
|
||||
|
||||
RecomputeResistFingerprinting();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4241,6 +4241,8 @@ void Document::SetPrincipals(nsIPrincipal* aNewPrincipal,
|
|||
|
||||
mCSSLoader->RegisterInSheetCache();
|
||||
|
||||
RecomputeResistFingerprinting();
|
||||
|
||||
#ifdef DEBUG
|
||||
// Validate that the docgroup is set correctly by calling its getter and
|
||||
// triggering its sanity check.
|
||||
|
|
Загрузка…
Ссылка в новой задаче