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

MozReview-Commit-ID: Ldmya1q7eO9

--HG--
extra : rebase_source : e7f1ee3d167a458dcbd0794718b0b11b286e8d1e
This commit is contained in:
Jonathan Kingston 2016-11-24 13:45:06 +00:00
Родитель 4f1d9881f2
Коммит fe383ac71b
2 изменённых файлов: 17 добавлений и 1 удалений

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

@ -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")

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

@ -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);
});