From 36aefe42c5e27329c8f49219837797ed6dd0e3c9 Mon Sep 17 00:00:00 2001 From: Paolo Amadini Date: Sat, 11 Aug 2018 17:25:58 +0100 Subject: [PATCH] Bug 1482648 - Part 4 - Clean up remaining references to broadcasters in front-end code. r=bgrins Differential Revision: https://phabricator.services.mozilla.com/D3151 --HG-- extra : rebase_source : d5aaf97c89deca198abefcebf61da3436e833ebb --- browser/base/content/browser.js | 18 +++++++++--------- browser/base/content/browser.xul | 2 +- browser/base/content/macWindow.inc.xul | 2 +- browser/base/content/nsContextMenu.js | 13 ------------- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index dfe39813e831..b3457200cdaf 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -343,28 +343,28 @@ function* browserWindows() { } function UpdateBackForwardCommands(aWebNavigation) { - var backBroadcaster = document.getElementById("Browser:Back"); - var forwardBroadcaster = document.getElementById("Browser:Forward"); + var backCommand = document.getElementById("Browser:Back"); + var forwardCommand = document.getElementById("Browser:Forward"); - // Avoid setting attributes on broadcasters if the value hasn't changed! + // Avoid setting attributes on commands if the value hasn't changed! // Remember, guys, setting attributes on elements is expensive! They // get inherited into anonymous content, broadcast to other widgets, etc.! // Don't do it if the value hasn't changed! - dwh - var backDisabled = backBroadcaster.hasAttribute("disabled"); - var forwardDisabled = forwardBroadcaster.hasAttribute("disabled"); + var backDisabled = backCommand.hasAttribute("disabled"); + var forwardDisabled = forwardCommand.hasAttribute("disabled"); if (backDisabled == aWebNavigation.canGoBack) { if (backDisabled) - backBroadcaster.removeAttribute("disabled"); + backCommand.removeAttribute("disabled"); else - backBroadcaster.setAttribute("disabled", true); + backCommand.setAttribute("disabled", true); } if (forwardDisabled == aWebNavigation.canGoForward) { if (forwardDisabled) - forwardBroadcaster.removeAttribute("disabled"); + forwardCommand.removeAttribute("disabled"); else - forwardBroadcaster.setAttribute("disabled", true); + forwardCommand.setAttribute("disabled", true); } } diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index e55c27d20aba..42ff6aa91384 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -81,7 +81,7 @@ xmlns="http://www.w3.org/1999/xhtml" Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser.js", this); -# All sets except for popupsets (commands, keys, stringbundles and broadcasters) +# All sets except for popupsets (commands, keys, and stringbundles) # *must* go into the browser-sets.inc file so that they can be shared with other # top level windows in macWindow.inc.xul. #include browser-sets.inc diff --git a/browser/base/content/macWindow.inc.xul b/browser/base/content/macWindow.inc.xul index 4b32feacd03d..4af11c44bc9d 100644 --- a/browser/base/content/macWindow.inc.xul +++ b/browser/base/content/macWindow.inc.xul @@ -17,7 +17,7 @@ -# All sets except for popupsets (commands, keys, stringbundles and broadcasters) +# All sets except for popupsets (commands, keys, and stringbundles) # *must* go into the browser-sets.inc file so that they can be shared with # browser.xul #include browser-sets.inc diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index d5051ece062e..7e3cdc6a5674 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -375,9 +375,6 @@ nsContextMenu.prototype = { this.showItem("context-reload", stopReloadItem == "reload"); this.showItem("context-stop", stopReloadItem == "stop"); - - // XXX: Stop is determined in browser.js; the canStop broadcaster is broken - // this.setItemAttrFromNode( "context-stop", "disabled", "canStop" ); }, initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() { @@ -1343,16 +1340,6 @@ nsContextMenu.prototype = { } }, - // Set context menu attribute according to like attribute of another node - // (such as a broadcaster). - setItemAttrFromNode(aItem_id, aAttr, aOther_id) { - var elem = document.getElementById(aOther_id); - if (elem && elem.getAttribute(aAttr) == "true") - this.setItemAttr(aItem_id, aAttr, "true"); - else - this.setItemAttr(aItem_id, aAttr, null); - }, - // Temporary workaround for DOM api not yet implemented by XUL nodes. cloneNode(aItem) { // Create another element like the one we're cloning.