Skip to content

Commit 553d79e

Browse files
committed
Bug 1993031 - Create section for Firefox VPN in about:settings - r=ip-protection-reviewers,fluent-reviewers,bolsson,mstriemer,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D267966
1 parent 2960b00 commit 553d79e

File tree

9 files changed

+116
-0
lines changed

9 files changed

+116
-0
lines changed

browser/components/preferences/main.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,21 @@ let SETTINGS_CONFIG = {
14791479
},
14801480
],
14811481
},
1482+
ipprotection: {
1483+
l10nId: "ip-protection-description",
1484+
headingLevel: 2,
1485+
// TODO: Replace support url with finalized link (Bug 1993266)
1486+
supportPage: "ip-protection",
1487+
items: [
1488+
{
1489+
id: "ipProtectionPlaceholderMessage",
1490+
control: "moz-message-bar",
1491+
controlAttrs: {
1492+
message: "This is a placeholder for the IP Protection section",
1493+
},
1494+
},
1495+
],
1496+
},
14821497
cookiesAndSiteData: {
14831498
l10nId: "sitedata-label",
14841499
items: [

browser/components/preferences/preferences.xhtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<!-- Temporary until localization is done -->
5858
<link rel="localization" href="preview/smartTabGroups.ftl"/>
5959
<link rel="localization" href="preview/privacyPreferences.ftl"/>
60+
<link rel="localization" href="preview/ipProtection.ftl"/>
6061

6162
<!-- Links below are only used for search-l10n-ids into subdialogs -->
6263
<link rel="localization" href="browser/aboutDialog.ftl"/>

browser/components/preferences/privacy.inc.xhtml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@
395395
<html:setting-group groupid="nonTechnicalPrivacy"/>
396396
</groupbox>
397397

398+
<!-- Firefox VPN - IP Protection -->
399+
<groupbox id="dataIPProtectionGroup" data-category="panePrivacy" hidden="true">
400+
<html:setting-group groupid="ipprotection"></html:setting-group>
401+
</groupbox>
402+
403+
398404
<groupbox id="siteDataGroup" data-category="panePrivacy" hidden="true" aria-describedby="totalSiteDataSize">
399405
<label><html:h2 data-l10n-id="sitedata-header"/></label>
400406
<html:setting-group groupid="cookiesAndSiteData"/>

browser/components/preferences/privacy.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ Preferences.addAll([
210210
// Global Privacy Control
211211
{ id: "privacy.globalprivacycontrol.enabled", type: "bool" },
212212

213+
// Firefox VPN
214+
{ id: "browser.ipProtection.variant", type: "string" },
215+
213216
// Media
214217
{ id: "media.autoplay.default", type: "int" },
215218

@@ -1252,6 +1255,17 @@ Preferences.addSetting({
12521255
],
12531256
});
12541257

1258+
Preferences.addSetting({
1259+
id: "ipProtectionVisible",
1260+
pref: "browser.ipProtection.variant",
1261+
get: prefVal => prefVal == "beta",
1262+
});
1263+
Preferences.addSetting({
1264+
id: "ipProtectionPlaceholderMessage",
1265+
deps: ["ipProtectionVisible"],
1266+
visible: ({ ipProtectionVisible }) => ipProtectionVisible.value,
1267+
});
1268+
12551269
// Study opt out
12561270
if (AppConstants.MOZ_DATA_REPORTING) {
12571271
Preferences.addAll([
@@ -2367,6 +2381,7 @@ var gPrivacyPane = {
23672381
initSettingGroup("browsingProtection");
23682382
initSettingGroup("cookiesAndSiteData");
23692383
initSettingGroup("certificates");
2384+
initSettingGroup("ipprotection");
23702385

23712386
this._updateSanitizeSettingsButton();
23722387
this.initializeHistoryMode();

browser/components/preferences/tests/browser.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ skip-if = ["os == 'linux' && os_version == '24.04' && processor == 'x86_64' && t
197197

198198
["browser_privacy_gpc.js"]
199199

200+
["browser_privacy_ipprotection.js"]
201+
200202
["browser_privacy_passwordGenerationAndAutofill.js"]
201203

202204
["browser_privacy_relayIntegration.js"]

browser/components/preferences/tests/browser_bug731866.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const cookieBannerHandlingDisabled = !SpecialPowers.getBoolPref(
1010
const backupSectionDisabled = !SpecialPowers.getBoolPref(
1111
"browser.backup.preferences.ui.enabled"
1212
);
13+
const ipProtectionExperiment = SpecialPowers.getStringPref(
14+
"browser.ipProtection.variant"
15+
);
1316
const profilesGroupDisabled = !SelectableProfileService.isEnabled;
1417
const updatePrefContainers = ["updatesCategory", "updateApp"];
1518
const updateContainersGroupDisabled =
@@ -75,6 +78,14 @@ function checkElements(expectedPane) {
7578
continue;
7679
}
7780

81+
// IP Protection is only enabled by browser.ipProtection.variant = beta
82+
if (
83+
element.id === "dataIPProtectionGroup" &&
84+
ipProtectionExperiment !== "beta"
85+
) {
86+
continue;
87+
}
88+
7889
let attributeValue = element.getAttribute("data-category");
7990
let suffix = " (id=" + element.id + ")";
8091
if (attributeValue == "pane" + expectedPane) {

browser/components/preferences/tests/browser_bug795764_cachedisabled.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ function test() {
2525
}
2626

2727
async function runTest(win) {
28+
const ipProtectionExperiment = SpecialPowers.getStringPref(
29+
"browser.ipProtection.variant"
30+
);
2831
is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
2932

3033
let tab = win.document;
@@ -41,6 +44,14 @@ async function runTest(win) {
4144
continue;
4245
}
4346

47+
// IP Protection is only enabled by browser.ipProtection.variant = beta
48+
if (
49+
element.id === "dataIPProtectionGroup" &&
50+
ipProtectionExperiment !== "beta"
51+
) {
52+
continue;
53+
}
54+
4455
if (attributeValue == "panePrivacy") {
4556
is_element_visible(element, "HTTPSOnly should be visible");
4657

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* Any copyright is dedicated to the Public Domain.
2+
* https://creativecommons.org/publicdomain/zero/1.0/ */
3+
4+
// This file tests the Privacy pane's Firefox VPN UI.
5+
6+
"use strict";
7+
8+
const FEATURE_PREF = "browser.ipProtection.variant";
9+
10+
const SECTION_ID = "dataIPProtectionGroup";
11+
12+
// Test the section is hidden on page load if the variant pref is set to an ineligible experiment.
13+
add_task(
14+
async function test_section_removed_when_set_to_ineligible_experiment_pref() {
15+
await SpecialPowers.pushPrefEnv({
16+
set: [[FEATURE_PREF, "alpha"]],
17+
});
18+
19+
await BrowserTestUtils.withNewTab(
20+
{ gBrowser, url: "about:preferences#privacy" },
21+
async function (browser) {
22+
let section = browser.contentDocument.getElementById(SECTION_ID);
23+
is_element_hidden(section, "#dataIPProtectionGroup is hidden");
24+
}
25+
);
26+
27+
await SpecialPowers.popPrefEnv();
28+
}
29+
);
30+
31+
// Test the section is shown on page load if the variant pref is set to an eligible experiment
32+
add_task(
33+
async function test_section_shown_when_set_to_eligible_experiment_pref() {
34+
await SpecialPowers.pushPrefEnv({
35+
set: [[FEATURE_PREF, "beta"]],
36+
});
37+
38+
await BrowserTestUtils.withNewTab(
39+
{ gBrowser, url: "about:preferences#privacy" },
40+
async function (browser) {
41+
let section = browser.contentDocument.getElementById(SECTION_ID);
42+
is_element_visible(section, "#dataIPProtectionGroup is shown");
43+
}
44+
);
45+
46+
await SpecialPowers.popPrefEnv();
47+
}
48+
);

browser/locales-preview/ipProtection.ftl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,11 @@ ipprotection-message-generic-error =
7676
.heading = Couldn’t connect to VPN
7777
.message = Try again in a few minutes.
7878
79+
## IP Protection Settings
80+
81+
ip-protection-description =
82+
.label = { -firefox-vpn-brand-name }
83+
.description = Hides your location and adds extra encryption to your browsing in { -brand-short-name }.
84+
ip-protection-learn-more = Learn more
85+
7986
##

0 commit comments

Comments
 (0)