Bug 490028: JavaScript strict warning; r=Myk
authorKarsten Düsterloh <mnyromyr@tprac.de>
Wed, 10 Jun 2009 22:26:36 +0200
changeset 2815 6062bc855a1ce2b8ad4a55e8dd687372449a415d
parent 2814 b69d6ae9baa06a0f792073b67567155a192526c9
child 2816 e59b05bbbb6413bf3884d4870b2f4f6fe656c97f
push id2283
push usermnyromyr@tprac.de
push dateWed, 10 Jun 2009 20:27:38 +0000
treeherdercomm-central@6062bc855a1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMyk
bugs490028
Bug 490028: JavaScript strict warning; r=Myk
mailnews/extensions/newsblog/content/Feed.js
--- a/mailnews/extensions/newsblog/content/Feed.js
+++ b/mailnews/extensions/newsblog/content/Feed.js
@@ -42,31 +42,36 @@ const kNewsBlogInvalidFeed = 1; // usual
 const kNewsBlogRequestFailure = 2; // generic networking failure when trying to download the feed.
 const kNewsBlogFeedIsBusy = 3;
 const kNewsBlogNoNewItems = 4; // there are no new articles for this feed
 
 // Cache for all of the feeds currently being downloaded, indexed by URL, so the load event listener
 // can access the Feed objects after it finishes downloading the feed.
 var FeedCache = 
 {
-  mFeeds: new Array(),
+  mFeeds: {},
 
   putFeed: function (aFeed)
   {
     this.mFeeds[this.normalizeHost(aFeed.url)] = aFeed;
   },
 
   getFeed: function (aUrl)
   {
-    return this.mFeeds[this.normalizeHost(aUrl)];
+    var index = this.normalizeHost(aUrl);
+    if (index in this.mFeeds)
+      return this.mFeeds[index];
+    return null;
   },
 
   removeFeed: function (aUrl)
   {
-    delete this.mFeeds[this.normalizeHost(aUrl)];
+    var index = this.normalizeHost(aUrl);
+    if (index in this.mFeeds)
+      delete this.mFeeds[index];
   },
 
   normalizeHost: function (aUrl)
   {
     var ioService = Components.classes["@mozilla.org/network/io-service;1"].
                     getService(Components.interfaces.nsIIOService);
     var normalizedUrl = ioService.newURI(aUrl, null, null);
     normalizedUrl.host = normalizedUrl.host.toLowerCase();