Bug 413437 - Locking homepage buttons to disable them is broken. patch from Michael Schonfeld <dev@schonfeld.org>, r=me.

This commit is contained in:
mozilla.mano%sent.com 2008-02-12 19:19:26 +00:00
Родитель c85a55a737
Коммит 2b62bd839d
1 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -131,6 +131,7 @@ var gMainPane = {
_updateUseCurrentButton: function () { _updateUseCurrentButton: function () {
var useCurrent = document.getElementById("useCurrent"); var useCurrent = document.getElementById("useCurrent");
var windowIsPresent;
var win; var win;
if (document.documentElement.instantApply) { if (document.documentElement.instantApply) {
const Cc = Components.classes, Ci = Components.interfaces; const Cc = Components.classes, Ci = Components.interfaces;
@ -144,7 +145,7 @@ var gMainPane = {
if (win && win.document.documentElement if (win && win.document.documentElement
.getAttribute("windowtype") == "navigator:browser") { .getAttribute("windowtype") == "navigator:browser") {
useCurrent.disabled = false; windowIsPresent = true;
var tabbrowser = win.document.getElementById("content"); var tabbrowser = win.document.getElementById("content");
if (tabbrowser.browsers.length > 1) if (tabbrowser.browsers.length > 1)
@ -153,9 +154,16 @@ var gMainPane = {
useCurrent.label = useCurrent.getAttribute("label1"); useCurrent.label = useCurrent.getAttribute("label1");
} }
else { else {
windowIsPresent = false;
useCurrent.label = useCurrent.getAttribute("label1"); useCurrent.label = useCurrent.getAttribute("label1");
useCurrent.disabled = true;
} }
// In this case, the button's disabled state is set by preferences.xml.
if (document.getElementById
("pref.browser.homepage.disable_button.current_page").locked)
return;
useCurrent.disabled = !windowIsPresent;
}, },
/** /**