Bug 596799 - document.getElementById("sync-button") is null. r=gavin, a=blocking-beta7

Make sure that the Sync button is only accessed when it actually exists in the toolbar. Also fix its entry in browserShared.inc.
This commit is contained in:
Philipp von Weitershausen 2010-09-16 04:24:10 +02:00
Родитель bc3c250786
Коммит e919ba363e
2 изменённых файлов: 23 добавлений и 11 удалений

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

@ -108,13 +108,17 @@ let gSyncUI = {
document.getElementById("sync-setup-state").hidden = !needsSetup; document.getElementById("sync-setup-state").hidden = !needsSetup;
document.getElementById("sync-syncnow-state").hidden = needsSetup; document.getElementById("sync-syncnow-state").hidden = needsSetup;
if (gBrowser) { if (!gBrowser)
document.getElementById("sync-button").removeAttribute("status"); return;
this._updateLastSyncTime();
} let button = document.getElementById("sync-button");
if (needsSetup) { if (!button)
document.getElementById("sync-button").removeAttribute("tooltiptext"); return;
}
button.removeAttribute("status");
this._updateLastSyncTime();
if (needsSetup)
button.removeAttribute("tooltiptext");
}, },
alltabsPopupShowing: function(event) { alltabsPopupShowing: function(event) {
@ -147,9 +151,14 @@ let gSyncUI = {
// Functions called by observers // Functions called by observers
onActivityStart: function SUI_onActivityStart() { onActivityStart: function SUI_onActivityStart() {
//XXXzpao Followup: Do this with a class. (bug 583384) if (!gBrowser)
if (gBrowser) return;
document.getElementById("sync-button").setAttribute("status", "active");
let button = document.getElementById("sync-button");
if (!button)
return;
button.setAttribute("status", "active");
}, },
onSyncFinish: function SUI_onSyncFinish() { onSyncFinish: function SUI_onSyncFinish() {
@ -312,6 +321,9 @@ let gSyncUI = {
return; return;
let syncButton = document.getElementById("sync-button"); let syncButton = document.getElementById("sync-button");
if (!syncButton)
return;
let lastSync; let lastSync;
try { try {
lastSync = Services.prefs.getCharPref("services.sync.lastSync"); lastSync = Services.prefs.getCharPref("services.sync.lastSync");

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

@ -1,3 +1,3 @@
%filter substitution %filter substitution
%define primaryToolbarButtons #back-button, #forward-button, #reload-button, #stop-button, #home-button, #print-button, #downloads-button, #history-button, #bookmarks-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-in-button, #sync-buttons %define primaryToolbarButtons #back-button, #forward-button, #reload-button, #stop-button, #home-button, #print-button, #downloads-button, #history-button, #bookmarks-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-in-button, #sync-button