diff --git a/browser/base/content/browser-fullScreenAndPointerLock.js b/browser/base/content/browser-fullScreenAndPointerLock.js
index 8a08c7f88f9b..37cfc0fffb00 100644
--- a/browser/base/content/browser-fullScreenAndPointerLock.js
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js
@@ -870,24 +870,11 @@ var FullScreen = {
for (let el of document.querySelectorAll(
"toolbar[fullscreentoolbar=true]"
)) {
+ // Set the inFullscreen attribute to allow specific styling
+ // in fullscreen mode
if (aEnterFS) {
- // Give the main nav bar and the tab bar the fullscreen context menu,
- // otherwise remove context menu to prevent breakage
- el.setAttribute("saved-context", el.getAttribute("context"));
- if (el.id == "nav-bar" || el.id == "TabsToolbar") {
- el.setAttribute("context", "autohide-context");
- } else {
- el.removeAttribute("context");
- }
-
- // Set the inFullscreen attribute to allow specific styling
- // in fullscreen mode
el.setAttribute("inFullscreen", true);
} else {
- if (el.hasAttribute("saved-context")) {
- el.setAttribute("context", el.getAttribute("saved-context"));
- el.removeAttribute("saved-context");
- }
el.removeAttribute("inFullscreen");
}
}
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 8544f39868ae..9a4f86720d61 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6367,6 +6367,16 @@ nsBrowserAccess.prototype = {
},
};
+function showFullScreenViewContextMenuItems(popup) {
+ for (let node of popup.querySelectorAll('[contexttype="fullscreen"]')) {
+ node.hidden = !window.fullScreen;
+ }
+ let autoHide = popup.querySelector(".fullscreen-context-autohide");
+ if (autoHide) {
+ FullScreen.getAutohide(autoHide);
+ }
+}
+
function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
var popup = aEvent.target;
if (popup != aEvent.currentTarget) {
@@ -6418,6 +6428,9 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
let removeFromToolbar = popup.querySelector(
".customize-context-removeFromToolbar"
);
+ // Show/hide fullscreen context menu items and set the
+ // autohide item's checked state to mirror the autohide pref.
+ showFullScreenViewContextMenuItems(popup);
// View -> Toolbars menu doesn't have the moveToPanel or removeFromToolbar items.
if (!moveToPanel || !removeFromToolbar) {
return;
diff --git a/browser/base/content/main-popupset.inc.xhtml b/browser/base/content/main-popupset.inc.xhtml
index c531d2b0ce10..01b6e51c05ed 100644
--- a/browser/base/content/main-popupset.inc.xhtml
+++ b/browser/base/content/main-popupset.inc.xhtml
@@ -92,6 +92,15 @@
data-lazy-l10n-id="tab-context-reopen-closed-tabs"
data-l10n-args='{"tabCount": 1}'
observes="History:UndoCloseTab"/>
+
+
+