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

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

@ -1,3 +1,3 @@
%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