Bug 1318491 - Disable new tab longpress containers menu for private browsing mode r=Gijs

MozReview-Commit-ID: Ldmya1q7eO9
This commit is contained in:
Jonathan Kingston
2016-11-24 13:45:06 +00:00
parent 0326f1f551
commit 9ef9706677
2 changed files with 17 additions and 1 deletions

View File

@@ -5401,7 +5401,8 @@
switch (aTopic) {
case "nsPref:changed":
// This is the only pref observed.
let containersEnabled = Services.prefs.getBoolPref("privacy.userContext.enabled");
let containersEnabled = Services.prefs.getBoolPref("privacy.userContext.enabled")
&& !PrivateBrowsingUtils.isWindowPrivate(window);
const newTab = document.getElementById("new-tab-button");
const newTab2 = document.getAnonymousElementByAttribute(this, "anonid", "tabs-newtab-button")

View File

@@ -33,3 +33,18 @@ add_task(function* test() {
yield BrowserTestUtils.removeTab(tab);
}
});
add_task(function* test_private_mode() {
let privateWindow = yield BrowserTestUtils.openNewBrowserWindow({private: true});
let privateDocument = privateWindow.document;
let {tabContainer} = privateWindow.gBrowser;
let newTab = privateDocument.getAnonymousElementByAttribute(tabContainer, "anonid", "tabs-newtab-button");
let newTab2 = privateDocument.getElementById("new-tab-button");
// Check to ensure we are talking about the right button
ok(!!newTab.clientWidth, "new tab button should not be hidden");
ok(!newTab2.clientWidth, "overflow new tab button should be hidden");
let popup = privateDocument.getAnonymousElementByAttribute(newTab, "anonid", "newtab-popup");
ok(!popup, "new tab should not have a popup");
yield BrowserTestUtils.closeWindow(privateWindow);
});