Bug 1744006 - Replace dom.securecontext.whitelist_onions with dom.securecontext.allowlist_onions and dom.securecontext.whitelist with dom.securecontext.allowlist r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D133660
This commit is contained in:
Dragana Damjanovic 2021-12-14 05:20:08 +00:00
parent b2c1e9bbef
commit 1fd7957fc0
7 changed files with 16 additions and 16 deletions

View File

@ -16,7 +16,7 @@ const TEST_URL =
const PREF_BLOCK_DISPLAY = "security.mixed_content.block_display_content";
const PREF_BLOCK_ACTIVE = "security.mixed_content.block_active_content";
const PREF_ONION_WHITELIST = "dom.securecontext.whitelist_onions";
const PREF_ONION_ALLOWLIST = "dom.securecontext.allowlist_onions";
add_task(async function allowOnionMixedContent() {
registerCleanupFunction(function() {
@ -25,7 +25,7 @@ add_task(async function allowOnionMixedContent() {
await SpecialPowers.pushPrefEnv({ set: [[PREF_BLOCK_DISPLAY, true]] });
await SpecialPowers.pushPrefEnv({ set: [[PREF_BLOCK_ACTIVE, true]] });
await SpecialPowers.pushPrefEnv({ set: [[PREF_ONION_WHITELIST, true]] });
await SpecialPowers.pushPrefEnv({ set: [[PREF_ONION_ALLOWLIST, true]] });
const tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,

View File

@ -258,10 +258,10 @@ bool nsMixedContentBlocker::IsPotentiallyTrustworthyLoopbackURL(nsIURI* aURL) {
}
/* Maybe we have a .onion URL. Treat it as trustworthy as well if
* `dom.securecontext.whitelist_onions` is `true`.
* `dom.securecontext.allowlist_onions` is `true`.
*/
bool nsMixedContentBlocker::IsPotentiallyTrustworthyOnion(nsIURI* aURL) {
if (!StaticPrefs::dom_securecontext_whitelist_onions()) {
if (!StaticPrefs::dom_securecontext_allowlist_onions()) {
return false;
}
@ -274,8 +274,8 @@ bool nsMixedContentBlocker::IsPotentiallyTrustworthyOnion(nsIURI* aURL) {
// static
void nsMixedContentBlocker::OnPrefChange(const char* aPref, void* aClosure) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!strcmp(aPref, "dom.securecontext.whitelist"));
Preferences::GetCString("dom.securecontext.whitelist",
MOZ_ASSERT(!strcmp(aPref, "dom.securecontext.allowlist"));
Preferences::GetCString("dom.securecontext.allowlist",
*sSecurecontextAllowlist);
}
@ -287,7 +287,7 @@ void nsMixedContentBlocker::GetSecureContextAllowList(nsACString& aList) {
sSecurecontextAllowlistCached = true;
sSecurecontextAllowlist = new nsCString();
Preferences::RegisterCallbackAndCall(OnPrefChange,
"dom.securecontext.whitelist");
"dom.securecontext.allowlist");
}
aList = *sSecurecontextAllowlist;
}
@ -363,7 +363,7 @@ bool nsMixedContentBlocker::IsPotentiallyTrustworthyOrigin(nsIURI* aURI) {
}
// Maybe we have a .onion URL. Treat it as trustworthy as well if
// `dom.securecontext.whitelist_onions` is `true`.
// `dom.securecontext.allowlist_onions` is `true`.
if (nsMixedContentBlocker::IsPotentiallyTrustworthyOnion(aURI)) {
return true;
}

View File

@ -20,11 +20,11 @@ XPCOMUtils.defineLazyServiceGetter(
);
Services.prefs.setCharPref(
"dom.securecontext.whitelist",
"dom.securecontext.allowlist",
"example.net,example.org"
);
Services.prefs.setBoolPref("dom.securecontext.whitelist_onions", false);
Services.prefs.setBoolPref("dom.securecontext.allowlist_onions", false);
add_task(async function test_isOriginPotentiallyTrustworthy() {
for (let [uriSpec, expectedResult] of [
@ -52,7 +52,7 @@ add_task(async function test_isOriginPotentiallyTrustworthy() {
}
// And now let's test whether .onion sites are properly treated when
// allowlisted, see bug 1382359.
Services.prefs.setBoolPref("dom.securecontext.whitelist_onions", true);
Services.prefs.setBoolPref("dom.securecontext.allowlist_onions", true);
let uri = NetUtil.newURI("http://1234567890abcdef.onion/");
let principal = Services.scriptSecurityManager.createContentPrincipal(
uri,

View File

@ -193,7 +193,7 @@ add_task(async function get_client_storage_error() {
await SpecialPowers.pushPrefEnv({"set": [
// Make the test pass the IsOriginPotentiallyTrustworthy.
["dom.securecontext.whitelist", "mochi.test"]
["dom.securecontext.allowlist", "mochi.test"]
]});
let registration;

View File

@ -105,7 +105,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1172870
["dom.serviceWorkers.disable_open_click_delay", 1000],
["dom.serviceWorkers.idle_timeout", 299999],
["dom.serviceWorkers.idle_extended_timeout", 299999],
["dom.securecontext.whitelist", "mochi.test,example.com"],
["dom.securecontext.allowlist", "mochi.test,example.com"],
]}, runTest);
</script>
</body>

View File

@ -3177,7 +3177,7 @@
value: false
mirror: always
- name: dom.securecontext.whitelist_onions
- name: dom.securecontext.allowlist_onions
type: bool
value: false
mirror: always

View File

@ -201,7 +201,7 @@ void InitPrefs(nsIPrefBranch* aPrefBranch) {
// default"
Preferences::SetBool("network.cookie.sameSite.laxByDefault", false);
Preferences::SetBool("network.cookieJarSettings.unblocked_for_testing", true);
Preferences::SetBool("dom.securecontext.whitelist_onions", false);
Preferences::SetBool("dom.securecontext.allowlist_onions", false);
Preferences::SetBool("network.cookie.sameSite.schemeful", false);
}
@ -1034,7 +1034,7 @@ TEST(TestCookie, SameSiteLax)
TEST(TestCookie, OnionSite)
{
Preferences::SetBool("dom.securecontext.whitelist_onions", true);
Preferences::SetBool("dom.securecontext.allowlist_onions", true);
Preferences::SetBool("network.cookie.sameSite.laxByDefault", false);
nsresult rv;