Bug 1361364 - Implement chrome.privacy.services.passwordSavingEnabled, r=aswan

MozReview-Commit-ID: Hkg2pG04KgH

--HG--
extra : rebase_source : c16b6d6ff39a1f1bbb7e1fc7231d77ed535ae32b
extra : source : 4ebf1214c927104e0b2fc95b48648bbfac43cbb9
This commit is contained in:
Bob Silverberg 2017-05-25 15:31:12 -04:00
parent 905913ead5
commit 754a9682b2
3 changed files with 42 additions and 0 deletions

View File

@ -105,6 +105,16 @@ ExtensionPreferencesManager.addSetting("network.webRTCIPHandlingPolicy", {
}, },
}); });
ExtensionPreferencesManager.addSetting("services.passwordSavingEnabled", {
prefNames: [
"signon.rememberSignons",
],
setCallback(value) {
return {[this.prefNames[0]]: value};
},
});
ExtensionPreferencesManager.addSetting("websites.hyperlinkAuditingEnabled", { ExtensionPreferencesManager.addSetting("websites.hyperlinkAuditingEnabled", {
prefNames: [ prefNames: [
"browser.send_pings", "browser.send_pings",
@ -166,6 +176,15 @@ this.privacy = class extends ExtensionAPI {
return "default"; return "default";
}), }),
}, },
services: {
passwordSavingEnabled: getAPI(extension,
"services.passwordSavingEnabled",
() => {
return Preferences.get("signon.rememberSignons");
}),
},
websites: { websites: {
hyperlinkAuditingEnabled: getAPI(extension, hyperlinkAuditingEnabled: getAPI(extension,
"websites.hyperlinkAuditingEnabled", "websites.hyperlinkAuditingEnabled",

View File

@ -48,6 +48,17 @@
} }
} }
}, },
{
"namespace": "privacy.services",
"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"],
"properties": {
"passwordSavingEnabled": {
"$ref": "types.Setting",
"description": "If enabled, the password manager will ask if you want to save passwords. This preference's value is a boolean, defaulting to <code>true</code>."
}
}
},
{ {
"namespace": "privacy.websites", "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.", "description": "Use the <code>browser.privacy</code> API to control usage of the features in the browser that can affect a user's privacy.",

View File

@ -229,6 +229,9 @@ add_task(async function test_privacy_other_prefs() {
"network.peerConnectionEnabled": { "network.peerConnectionEnabled": {
"media.peerconnection.enabled": true, "media.peerconnection.enabled": true,
}, },
"services.passwordSavingEnabled": {
"signon.rememberSignons": true,
},
"websites.referrersEnabled": { "websites.referrersEnabled": {
"network.http.sendRefererHeader": 2, "network.http.sendRefererHeader": 2,
}, },
@ -336,6 +339,15 @@ add_task(async function test_privacy_other_prefs() {
"network.http.sendRefererHeader": 2, "network.http.sendRefererHeader": 2,
}); });
await testSetting("services.passwordSavingEnabled", false,
{
"signon.rememberSignons": false,
});
await testSetting("services.passwordSavingEnabled", true,
{
"signon.rememberSignons": true,
});
await extension.unload(); await extension.unload();
await promiseShutdownManager(); await promiseShutdownManager();