зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
bb3d2cf63d
Коммит
36aefe42c5
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ xmlns="http://www.w3.org/1999/xhtml"
|
|||
Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser.js", this);
|
||||
</script>
|
||||
|
||||
# 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
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<script type="application/javascript" src="chrome://browser/content/nonbrowser-mac.js"></script>
|
||||
|
||||
# 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
|
||||
|
|
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче