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);
|
||||
|
||||
// Enable data collection permissions.
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("extensions.dataCollectionPermissions.enabled", true);
|
||||
#else
|
||||
pref("extensions.dataCollectionPermissions.enabled", false);
|
||||
#endif
|
||||
|
||||
// Dictionary download preference
|
||||
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]];
|
||||
|
||||
// TODO: Bug 1960273 - Update this test and remove this pref set when we enable
|
||||
// the data collection permissions on all channels.
|
||||
// TODO - Bug 1960551: Get rid of this once the pref is enabled in GeckoView.
|
||||
Services.prefs.setBoolPref(
|
||||
"extensions.dataCollectionPermissions.enabled",
|
||||
false
|
||||
true
|
||||
);
|
||||
|
||||
// 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 = {
|
||||
permissions: [...REQUIRED_PERMISSIONS, ...OPTIONAL_PERMISSIONS],
|
||||
origins: [...REQUIRED_ORIGINS_EXPECTED, ...OPTIONAL_ORIGINS_NORMALIZED],
|
||||
data_collection: [],
|
||||
};
|
||||
|
||||
result = await call("getAll");
|
||||
@@ -406,6 +406,7 @@ async function test_permissions({
|
||||
let perms = {
|
||||
permissions: REQUIRED_PERMISSIONS,
|
||||
origins: [...REQUIRED_ORIGINS_EXPECTED, ...OPTIONAL_ORIGINS_NORMALIZED],
|
||||
data_collection: [],
|
||||
};
|
||||
|
||||
result = await call("getAll");
|
||||
@@ -579,7 +580,10 @@ add_task(async function test_startup() {
|
||||
|
||||
async function checkPermissions(extension, permissions) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,9 @@ AddonTestUtils.createAppInfo(
|
||||
"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(
|
||||
"extensions.dataCollectionPermissions.enabled",
|
||||
false
|
||||
true
|
||||
);
|
||||
|
||||
let OptionalPermissions;
|
||||
@@ -449,6 +447,7 @@ add_task(
|
||||
let permObj = {
|
||||
permissions: ["privacy"],
|
||||
origins: [],
|
||||
data_collection: [],
|
||||
};
|
||||
|
||||
// enable the permissions while the background is stopped
|
||||
@@ -544,9 +543,7 @@ add_task(
|
||||
}
|
||||
);
|
||||
|
||||
add_task(
|
||||
{ pref_set: [["extensions.dataCollectionPermissions.enabled", true]] },
|
||||
async function test_getAll_with_data_collection() {
|
||||
add_task(async function test_getAll_with_data_collection() {
|
||||
async function background() {
|
||||
browser.test.onMessage.addListener(async msg => {
|
||||
browser.test.assertEq("getAll", msg, "expected correct message");
|
||||
@@ -655,12 +652,9 @@ add_task(
|
||||
await getAllAndVerifyDataCollection([]);
|
||||
|
||||
await extension.unload();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
add_task(
|
||||
{ pref_set: [["extensions.dataCollectionPermissions.enabled", true]] },
|
||||
async function test_getAll_with_required_data_collection() {
|
||||
add_task(async function test_getAll_with_required_data_collection() {
|
||||
async function background() {
|
||||
browser.test.onMessage.addListener(async msg => {
|
||||
browser.test.assertEq("getAll", msg, "expected correct message");
|
||||
@@ -720,12 +714,9 @@ add_task(
|
||||
);
|
||||
|
||||
await extension.unload();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
add_task(
|
||||
{ pref_set: [["extensions.dataCollectionPermissions.enabled", true]] },
|
||||
async function test_request_with_data_collection() {
|
||||
add_task(async function test_request_with_data_collection() {
|
||||
async function background() {
|
||||
browser.test.onMessage.addListener(async msg => {
|
||||
if (msg === "request-good") {
|
||||
@@ -831,12 +822,9 @@ add_task(
|
||||
);
|
||||
|
||||
await extension.unload();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
add_task(
|
||||
{ pref_set: [["extensions.dataCollectionPermissions.enabled", true]] },
|
||||
async function test_contains_data_collection() {
|
||||
add_task(async function test_contains_data_collection() {
|
||||
async function background() {
|
||||
browser.test.onMessage.addListener(async (msg, arg) => {
|
||||
if (msg === "contains") {
|
||||
@@ -998,8 +986,7 @@ add_task(
|
||||
}
|
||||
|
||||
await extension.unload();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// This test verifies that data collection permissions are taken into account when
|
||||
// an extension is installed before the `extensions.dataCollectionPermissions.enabled`
|
||||
|
||||
@@ -14,6 +14,11 @@ const { PERMISSION_L10N, PERMISSION_L10N_ID_OVERRIDES } =
|
||||
|
||||
AddonTestUtils.initMochitest(this);
|
||||
|
||||
Services.prefs.setBoolPref(
|
||||
"extensions.dataCollectionPermissions.enabled",
|
||||
true
|
||||
);
|
||||
|
||||
const addonsBundle = new Localization(["toolkit/about/aboutAddons.ftl"], true);
|
||||
|
||||
const assertVisibleSections = async (permsSection, expectedHeaders) => {
|
||||
@@ -623,14 +628,6 @@ async function testPermissionsView({
|
||||
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() {
|
||||
await testPermissionsView({ manifestV3enabled: false, manifest_version: 2 });
|
||||
});
|
||||
@@ -920,6 +917,7 @@ add_task(async function test_OneOfMany_AllSites_toggle() {
|
||||
Assert.deepEqual(granted, {
|
||||
permissions: [],
|
||||
origins: ["http://*/*", "https://*/*"],
|
||||
data_collection: [],
|
||||
});
|
||||
|
||||
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() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.dataCollectionPermissions.enabled", true]],
|
||||
});
|
||||
|
||||
const TEST_CASES = [
|
||||
{
|
||||
title: "no permissions",
|
||||
@@ -1453,15 +1447,9 @@ add_task(async function test_data_collection() {
|
||||
await closeView(view);
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_data_collection_and_disabled_extension() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.dataCollectionPermissions.enabled", true]],
|
||||
});
|
||||
|
||||
const extensionId = "@some-id";
|
||||
const extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
@@ -1533,6 +1521,4 @@ add_task(async function test_data_collection_and_disabled_extension() {
|
||||
|
||||
await closeView(view);
|
||||
await extension.unload();
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
@@ -15,9 +15,7 @@ add_setup(async () => {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.userScripts.mv3.enabled", true],
|
||||
// TODO: Bug 1960273 - Update this test and remove this pref set when we
|
||||
// enable the data collection permissions on all channels.
|
||||
["extensions.dataCollectionPermissions.enabled", false],
|
||||
["extensions.dataCollectionPermissions.enabled", true],
|
||||
],
|
||||
});
|
||||
});
|
||||
@@ -33,7 +31,7 @@ function loadUserScriptsExtension(addonId) {
|
||||
background() {
|
||||
browser.permissions.onAdded.addListener(perms => {
|
||||
browser.test.assertDeepEq(
|
||||
{ permissions: ["userScripts"], origins: [] },
|
||||
{ permissions: ["userScripts"], origins: [], data_collection: [] },
|
||||
perms,
|
||||
"permissions.onAdded for userScripts permission"
|
||||
);
|
||||
@@ -42,7 +40,7 @@ function loadUserScriptsExtension(addonId) {
|
||||
});
|
||||
browser.permissions.onRemoved.addListener(perms => {
|
||||
browser.test.assertDeepEq(
|
||||
{ permissions: ["userScripts"], origins: [] },
|
||||
{ permissions: ["userScripts"], origins: [], data_collection: [] },
|
||||
perms,
|
||||
"permissions.onRemoved for userScripts permission"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user