Bug 1432743 - Move cookie settings to the Site Data section and remove the cookies dialog from preferences. r=Gijs

After including cookies in the site data manager in bug 1421737, we would
like to move the cookies settings to the site data section to give them
more visibility and to unify site data and cookies.

Our UR has shown that our differentiation between site data and cookies
is not helpful to users and that they struggle with discovering the
cookie settings that are hidden in the "custom history" menu.

Since the cookie settings are quite powerful/potentially breaking,
we changed the top level preference from a checkbox to a radiogroup,
to be able to highlight the potential breakage associated with "deny".

This grouping is also recommended by the webstorage spec:
https://www.w3.org/TR/webstorage/#privacy

The cookies dialog is not removed yet, because it is still accessible from
Page Info, but bug 1348223 will likely remove it entirely.

MozReview-Commit-ID: Adisn70Ks2Q

--HG--
extra : rebase_source : 333d6165c74d6ff664cd3d603c5d834bfbde4326
This commit is contained in:
Johann Hofmann 2018-02-12 19:28:00 +01:00
Родитель ce991d9ac1
Коммит 9beab572d0
7 изменённых файлов: 115 добавлений и 239 удалений

Просмотреть файл

@ -274,12 +274,6 @@ var gPrivacyPane = {
}
return false;
});
setEventListener("historyRememberCookies", "click", function(event) {
if (event.button == 0) {
gPrivacyPane.showCookies();
}
return false;
});
setEventListener("historyDontRememberClear", "click", function(event) {
if (event.button == 0) {
gPrivacyPane.clearPrivateDataNow(true);
@ -296,8 +290,6 @@ var gPrivacyPane = {
gPrivacyPane.updateAutostart);
setEventListener("cookieExceptions", "command",
gPrivacyPane.showCookieExceptions);
setEventListener("showCookiesButton", "command",
gPrivacyPane.showCookies);
setEventListener("clearDataSettings", "command",
gPrivacyPane.showClearPrivateDataSettings);
setEventListener("disableTrackingProtectionExtension", "command",
@ -424,12 +416,6 @@ var gPrivacyPane = {
appendSearchKeywords("cookieExceptions", [
bundlePrefs.getString("cookiepermissionstext"),
]);
appendSearchKeywords("showCookiesButton", [
bundlePrefs.getString("cookiesAll"),
bundlePrefs.getString("removeAllCookies.label"),
bundlePrefs.getString("removeAllShownCookies.label"),
bundlePrefs.getString("removeSelectedCookies.label"),
]);
appendSearchKeywords("trackingProtectionExceptions", [
bundlePrefs.getString("trackingprotectionpermissionstitle"),
bundlePrefs.getString("trackingprotectionpermissionstext2"),
@ -837,22 +823,24 @@ var gPrivacyPane = {
acceptThirdPartyLabel.disabled = acceptThirdPartyMenu.disabled = !acceptCookies;
keepUntil.disabled = menu.disabled = this._autoStartPrivateBrowsing || !acceptCookies;
return acceptCookies;
// Our top-level setting is a radiogroup that only sets "enable all"
// and "disable all", so convert the pref value accordingly.
return acceptCookies ? "0" : "2";
},
/**
* Enables/disables the "keep until" label and menulist in response to the
* "accept cookies" checkbox being checked or unchecked.
* Updates the "accept third party cookies" menu based on whether the
* "accept cookies" or "block cookies" radio buttons are selected.
*/
writeAcceptCookies() {
var accept = document.getElementById("acceptCookies");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
// if we're enabling cookies, automatically select 'accept third party always'
if (accept.checked)
if (accept.value == "0")
acceptThirdPartyMenu.selectedIndex = 0;
return accept.checked ? 0 : 2;
return parseInt(accept.value, 10);
},
/**
@ -906,13 +894,6 @@ var gPrivacyPane = {
null, params);
},
/**
* Displays all the user's cookies in a dialog.
*/
showCookies(aCategory) {
gSubDialog.open("chrome://browser/content/preferences/cookies.xul");
},
// CLEAR PRIVATE DATA
/*

Просмотреть файл

@ -76,11 +76,9 @@
<menulist id="historyMode">
<menupopup>
<menuitem label="&historyHeader.remember.label;" value="remember" searchkeywords="&rememberDescription.label;
&rememberActions.pre.label;
&rememberActions.clearHistory.label;
&rememberActions.middle.label;
&rememberActions.removeCookies.label;
&rememberActions.post.label;"/>
&dontrememberActions.pre.label;
&dontrememberActions.clearHistory.label;
&dontrememberActions.post.label;"/>
<menuitem label="&historyHeader.dontremember.label;" value="dontremember" searchkeywords="&dontrememberDescription.label;
&dontrememberActions.pre.label;
&dontrememberActions.clearHistory.label;
@ -88,16 +86,15 @@
<menuitem label="&historyHeader.custom.label;" value="custom" searchkeywords="&privateBrowsingPermanent2.label;
&rememberHistory2.label;
&rememberSearchForm.label;
&acceptCookies2.label;
&acceptCookies3.label;
&cookieExceptions.label;
&acceptThirdParty2.pre.label;
&acceptThirdParty3.pre.label;
&acceptThirdParty.always.label;
&acceptThirdParty.visited.label;
&acceptThirdParty.never.label;
&keepUntil2.label;
&expire.label;
&close.label;
&showCookies.label;
&clearOnClose.label;
&clearOnCloseSettings.label;"/>
</menupopup>
@ -110,11 +107,9 @@
<hbox align="center" flex="1">
<vbox flex="1">
<description>&rememberDescription.label;</description>
<description>&rememberActions.pre.label;<label
<description>&dontrememberActions.pre.label;<label
class="text-link" id="historyRememberClear"
>&rememberActions.clearHistory.label;</label>&rememberActions.middle.label;<label
class="text-link" id="historyRememberCookies"
>&rememberActions.removeCookies.label;</label>&rememberActions.post.label;</description>
>&dontrememberActions.clearHistory.label;</label>&dontrememberActions.post.label;</description>
</vbox>
</hbox>
</vbox>
@ -143,73 +138,6 @@
label="&rememberSearchForm.label;"
accesskey="&rememberSearchForm.accesskey;"
preference="browser.formfill.enable"/>
<hbox id="cookiesBox">
<checkbox id="acceptCookies" label="&acceptCookies2.label;"
preference="network.cookie.cookieBehavior"
accesskey="&acceptCookies2.accesskey;"
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptCookies();"
flex="1" />
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
<hbox>
<button id="cookieExceptions"
class="accessory-button"
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
preference="pref.privacy.disable_button.cookie_exceptions"
searchkeywords="&address2.label;
&block.label;
&session.label;
&allow.label;
&removepermission2.label;
&removeallpermissions2.label;
&button.cancel.label;
&button.ok.label;"/>
</hbox>
</hbox>
<hbox id="acceptThirdPartyRow"
class="indent"
align="center">
<label id="acceptThirdPartyLabel" control="acceptThirdPartyMenu"
accesskey="&acceptThirdParty2.pre.accesskey;">&acceptThirdParty2.pre.label;</label>
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
<hbox>
<menulist id="acceptThirdPartyMenu" preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();">
<menupopup>
<menuitem label="&acceptThirdParty.always.label;" value="always"/>
<menuitem label="&acceptThirdParty.visited.label;" value="visited"/>
<menuitem label="&acceptThirdParty.never.label;" value="never"/>
</menupopup>
</menulist>
</hbox>
</hbox>
<hbox id="keepRow"
class="indent"
align="center">
<label id="keepUntil"
control="keepCookiesUntil"
accesskey="&keepUntil2.accesskey;">&keepUntil2.label;</label>
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
<hbox>
<menulist id="keepCookiesUntil"
preference="network.cookie.lifetimePolicy">
<menupopup>
<menuitem label="&expire.label;" value="0"/>
<menuitem label="&close.label;" value="2"/>
</menupopup>
</menulist>
</hbox>
<spacer flex="1"/>
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
<hbox>
<button id="showCookiesButton"
class="accessory-button"
label="&showCookies.label;"
accesskey="&showCookies.accesskey;"
preference="pref.privacy.disable_button.view_cookies"/>
</hbox>
</hbox>
<hbox id="clearDataBox"
align="center">
<checkbox id="alwaysClear"
@ -241,6 +169,96 @@
</deck>
</groupbox>
<!-- Site Data -->
<groupbox id="siteDataGroup" hidden="true" data-category="panePrivacy" data-hidden-from-search="true">
<caption><label>&siteData1.label;</label></caption>
<hbox align="baseline">
<vbox flex="1">
<radiogroup id="acceptCookies"
preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptCookies();">
<description flex="1">
<label id="totalSiteDataSize" class="tail-with-learn-more"></label>
<label id="siteDataLearnMoreLink" class="learnMore text-link">&siteDataLearnMoreLink.label;</label>
</description>
<hbox id="cookiesBox">
<radio label="&acceptCookies3.label;"
value="0"
accesskey="&acceptCookies3.accesskey;"
flex="1" />
</hbox>
<hbox id="keepRow"
class="indent"
align="center">
<label id="keepUntil"
control="keepCookiesUntil"
accesskey="&keepUntil2.accesskey;">&keepUntil2.label;</label>
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
<hbox>
<menulist id="keepCookiesUntil"
preference="network.cookie.lifetimePolicy">
<menupopup>
<menuitem label="&expire.label;" value="0"/>
<menuitem label="&close.label;" value="2"/>
</menupopup>
</menulist>
</hbox>
</hbox>
<hbox id="acceptThirdPartyRow"
class="indent"
align="center">
<label id="acceptThirdPartyLabel" control="acceptThirdPartyMenu"
accesskey="&acceptThirdParty3.pre.accesskey;">&acceptThirdParty3.pre.label;</label>
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
<hbox>
<menulist id="acceptThirdPartyMenu" preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();">
<menupopup>
<menuitem label="&acceptThirdParty.always.label;" value="always"/>
<menuitem label="&acceptThirdParty.visited.label;" value="visited"/>
<menuitem label="&acceptThirdParty.never.label;" value="never"/>
</menupopup>
</menulist>
</hbox>
</hbox>
<radio label="&blockCookies.label;"
value="2"
accesskey="&blockCookies.accesskey;"
flex="1" />
</radiogroup>
</vbox>
<vbox align="end">
<button id="clearSiteDataButton"
class="accessory-button"
icon="clear"
label="&clearSiteData1.label;" accesskey="&clearSiteData1.accesskey;"/>
<button id="siteDataSettings"
class="accessory-button"
label="&siteDataSettings.label;"
accesskey="&siteDataSettings.accesskey;"
searchkeywords="&window.title;
&hostCol.label;
&statusCol.label;
&usageCol.label;"/>
<button id="cookieExceptions"
class="accessory-button"
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
preference="pref.privacy.disable_button.cookie_exceptions"
searchkeywords="&address2.label;
&block.label;
&session.label;
&allow.label;
&removepermission2.label;
&removeallpermissions2.label;
&button.cancel.label;
&button.ok.label;"/>
</vbox>
</hbox>
</groupbox>
<!-- Address Bar -->
<groupbox id="locationBarGroup"
data-category="panePrivacy"
@ -261,34 +279,6 @@
</label>
</groupbox>
<!-- Site Data -->
<groupbox id="siteDataGroup" hidden="true" data-category="panePrivacy" data-hidden-from-search="true">
<caption><label>&siteData.label;</label></caption>
<hbox align="baseline">
<vbox flex="1">
<description flex="1">
<label id="totalSiteDataSize" class="tail-with-learn-more"></label>
<label id="siteDataLearnMoreLink" class="learnMore text-link">&siteDataLearnMoreLink.label;</label>
</description>
</vbox>
<vbox align="end">
<button id="siteDataSettings"
class="accessory-button"
label="&siteDataSettings.label;"
accesskey="&siteDataSettings.accesskey;"
searchkeywords="&window.title;
&hostCol.label;
&statusCol.label;
&usageCol.label;"/>
<button id="clearSiteDataButton"
class="accessory-button"
icon="clear"
label="&clearSiteData1.label;" accesskey="&clearSiteData1.accesskey;"/>
</vbox>
</hbox>
</groupbox>
<!-- Tracking -->
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
<caption><label>&trackingProtectionHeader2.label;</label></caption>

Просмотреть файл

@ -87,7 +87,6 @@ run-if = nightly_build
[browser_spotlight.js]
[browser_site_login_exceptions.js]
[browser_permissions_dialog.js]
[browser_cookies_dialog.js]
[browser_subdialogs.js]
support-files =
subdialog.xul

Просмотреть файл

@ -1,51 +0,0 @@
"use strict";
ChromeUtils.import("resource://gre/modules/Services.jsm");
const COOKIES_URL = "chrome://browser/content/preferences/cookies.xul";
const URI = Services.io.newURI("http://www.example.com");
var cookiesDialog;
add_task(async function openCookiesSubDialog() {
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let dialogOpened = promiseLoadSubDialog(COOKIES_URL);
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
let doc = content.document;
let cookiesButton = doc.getElementById("historyRememberCookies");
cookiesButton.click();
});
cookiesDialog = await dialogOpened;
});
add_task(async function testDeleteCookie() {
let doc = cookiesDialog.document;
// Add a cookie.
Services.cookies.add(URI.host, URI.pathQueryRef, "", "", false, false, true, Date.now());
let tree = doc.getElementById("cookiesList");
Assert.equal(tree.view.rowCount, 1, "Row count should initially be 1");
tree.focus();
tree.view.selection.select(0);
if (AppConstants.platform == "macosx") {
EventUtils.synthesizeKey("KEY_Backspace");
} else {
EventUtils.synthesizeKey("KEY_Delete");
}
await TestUtils.waitForCondition(() => tree.view.rowCount == 0);
// eslint-disable-next-line mozilla/no-cpows-in-tests
is_element_visible(content.gSubDialog._dialogs[0]._box,
"Subdialog is visible after deleting an element");
});
add_task(async function removeTab() {
gBrowser.removeCurrentTab();
});

Просмотреть файл

@ -116,10 +116,6 @@ function test_dependent_elements(win) {
}
function test_dependent_cookie_elements(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
ok(pbautostart, "the private browsing auto-start checkbox should exist");
let controls = [
win.document.getElementById("acceptThirdPartyLabel"),
win.document.getElementById("acceptThirdPartyMenu"),
@ -139,35 +135,13 @@ function test_dependent_cookie_elements(win) {
});
}
historymode.value = "custom";
controlChanged(historymode);
pbautostart.checked = false;
controlChanged(pbautostart);
expect_disabled(false);
acceptcookies.checked = false;
acceptcookies.value = "2";
controlChanged(acceptcookies);
expect_disabled(true);
acceptcookies.checked = true;
acceptcookies.value = "1";
controlChanged(acceptcookies);
expect_disabled(false);
let accessthirdparty = controls.shift();
acceptcookies.checked = false;
controlChanged(acceptcookies);
expect_disabled(true);
ok(accessthirdparty.disabled, "access third party button should be disabled");
pbautostart.checked = false;
controlChanged(pbautostart);
expect_disabled(true);
ok(accessthirdparty.disabled, "access third party button should be disabled");
acceptcookies.checked = true;
controlChanged(acceptcookies);
expect_disabled(false);
ok(!accessthirdparty.disabled, "access third party button should be enabled");
}
function test_dependent_clearonclose_elements(win) {
@ -207,23 +181,17 @@ function test_dependent_prefs(win) {
ok(historymode, "history mode menulist should exist");
let controls = [
win.document.getElementById("rememberHistory"),
win.document.getElementById("rememberForms"),
win.document.getElementById("acceptCookies")
win.document.getElementById("rememberForms")
];
controls.forEach(function(control) {
ok(control, "the micro-management controls should exist");
});
let thirdPartyCookieMenu = win.document.getElementById("acceptThirdPartyMenu");
ok(thirdPartyCookieMenu, "the third-party cookie control should exist");
function expect_checked(checked) {
controls.forEach(function(control) {
is(control.checked, checked,
control.getAttribute("id") + " should " + (checked ? "" : "not ") + "be checked");
});
is(thirdPartyCookieMenu.value == "always" || thirdPartyCookieMenu.value == "visited", checked, "third-party cookies should " + (checked ? "not " : "") + "be limited");
}
// controls should be checked in remember mode
@ -234,8 +202,6 @@ function test_dependent_prefs(win) {
// even if they're unchecked in custom mode
historymode.value = "custom";
controlChanged(historymode);
thirdPartyCookieMenu.value = "never";
controlChanged(thirdPartyCookieMenu);
controls.forEach(function(control) {
control.checked = false;
controlChanged(control);

Просмотреть файл

@ -54,7 +54,7 @@ available. -->
<!ENTITY connectionSettings.accesskey "e">
<!-- Site Data section manages sites using Storage API and is under Network -->
<!ENTITY siteData.label "Site Data">
<!ENTITY siteData1.label "Cookies and Site Data">
<!ENTITY clearSiteData1.label "Clear Data…">
<!ENTITY clearSiteData1.accesskey "l">
<!ENTITY siteDataSettings.label "Settings…">

Просмотреть файл

@ -38,11 +38,14 @@
<!ENTITY suggestionSettings2.label "Change preferences for search engine suggestions">
<!ENTITY acceptCookies2.label "Accept cookies from websites">
<!ENTITY acceptCookies2.accesskey "A">
<!ENTITY acceptCookies3.label "Accept cookies and site data from websites">
<!ENTITY acceptCookies3.accesskey "A">
<!ENTITY acceptThirdParty2.pre.label "Accept third-party cookies">
<!ENTITY acceptThirdParty2.pre.accesskey "y">
<!ENTITY blockCookies.label "Block cookies and site data (may cause websites to break)">
<!ENTITY blockCookies.accesskey "B">
<!ENTITY acceptThirdParty3.pre.label "Accept third-party cookies and site data">
<!ENTITY acceptThirdParty3.pre.accesskey "y">
<!ENTITY acceptThirdParty.always.label "Always">
<!ENTITY acceptThirdParty.never.label "Never">
<!ENTITY acceptThirdParty.visited.label "From visited">
@ -56,9 +59,6 @@
<!ENTITY cookieExceptions.label "Exceptions…">
<!ENTITY cookieExceptions.accesskey "E">
<!ENTITY showCookies.label "Show Cookies…">
<!ENTITY showCookies.accesskey "S">
<!ENTITY historyHeader2.pre.label "&brandShortName; will">
<!ENTITY historyHeader2.pre.accesskey "w">
<!ENTITY historyHeader.remember.label "Remember history">
@ -68,15 +68,6 @@
<!ENTITY rememberDescription.label "&brandShortName; will remember your browsing, download, form and search history, and keep cookies from websites you visit.">
<!-- LOCALIZATION NOTE (rememberActions.pre.label): include a trailing space as needed -->
<!-- LOCALIZATION NOTE (rememberActions.middle.label): include a starting and trailing space as needed -->
<!-- LOCALIZATION NOTE (rememberActions.post.label): include a starting space as needed -->
<!ENTITY rememberActions.pre.label "You may want to ">
<!ENTITY rememberActions.clearHistory.label "clear your recent history">
<!ENTITY rememberActions.middle.label ", or ">
<!ENTITY rememberActions.removeCookies.label "remove individual cookies">
<!ENTITY rememberActions.post.label ".">
<!ENTITY dontrememberDescription.label "&brandShortName; will use the same settings as private browsing, and will not remember any history as you browse the Web.">
<!-- LOCALIZATION NOTE (dontrememberActions.pre.label): include a trailing space as needed -->