fune/browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js
Johann Hofmann 7b4b3f1ba2 Bug 1422160 - Merge cache and site data in about:preferences. r=jaws
This commit removes most of the cache section in about:preferences,
following the UX concept from bug 1421690. This is in the general
interest of de-cluttering privacy preferences and giving users controls
that are easier to understand and use.

The cache size is instead shown in the site data section and the cache
can be cleared using the "Clear Data" button in that same section.

MozReview-Commit-ID: 7PDTDgllFFI

--HG--
extra : rebase_source : 98eea84efb2b90068bf0d106321d8af64afd1f77
2018-02-13 12:33:29 +01:00

43 lines
1.6 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
function test() {
waitForExplicitFinish();
// Adding one fake site so that the SiteDataManager would run.
// Otherwise, without any site then it would just return so we would end up in not testing SiteDataManager.
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin("https://www.foo.com");
Services.perms.addFromPrincipal(principal, "persistent-storage", Ci.nsIPermissionManager.ALLOW_ACTION);
registerCleanupFunction(function() {
Services.perms.removeFromPrincipal(principal, "persistent-storage");
});
SpecialPowers.pushPrefEnv({set: [
["privacy.userContext.ui.enabled", true]
]}).then(() => open_preferences(runTest));
}
function runTest(win) {
is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
let tab = win.document;
let elements = tab.getElementById("mainPrefPane").children;
// Test if privacy pane is opened correctly
win.gotoPref("panePrivacy");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "panePrivacy") {
is_element_visible(element, `Privacy element of id=${element.id} should be visible`);
} else {
is_element_hidden(element, `Non-Privacy element of id=${element.id} should be hidden`);
}
}
gBrowser.removeCurrentTab();
win.close();
finish();
}