Bug 1005064 - Errors in FeedUtils.jsm when fetching favicons: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [mozIAsyncFavicons.setAndFetchFaviconForPage] and dom.head is undefined. r=mkmelin,a=Standard8
authoralta88 <alta88@gmail.com>
Mon, 05 May 2014 16:28:08 -0600
changeset 20004 eea7a05a3085116a56b15f249081555974f766e2
parent 20003 ce127428ad7dfa6248bd8a03aef9d7dbdc0ea688
child 20005 4e00ecfd4430f5018789e574baf0f308e2abc8ed
push id1152
push usermbanner@mozilla.com
push dateThu, 12 Jun 2014 21:08:05 +0000
treeherdercomm-beta@4e00ecfd4430 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, Standard8
bugs1005064
Bug 1005064 - Errors in FeedUtils.jsm when fetching favicons: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [mozIAsyncFavicons.setAndFetchFaviconForPage] and dom.head is undefined. r=mkmelin,a=Standard8
mailnews/extensions/newsblog/content/FeedUtils.jsm
--- a/mailnews/extensions/newsblog/content/FeedUtils.jsm
+++ b/mailnews/extensions/newsblog/content/FeedUtils.jsm
@@ -409,29 +409,31 @@ var FeedUtils = {
  * @param  function aCallback - callback
  * @param  aArg               - caller's argument or null
  */
   getFaviconFromPage: function(aUrl, aCallback, aArg) {
     let onDownload = function(aEvent) {
       let request = aEvent.target;
       responseDomain = request.channel.URI.prePath;
       let dom = request.response;
-      if (request.status != 200 || !(dom instanceof Ci.nsIDOMHTMLDocument))
+      if (request.status != 200 || !(dom instanceof Ci.nsIDOMHTMLDocument) ||
+          !dom.head)
         onDownloadError();
 
       let iconUri;
       let linkNode = dom.head.querySelector('link[rel="shortcut icon"],' +
                                             'link[rel="icon"]');
       let href = linkNode ? linkNode.href : null;
       try {
         iconUri = Services.io.newURI(href, null, null);
       }
       catch (ex) {}
 
       if (!iconUri || !FeedUtils.isValidScheme(iconUri) ||
+          !FeedUtils.isValidScheme(uri) ||
           FeedUtils.mFaviconService.isFailedFavicon(iconUri))
         onDownloadError();
 
       FeedUtils.mFaviconService.setAndFetchFaviconForPage(
         uri, iconUri, false, FeedUtils.mFaviconService.FAVICON_LOAD_NON_PRIVATE);
       if (aCallback)
         aCallback(iconUri.spec, responseDomain, aArg);
     }