Bug 1960273 - Enable data collection permissions on all channels. r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D247916
This commit is contained in:
committed by
wdurand@mozilla.com
parent
97ab9b4ec7
commit
b64515be3e
@@ -72,11 +72,7 @@ pref("extensions.langpacks.signatures.required", true);
|
|||||||
pref("xpinstall.signatures.required", true);
|
pref("xpinstall.signatures.required", true);
|
||||||
|
|
||||||
// Enable data collection permissions.
|
// Enable data collection permissions.
|
||||||
#ifdef NIGHTLY_BUILD
|
|
||||||
pref("extensions.dataCollectionPermissions.enabled", true);
|
pref("extensions.dataCollectionPermissions.enabled", true);
|
||||||
#else
|
|
||||||
pref("extensions.dataCollectionPermissions.enabled", false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Dictionary download preference
|
// Dictionary download preference
|
||||||
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/language-tools/");
|
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/language-tools/");
|
||||||
|
|||||||
@@ -15,11 +15,10 @@ const WITH_INSTALL_PROMPT = [
|
|||||||
];
|
];
|
||||||
const NO_INSTALL_PROMPT = [["extensions.originControls.grantByDefault", false]];
|
const NO_INSTALL_PROMPT = [["extensions.originControls.grantByDefault", false]];
|
||||||
|
|
||||||
// TODO: Bug 1960273 - Update this test and remove this pref set when we enable
|
// TODO - Bug 1960551: Get rid of this once the pref is enabled in GeckoView.
|
||||||
// the data collection permissions on all channels.
|
|
||||||
Services.prefs.setBoolPref(
|
Services.prefs.setBoolPref(
|
||||||
"extensions.dataCollectionPermissions.enabled",
|
"extensions.dataCollectionPermissions.enabled",
|
||||||
false
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
// ExtensionParent.sys.mjs is being imported lazily because when it is imported Services.appinfo will be
|
// ExtensionParent.sys.mjs is being imported lazily because when it is imported Services.appinfo will be
|
||||||
@@ -363,6 +362,7 @@ async function test_permissions({
|
|||||||
let allPermissions = {
|
let allPermissions = {
|
||||||
permissions: [...REQUIRED_PERMISSIONS, ...OPTIONAL_PERMISSIONS],
|
permissions: [...REQUIRED_PERMISSIONS, ...OPTIONAL_PERMISSIONS],
|
||||||
origins: [...REQUIRED_ORIGINS_EXPECTED, ...OPTIONAL_ORIGINS_NORMALIZED],
|
origins: [...REQUIRED_ORIGINS_EXPECTED, ...OPTIONAL_ORIGINS_NORMALIZED],
|
||||||
|
data_collection: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
result = await call("getAll");
|
result = await call("getAll");
|
||||||
@@ -406,6 +406,7 @@ async function test_permissions({
|
|||||||
let perms = {
|
let perms = {
|
||||||
permissions: REQUIRED_PERMISSIONS,
|
permissions: REQUIRED_PERMISSIONS,
|
||||||
origins: [...REQUIRED_ORIGINS_EXPECTED, ...OPTIONAL_ORIGINS_NORMALIZED],
|
origins: [...REQUIRED_ORIGINS_EXPECTED, ...OPTIONAL_ORIGINS_NORMALIZED],
|
||||||
|
data_collection: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
result = await call("getAll");
|
result = await call("getAll");
|
||||||
@@ -579,7 +580,10 @@ add_task(async function test_startup() {
|
|||||||
|
|
||||||
async function checkPermissions(extension, permissions) {
|
async function checkPermissions(extension, permissions) {
|
||||||
perms = await extension.awaitMessage("perms");
|
perms = await extension.awaitMessage("perms");
|
||||||
let expect = Object.assign({ permissions: [], origins: [] }, permissions);
|
let expect = Object.assign(
|
||||||
|
{ permissions: [], origins: [], data_collection: [] },
|
||||||
|
permissions
|
||||||
|
);
|
||||||
deepEqual(perms, expect, "Extension got correct permissions on startup");
|
deepEqual(perms, expect, "Extension got correct permissions on startup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,9 @@ AddonTestUtils.createAppInfo(
|
|||||||
"42"
|
"42"
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Bug 1960273 - Update this test and remove this pref set when we enable
|
|
||||||
// the data collection permissions on all channels.
|
|
||||||
Services.prefs.setBoolPref(
|
Services.prefs.setBoolPref(
|
||||||
"extensions.dataCollectionPermissions.enabled",
|
"extensions.dataCollectionPermissions.enabled",
|
||||||
false
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
let OptionalPermissions;
|
let OptionalPermissions;
|
||||||
@@ -449,6 +447,7 @@ add_task(
|
|||||||
let permObj = {
|
let permObj = {
|
||||||
permissions: ["privacy"],
|
permissions: ["privacy"],
|
||||||
origins: [],
|
origins: [],
|
||||||
|
data_collection: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
// enable the permissions while the background is stopped
|
// enable the permissions while the background is stopped
|
||||||
@@ -544,9 +543,7 @@ add_task(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
add_task(
|
add_task(async function test_getAll_with_data_collection() {
|
||||||
{ pref_set: [["extensions.dataCollectionPermissions.enabled", true]] },
|
|
||||||
async function test_getAll_with_data_collection() {
|
|
||||||
async function background() {
|
async function background() {
|
||||||
browser.test.onMessage.addListener(async msg => {
|
browser.test.onMessage.addListener(async msg => {
|
||||||
browser.test.assertEq("getAll", msg, "expected correct message");
|
browser.test.assertEq("getAll", msg, "expected correct message");
|
||||||
@@ -655,12 +652,9 @@ add_task(
|
|||||||
await getAllAndVerifyDataCollection([]);
|
await getAllAndVerifyDataCollection([]);
|
||||||
|
|
||||||
await extension.unload();
|
await extension.unload();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
add_task(
|
add_task(async function test_getAll_with_required_data_collection() {
|
||||||
{ pref_set: [["extensions.dataCollectionPermissions.enabled", true]] },
|
|
||||||
async function test_getAll_with_required_data_collection() {
|
|
||||||
async function background() {
|
async function background() {
|
||||||
browser.test.onMessage.addListener(async msg => {
|
browser.test.onMessage.addListener(async msg => {
|
||||||
browser.test.assertEq("getAll", msg, "expected correct message");
|
browser.test.assertEq("getAll", msg, "expected correct message");
|
||||||
@@ -720,12 +714,9 @@ add_task(
|
|||||||
);
|
);
|
||||||
|
|
||||||
await extension.unload();
|
await extension.unload();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
add_task(
|
add_task(async function test_request_with_data_collection() {
|
||||||
{ pref_set: [["extensions.dataCollectionPermissions.enabled", true]] },
|
|
||||||
async function test_request_with_data_collection() {
|
|
||||||
async function background() {
|
async function background() {
|
||||||
browser.test.onMessage.addListener(async msg => {
|
browser.test.onMessage.addListener(async msg => {
|
||||||
if (msg === "request-good") {
|
if (msg === "request-good") {
|
||||||
@@ -831,12 +822,9 @@ add_task(
|
|||||||
);
|
);
|
||||||
|
|
||||||
await extension.unload();
|
await extension.unload();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
add_task(
|
add_task(async function test_contains_data_collection() {
|
||||||
{ pref_set: [["extensions.dataCollectionPermissions.enabled", true]] },
|
|
||||||
async function test_contains_data_collection() {
|
|
||||||
async function background() {
|
async function background() {
|
||||||
browser.test.onMessage.addListener(async (msg, arg) => {
|
browser.test.onMessage.addListener(async (msg, arg) => {
|
||||||
if (msg === "contains") {
|
if (msg === "contains") {
|
||||||
@@ -998,8 +986,7 @@ add_task(
|
|||||||
}
|
}
|
||||||
|
|
||||||
await extension.unload();
|
await extension.unload();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// This test verifies that data collection permissions are taken into account when
|
// This test verifies that data collection permissions are taken into account when
|
||||||
// an extension is installed before the `extensions.dataCollectionPermissions.enabled`
|
// an extension is installed before the `extensions.dataCollectionPermissions.enabled`
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ const { PERMISSION_L10N, PERMISSION_L10N_ID_OVERRIDES } =
|
|||||||
|
|
||||||
AddonTestUtils.initMochitest(this);
|
AddonTestUtils.initMochitest(this);
|
||||||
|
|
||||||
|
Services.prefs.setBoolPref(
|
||||||
|
"extensions.dataCollectionPermissions.enabled",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
const addonsBundle = new Localization(["toolkit/about/aboutAddons.ftl"], true);
|
const addonsBundle = new Localization(["toolkit/about/aboutAddons.ftl"], true);
|
||||||
|
|
||||||
const assertVisibleSections = async (permsSection, expectedHeaders) => {
|
const assertVisibleSections = async (permsSection, expectedHeaders) => {
|
||||||
@@ -623,14 +628,6 @@ async function testPermissionsView({
|
|||||||
await SpecialPowers.popPrefEnv();
|
await SpecialPowers.popPrefEnv();
|
||||||
}
|
}
|
||||||
|
|
||||||
add_setup(async () => {
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
|
||||||
// TODO: Bug 1960273 - Update this test and remove this pref set when we
|
|
||||||
// enable the data collection permissions on all channels.
|
|
||||||
set: [["extensions.dataCollectionPermissions.enabled", false]],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
add_task(async function testPermissionsView_MV2_manifestV3disabled() {
|
add_task(async function testPermissionsView_MV2_manifestV3disabled() {
|
||||||
await testPermissionsView({ manifestV3enabled: false, manifest_version: 2 });
|
await testPermissionsView({ manifestV3enabled: false, manifest_version: 2 });
|
||||||
});
|
});
|
||||||
@@ -920,6 +917,7 @@ add_task(async function test_OneOfMany_AllSites_toggle() {
|
|||||||
Assert.deepEqual(granted, {
|
Assert.deepEqual(granted, {
|
||||||
permissions: [],
|
permissions: [],
|
||||||
origins: ["http://*/*", "https://*/*"],
|
origins: ["http://*/*", "https://*/*"],
|
||||||
|
data_collection: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
await closeView(view);
|
await closeView(view);
|
||||||
@@ -1020,10 +1018,6 @@ webext-perms-description-test-tabs = Custom description for the tabs permission
|
|||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_data_collection() {
|
add_task(async function test_data_collection() {
|
||||||
await SpecialPowers.pushPrefEnv({
|
|
||||||
set: [["extensions.dataCollectionPermissions.enabled", true]],
|
|
||||||
});
|
|
||||||
|
|
||||||
const TEST_CASES = [
|
const TEST_CASES = [
|
||||||
{
|
{
|
||||||
title: "no permissions",
|
title: "no permissions",
|
||||||
@@ -1453,15 +1447,9 @@ add_task(async function test_data_collection() {
|
|||||||
await closeView(view);
|
await closeView(view);
|
||||||
await extension.unload();
|
await extension.unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
await SpecialPowers.popPrefEnv();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_data_collection_and_disabled_extension() {
|
add_task(async function test_data_collection_and_disabled_extension() {
|
||||||
await SpecialPowers.pushPrefEnv({
|
|
||||||
set: [["extensions.dataCollectionPermissions.enabled", true]],
|
|
||||||
});
|
|
||||||
|
|
||||||
const extensionId = "@some-id";
|
const extensionId = "@some-id";
|
||||||
const extension = ExtensionTestUtils.loadExtension({
|
const extension = ExtensionTestUtils.loadExtension({
|
||||||
manifest: {
|
manifest: {
|
||||||
@@ -1533,6 +1521,4 @@ add_task(async function test_data_collection_and_disabled_extension() {
|
|||||||
|
|
||||||
await closeView(view);
|
await closeView(view);
|
||||||
await extension.unload();
|
await extension.unload();
|
||||||
|
|
||||||
await SpecialPowers.popPrefEnv();
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ add_setup(async () => {
|
|||||||
await SpecialPowers.pushPrefEnv({
|
await SpecialPowers.pushPrefEnv({
|
||||||
set: [
|
set: [
|
||||||
["extensions.userScripts.mv3.enabled", true],
|
["extensions.userScripts.mv3.enabled", true],
|
||||||
// TODO: Bug 1960273 - Update this test and remove this pref set when we
|
["extensions.dataCollectionPermissions.enabled", true],
|
||||||
// enable the data collection permissions on all channels.
|
|
||||||
["extensions.dataCollectionPermissions.enabled", false],
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -33,7 +31,7 @@ function loadUserScriptsExtension(addonId) {
|
|||||||
background() {
|
background() {
|
||||||
browser.permissions.onAdded.addListener(perms => {
|
browser.permissions.onAdded.addListener(perms => {
|
||||||
browser.test.assertDeepEq(
|
browser.test.assertDeepEq(
|
||||||
{ permissions: ["userScripts"], origins: [] },
|
{ permissions: ["userScripts"], origins: [], data_collection: [] },
|
||||||
perms,
|
perms,
|
||||||
"permissions.onAdded for userScripts permission"
|
"permissions.onAdded for userScripts permission"
|
||||||
);
|
);
|
||||||
@@ -42,7 +40,7 @@ function loadUserScriptsExtension(addonId) {
|
|||||||
});
|
});
|
||||||
browser.permissions.onRemoved.addListener(perms => {
|
browser.permissions.onRemoved.addListener(perms => {
|
||||||
browser.test.assertDeepEq(
|
browser.test.assertDeepEq(
|
||||||
{ permissions: ["userScripts"], origins: [] },
|
{ permissions: ["userScripts"], origins: [], data_collection: [] },
|
||||||
perms,
|
perms,
|
||||||
"permissions.onRemoved for userScripts permission"
|
"permissions.onRemoved for userScripts permission"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user