mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
Bug 845592 - Adjust the New Window menu entries in permanent private browsing mode; r=gavin
--HG-- extra : rebase_source : c2bda2726ec2d8f63c20b69c5b7718f1403d619c
This commit is contained in:
parent
1efd773ca8
commit
a7be3f8447
@ -7198,7 +7198,6 @@ let gPrivateBrowsingUI = {
|
||||
// temporary fix until bug 463607 is fixed
|
||||
document.getElementById("Tools:Sanitize").setAttribute("disabled", "true");
|
||||
|
||||
// Adjust the window's title
|
||||
if (window.location.href == getBrowserURL()) {
|
||||
#ifdef XP_MACOSX
|
||||
if (!PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
||||
@ -7206,6 +7205,7 @@ let gPrivateBrowsingUI = {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Adjust the window's title
|
||||
let docElement = document.documentElement;
|
||||
docElement.setAttribute("title",
|
||||
docElement.getAttribute("title_privatebrowsing"));
|
||||
@ -7214,6 +7214,23 @@ let gPrivateBrowsingUI = {
|
||||
docElement.setAttribute("privatebrowsingmode",
|
||||
PrivateBrowsingUtils.permanentPrivateBrowsing ? "permanent" : "temporary");
|
||||
gBrowser.updateTitlebar();
|
||||
|
||||
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
||||
// Adjust the New Window menu entries
|
||||
[
|
||||
{ normal: "menu_newNavigator", private: "menu_newPrivateWindow" },
|
||||
{ normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow" },
|
||||
].forEach(function(menu) {
|
||||
let newWindow = document.getElementById(menu.normal);
|
||||
let newPrivateWindow = document.getElementById(menu.private);
|
||||
if (newWindow && newPrivateWindow) {
|
||||
newPrivateWindow.hidden = true;
|
||||
newWindow.label = newPrivateWindow.label;
|
||||
newWindow.accessKey = newPrivateWindow.accessKey;
|
||||
newWindow.command = newPrivateWindow.command;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (gURLBar) {
|
||||
|
@ -16,9 +16,50 @@ function test() {
|
||||
whenDelayedStartupFinished(privateWin, function() {
|
||||
nonPrivateWin = privateWin.OpenBrowserWindow({private: false});
|
||||
ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "privateWin.OpenBrowserWindow({private: false}) should open a normal window");
|
||||
|
||||
nonPrivateWin.close();
|
||||
|
||||
[
|
||||
{ normal: "menu_newNavigator", private: "menu_newPrivateWindow", accesskey: true },
|
||||
{ normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow", accesskey: false },
|
||||
].forEach(function(menu) {
|
||||
let newWindow = privateWin.document.getElementById(menu.normal);
|
||||
let newPrivateWindow = privateWin.document.getElementById(menu.private);
|
||||
if (newWindow && newPrivateWindow) {
|
||||
ok(!newPrivateWindow.hidden, "New Private Window menu item should be hidden");
|
||||
isnot(newWindow.label, newPrivateWindow.label, "New Window's label shouldn't be overwritten");
|
||||
if (menu.accesskey) {
|
||||
isnot(newWindow.accessKey, newPrivateWindow.accessKey, "New Window's accessKey shouldn't be overwritten");
|
||||
}
|
||||
isnot(newWindow.command, newPrivateWindow.command, "New Window's command shouldn't be overwritten");
|
||||
}
|
||||
});
|
||||
|
||||
privateWin.close();
|
||||
finish();
|
||||
|
||||
Services.prefs.setBoolPref("browser.privatebrowsing.autostart", true);
|
||||
privateWin = OpenBrowserWindow({private: true});
|
||||
whenDelayedStartupFinished(privateWin, function() {
|
||||
[
|
||||
{ normal: "menu_newNavigator", private: "menu_newPrivateWindow", accessKey: true },
|
||||
{ normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow", accessKey: false },
|
||||
].forEach(function(menu) {
|
||||
let newWindow = privateWin.document.getElementById(menu.normal);
|
||||
let newPrivateWindow = privateWin.document.getElementById(menu.private);
|
||||
if (newWindow && newPrivateWindow) {
|
||||
ok(newPrivateWindow.hidden, "New Private Window menu item should be hidden");
|
||||
is(newWindow.label, newPrivateWindow.label, "New Window's label should be overwritten");
|
||||
if (menu.accesskey) {
|
||||
is(newWindow.accessKey, newPrivateWindow.accessKey, "New Window's accessKey should be overwritten");
|
||||
}
|
||||
is(newWindow.command, newPrivateWindow.command, "New Window's command should be overwritten");
|
||||
}
|
||||
});
|
||||
|
||||
privateWin.close();
|
||||
Services.prefs.clearUserPref("browser.privatebrowsing.autostart");
|
||||
finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user