diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc index 55834bad8d2..197a5894239 100644 --- a/browser/base/content/browser-menubar.inc +++ b/browser/base/content/browser-menubar.inc @@ -88,7 +88,9 @@ - + + onpopupshowing="if (event.target != this) return true; updateEditUIVisibility(); gContextMenu = new nsContextMenu(this, window.getBrowser()); return gContextMenu.shouldDisplay;" + onpopuphiding="if (event.target == this) { gContextMenu = null; updateEditUIVisibility(); }"> #include browser-context.inc diff --git a/toolkit/content/editMenuOverlay.js b/toolkit/content/editMenuOverlay.js index 20e9b644194..cd175cca31c 100644 --- a/toolkit/content/editMenuOverlay.js +++ b/toolkit/content/editMenuOverlay.js @@ -39,6 +39,14 @@ // update menu items that rely on focus or on the current selection function goUpdateGlobalEditMenuItems() { + // Don't bother updating the edit commands if they aren't visible in any way + // (i.e. the Edit menu isn't open, nor is the context menu open, nor have the + // cut, copy, and paste buttons been added to the toolbars) for performance. + // This only works in applications/on platforms that set the gEditUIVisible + // flag, so we check to see if that flag is defined before using it. + if (typeof gEditUIVisible != "undefined" && !gEditUIVisible) + return; + goUpdateCommand("cmd_undo"); goUpdateCommand("cmd_redo"); goUpdateCommand("cmd_cut");