Fix a bug in downloads.js about download ids.
Fix a bug in downloads.js about download ids.

In Downloads.prototype.isUpdateNeeded(downloads), |downloads| is an array of objects (associate arrays) sent by DownloadsDOMHandler::SendCurrentDownloads(), whereas |this.downloads_| is an associate array mapping download ids (as in DownloadItem::GetId()) to |Download| objects (similar to but slightly different from the associative arrays sent by SendCurrentDownloads()). This code used to assume that |Download.id_| was in the same counter space as the indices into |downloads|, but that is no longer the case. isUpdateNeeded() should explicitly use |downloads[i].id| as keys into |this.downloads_|.

This really only caused problems when there are >150 downloads and the user deletes one. In this case, DownloadsDOMHandler sends 150 downloads to downloadsList(), not including the removed item, but including a different item. This caused isUpdateNeeded to look for |downloads[150]|, which is impossible because DownloadsDOMHandler truncates |downloads| to 150 items.

BUG=146020

Review URL: https://chromiumcodereview.appspot.com/10909064

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@154976 0039d316-1c4b-4281-b951-d872f2087c98

Fireblend/chromium-crosswalk,chuan9/chromium-crosswalk,nacl-webkit/chrome_deps,axinging/chromium-crosswalk,nacl-webkit/chrome_deps,fujunwei/chromium-crosswalk,bright-sparks/chromium-spacewalk,zcbenz/cefode-chromium,anirudhSK/chromium,ondra-novak/chromium.src,junmin-zhu/chromium-rivertrail,Just-D/chromium-1,krieger-od/nwjs_chromium.src,bright-sparks/chromium-spacewalk,mohamed--abdel-maksoud/chromium.src,dednal/chromium.src,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,zcbenz/cefode-chromium,mogoweb/chromium-crosswalk,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,ondra-novak/chromium.src,zcbenz/cefode-chromium,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,patrickm/chromium.src,anirudhSK/chromium,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk-efl,junmin-zhu/chromium-rivertrail,Pluto-tv/chromium-crosswalk,mogoweb/chromium-crosswalk,ChromiumWebApps/chromium,axinging/chromium-crosswalk,Jonekee/chromium.src,crosswalk-project/chromium-crosswalk-efl,dushu1203/chromium.src,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,markYoungH/chromium.src,ltilve/chromium,crosswalk-project/chromium-crosswalk-efl,timopulkkinen/BubbleFish,Pluto-tv/chromium-crosswalk,hujiajie/pa-chromium,krieger-od/nwjs_chromium.src,bright-sparks/chromium-spacewalk,patrickm/chromium.src,nacl-webkit/chrome_deps,markYoungH/chromium.src,littlstar/chromium.src,Chilledheart/chromium,M4sse/chromium.src,anirudhSK/chromium,hgl888/chromium-crosswalk,hujiajie/pa-chromium,timopulkkinen/BubbleFish,PeterWangIntel/chromium-crosswalk,M4sse/chromium.src,M4sse/chromium.src,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,Chilledheart/chromium,ChromiumWebApps/chromium,patrickm/chromium.src,anirudhSK/chromium,M4sse/chromium.src,anirudhSK/chromium,ChromiumWebApps/chromium,hujiajie/pa-chromium,timopulkkinen/BubbleFish,Jonekee/chromium.src,bright-sparks/chromium-spacewalk,markYoungH/chromium.src,hujiajie/pa-chromium,axinging/chromium-crosswalk,dushu1203/chromium.src,dushu1203/chromium.src,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk,littlstar/chromium.src,nacl-webkit/chrome_deps,dushu1203/chromium.src,patrickm/chromium.src,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,Chilledheart/chromium,axinging/chromium-crosswalk,ChromiumWebApps/chromium,Just-D/chromium-1,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,Chilledheart/chromium,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,fujunwei/chromium-crosswalk,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,littlstar/chromium.src,jaruba/chromium.src,Just-D/chromium-1,axinging/chromium-crosswalk,junmin-zhu/chromium-rivertrail,jaruba/chromium.src,mogoweb/chromium-crosswalk,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,Just-D/chromium-1,ltilve/chromium,chuan9/chromium-crosswalk,littlstar/chromium.src,ondra-novak/chromium.src,zcbenz/cefode-chromium,nacl-webkit/chrome_deps,ChromiumWebApps/chromium,pozdnyakov/chromium-crosswalk,jaruba/chromium.src,Jonekee/chromium.src,mogoweb/chromium-crosswalk,dednal/chromium.src,mogoweb/chromium-crosswalk,ltilve/chromium,krieger-od/nwjs_chromium.src,krieger-od/nwjs_chromium.src,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,jaruba/chromium.src,markYoungH/chromium.src,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,markYoungH/chromium.src,fujunwei/chromium-crosswalk,nacl-webkit/chrome_deps,littlstar/chromium.src,M4sse/chromium.src,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,Chilledheart/chromium,timopulkkinen/BubbleFish,ondra-novak/chromium.src,hgl888/chromium-crosswalk,patrickm/chromium.src,pozdnyakov/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,junmin-zhu/chromium-rivertrail,jaruba/chromium.src,dednal/chromium.src,hgl888/chromium-crosswalk,Fireblend/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,M4sse/chromium.src,mogoweb/chromium-crosswalk,nacl-webkit/chrome_deps,ondra-novak/chromium.src,Pluto-tv/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,zcbenz/cefode-chromium,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,dednal/chromium.src,Just-D/chromium-1,pozdnyakov/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,M4sse/chromium.src,pozdnyakov/chromium-crosswalk,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,zcbenz/cefode-chromium,M4sse/chromium.src,TheTypoMaster/chromium-crosswalk,ondra-novak/chromium.src,ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,ltilve/chromium,fujunwei/chromium-crosswalk,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,fujunwei/chromium-crosswalk,Chilledheart/chromium,anirudhSK/chromium,nacl-webkit/chrome_deps,zcbenz/cefode-chromium,axinging/chromium-crosswalk,dushu1203/chromium.src,zcbenz/cefode-chromium,krieger-od/nwjs_chromium.src,markYoungH/chromium.src,Jonekee/chromium.src,Just-D/chromium-1,hujiajie/pa-chromium,markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,patrickm/chromium.src,dednal/chromium.src,ChromiumWebApps/chromium,ChromiumWebApps/chromium,pozdnyakov/chromium-crosswalk,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,hujiajie/pa-chromium,chuan9/chromium-crosswalk,ltilve/chromium,zcbenz/cefode-chromium,junmin-zhu/chromium-rivertrail,Fireblend/chromium-crosswalk,markYoungH/chromium.src,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,nacl-webkit/chrome_deps,krieger-od/nwjs_chromium.src,patrickm/chromium.src,fujunwei/chromium-crosswalk,junmin-zhu/chromium-rivertrail,M4sse/chromium.src,ChromiumWebApps/chromium,littlstar/chromium.src,ltilve/chromium,ondra-novak/chromium.src,anirudhSK/chromium,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,Chilledheart/chromium,crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Just-D/chromium-1,PeterWangIntel/chromium-crosswalk,M4sse/chromium.src,dednal/chromium.src,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,nacl-webkit/chrome_deps,Jonekee/chromium.src,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,littlstar/chromium.src,ltilve/chromium,Chilledheart/chromium,fujunwei/chromium-crosswalk,Jonekee/chromium.src,nacl-webkit/chrome_deps,zcbenz/cefode-chromium,dushu1203/chromium.src,Chilledheart/chromium,dednal/chromium.src,markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,hujiajie/pa-chromium,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,patrickm/chromium.src,ltilve/chromium,anirudhSK/chromium,Jonekee/chromium.src,hujiajie/pa-chromium,hgl888/chromium-crosswalk-efl,chuan9/chromium-crosswalk,hujiajie/pa-chromium,hgl888/chromium-crosswalk,zcbenz/cefode-chromium,chuan9/chromium-crosswalk,axinging/chromium-crosswalk,jaruba/chromium.src,chuan9/chromium-crosswalk,hujiajie/pa-chromium,Pluto-tv/chromium-crosswalk,pozdnyakov/chromium-crosswalk,junmin-zhu/chromium-rivertrail,pozdnyakov/chromium-crosswalk,junmin-zhu/chromium-rivertrail,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,Pluto-tv/chromium-crosswalk,dednal/chromium.src,dednal/chromium.src,anirudhSK/chromium,chuan9/chromium-crosswalk,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,dushu1203/chromium.src,jaruba/chromium.src,jaruba/chromium.src,PeterWangIntel/chromium-crosswalk,chuan9/chromium-crosswalk,Jonekee/chromium.src,hujiajie/pa-chromium,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,pozdnyakov/chromium-crosswalk,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,ondra-novak/chromium.src,timopulkkinen/BubbleFish,markYoungH/chromium.src,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,ondra-novak/chromium.src,fujunwei/chromium-crosswalk,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,ChromiumWebApps/chromium,anirudhSK/chromium,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromium-crosswalk,M4sse/chromium.src,Just-D/chromium-1,timopulkkinen/BubbleFish,patrickm/chromium.src,ltilve/chromium,littlstar/chromium.src,junmin-zhu/chromium-rivertrail,jaruba/chromium.src,dednal/chromium.src