зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1345158 - Implement privacy.websites.trackingProtectionMode r=aswan,bsilverberg
MozReview-Commit-ID: Lf88M4V4JEJ --HG-- extra : rebase_source : 8b7a716a2e82ce31f0500afe0e4342ef7bc94064
This commit is contained in:
Родитель
f7fb96c7e5
Коммит
dd8500b327
|
@ -138,6 +138,36 @@ ExtensionPreferencesManager.addSetting("websites.referrersEnabled", {
|
|||
},
|
||||
});
|
||||
|
||||
ExtensionPreferencesManager.addSetting("websites.trackingProtectionMode", {
|
||||
prefNames: [
|
||||
"privacy.trackingprotection.enabled",
|
||||
"privacy.trackingprotection.pbmode.enabled",
|
||||
],
|
||||
|
||||
setCallback(value) {
|
||||
// Default to private browsing.
|
||||
let prefs = {
|
||||
"privacy.trackingprotection.enabled": false,
|
||||
"privacy.trackingprotection.pbmode.enabled": true,
|
||||
};
|
||||
|
||||
switch (value) {
|
||||
case "private_browsing":
|
||||
break;
|
||||
|
||||
case "always":
|
||||
prefs["privacy.trackingprotection.enabled"] = true;
|
||||
break;
|
||||
|
||||
case "never":
|
||||
prefs["privacy.trackingprotection.pbmode.enabled"] = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return prefs;
|
||||
},
|
||||
});
|
||||
|
||||
this.privacy = class extends ExtensionAPI {
|
||||
getAPI(context) {
|
||||
let {extension} = context;
|
||||
|
@ -196,6 +226,18 @@ this.privacy = class extends ExtensionAPI {
|
|||
() => {
|
||||
return Preferences.get("network.http.sendRefererHeader") !== 0;
|
||||
}),
|
||||
trackingProtectionMode: getPrivacyAPI(extension,
|
||||
"websites.trackingProtectionMode",
|
||||
() => {
|
||||
if (Preferences.get("privacy.trackingprotection.enabled")) {
|
||||
return "always";
|
||||
} else if (
|
||||
Preferences.get("privacy.trackingprotection.pbmode.enabled")) {
|
||||
return "private_browsing";
|
||||
}
|
||||
return "never";
|
||||
}),
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -63,6 +63,14 @@
|
|||
"namespace": "privacy.websites",
|
||||
"description": "Use the <code>browser.privacy</code> API to control usage of the features in the browser that can affect a user's privacy.",
|
||||
"permissions": ["privacy"],
|
||||
"types": [
|
||||
{
|
||||
"id": "TrackingProtectionModeOption",
|
||||
"type": "string",
|
||||
"enum": ["always", "never", "private_browsing"],
|
||||
"description": "The mode for tracking protection."
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"thirdPartyCookiesAllowed": {
|
||||
"$ref": "types.Setting",
|
||||
|
@ -81,6 +89,10 @@
|
|||
"$ref": "types.Setting",
|
||||
"description": "<strong>Available on Windows and ChromeOS only</strong>: If enabled, the browser provides a unique ID to plugins in order to run protected content. The value of this preference is of type boolean, and the default value is <code>true</code>.",
|
||||
"unsupported": true
|
||||
},
|
||||
"trackingProtectionMode": {
|
||||
"$ref": "types.Setting",
|
||||
"description": "Allow users to specify the mode for tracking protection. This setting's value is of type TrackingProtectionModeOption, defaulting to <code>private_browsing_only</code>."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,6 +339,19 @@ add_task(async function test_privacy_other_prefs() {
|
|||
"network.http.sendRefererHeader": 2,
|
||||
});
|
||||
|
||||
await testSetting("websites.trackingProtectionMode", "always", {
|
||||
"privacy.trackingprotection.enabled": true,
|
||||
"privacy.trackingprotection.pbmode.enabled": true,
|
||||
});
|
||||
await testSetting("websites.trackingProtectionMode", "never", {
|
||||
"privacy.trackingprotection.enabled": false,
|
||||
"privacy.trackingprotection.pbmode.enabled": false,
|
||||
});
|
||||
await testSetting("websites.trackingProtectionMode", "private_browsing", {
|
||||
"privacy.trackingprotection.enabled": false,
|
||||
"privacy.trackingprotection.pbmode.enabled": true,
|
||||
});
|
||||
|
||||
await testSetting("services.passwordSavingEnabled", false,
|
||||
{
|
||||
"signon.rememberSignons": false,
|
||||
|
|
Загрузка…
Ссылка в новой задаче