Bug 1194258 - Make sure tracking protection section is hidden in Control Center when it's preffed off;r=paolo

This commit is contained in:
Brian Grinstead 2015-08-13 12:43:19 -07:00
parent 8b3f30ea3d
commit fcf8efa470
2 changed files with 28 additions and 4 deletions

View File

@ -24,10 +24,19 @@ registerCleanupFunction(function() {
}
});
function hidden(el) {
let win = el.ownerDocument.defaultView;
let display = win.getComputedStyle(el).getPropertyValue("display", null);
let opacity = win.getComputedStyle(el).getPropertyValue("opacity", null);
return display === "none" || opacity === "0";
}
add_task(function* testNormalBrowsing() {
yield UrlClassifierTestUtils.addTestTrackers();
tabbrowser = gBrowser;
let {gIdentityHandler} = tabbrowser.ownerGlobal;
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
@ -43,16 +52,21 @@ add_task(function* testNormalBrowsing() {
info("Load a test page containing tracking elements");
yield promiseTabLoadEvent(tab, TRACKING_PAGE);
ok(TrackingProtection.container.hidden, "The container is hidden");
gIdentityHandler._identityBox.click();
ok(hidden(TrackingProtection.container), "The container is hidden");
gIdentityHandler._identityPopup.hidden = true;
info("Load a test page not containing tracking elements");
yield promiseTabLoadEvent(tab, BENIGN_PAGE);
ok(TrackingProtection.container.hidden, "The container is hidden");
gIdentityHandler._identityBox.click();
ok(hidden(TrackingProtection.container), "The container is hidden");
gIdentityHandler._identityPopup.hidden = true;
});
add_task(function* testPrivateBrowsing() {
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
tabbrowser = privateWin.gBrowser;
let {gIdentityHandler} = tabbrowser.ownerGlobal;
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
@ -68,11 +82,15 @@ add_task(function* testPrivateBrowsing() {
info("Load a test page containing tracking elements");
yield promiseTabLoadEvent(tab, TRACKING_PAGE);
ok(TrackingProtection.container.hidden, "The container is hidden");
gIdentityHandler._identityBox.click();
ok(hidden(TrackingProtection.container), "The container is hidden");
gIdentityHandler._identityPopup.hidden = true;
info("Load a test page not containing tracking elements");
gIdentityHandler._identityBox.click();
yield promiseTabLoadEvent(tab, BENIGN_PAGE);
ok(TrackingProtection.container.hidden, "The container is hidden");
ok(hidden(TrackingProtection.container), "The container is hidden");
gIdentityHandler._identityPopup.hidden = true;
privateWin.close();
});

View File

@ -35,6 +35,12 @@
display: none;
}
/* Make sure hidden elements don't accidentally become visible from one of the
above selectors (see Bug 1194258) */
#identity-popup [hidden] {
display: none !important;
}
#identity-popup,
#identity-popup:not([panelopen]) .panel-viewstack[viewtype="main"]:not([transitioning]) #identity-popup-mainView {
/* Tiny hack to ensure the panel shrinks back to its original