Bug 596282 - Error in the js console if fullcount does not exists [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Thu, 16 Sep 2010 19:17:40 +0200
changeset 66660 39637b457f431f5ac06a5cf5c8078cc42710aad5
parent 66659 feb9a75245377141705f7845c4650f9f53f6f9e6
child 66661 5683eaa960b407d268a4a868236dd71206afe803
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs596282
Bug 596282 - Error in the js console if fullcount does not exists [r=mfinkle]
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -2526,17 +2526,18 @@ var BadgeHandlers = {
         // Get the feed and read the count, passing any saved username and password
         // but do not show any security dialogs if we fail
         let req = new XMLHttpRequest();
         req.mozBackgroundRequest = true;
         req.open("GET", "https://mail.google.com/mail/feed/atom", true, login.username, login.password);
         req.onreadystatechange = function(aEvent) {
           if (req.readyState == 4) {
             if (req.status == 200) {
-              this._lastCount = req.responseXML.getElementsByTagName("fullcount")[0].childNodes[0].nodeValue;
+              let count = req.responseXML.getElementsByTagName("fullcount");
+              this._lastCount = count ? count[0].childNodes[0].nodeValue : 0;
             } else {
               this._lastCount = 0;
             }
             this._lastCount = BadgeHandlers.setNumberBadge(aBadge, this._lastCount);
           }
         };
         req.send(null);
       }