Bug 1270198 - Remove unused Reader:FetchContent and associated logic r?margaret draft
authorAndrzej Hunt <ahunt@mozilla.com>
Wed, 04 May 2016 10:47:43 -0700
changeset 363438 0aa1db35530e92dd83858afeb9349a8167816a0d
parent 363437 2f4723efdf3aa222b2cdcd76daf17b5816c2f406
child 520032 294134788f31278a2d09154950846ffc6521a191
push id17197
push userahunt@mozilla.com
push dateWed, 04 May 2016 17:49:54 +0000
reviewersmargaret
bugs1270198
milestone49.0a1
Bug 1270198 - Remove unused Reader:FetchContent and associated logic r?margaret MozReview-Commit-ID: FcXN3x5hRhE
mobile/android/chrome/content/Reader.js
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/Reader.js
+++ b/mobile/android/chrome/content/Reader.js
@@ -65,22 +65,16 @@ var Reader = {
    */
   onBackPress: function(tabId) {
     let listener = this._backPressListeners[tabId];
     return { handled: (listener ? listener() : false) };
   },
 
   observe: function Reader_observe(aMessage, aTopic, aData) {
     switch (aTopic) {
-      case "Reader:FetchContent": {
-        let data = JSON.parse(aData);
-        this._fetchContent(data.url, data.id);
-        break;
-      }
-
       case "Reader:RemoveFromCache": {
         ReaderMode.removeArticleFromCache(aData).catch(e => Cu.reportError("Error removing article from cache: " + e));
         break;
       }
 
       case "Reader:AddToCache": {
         let tab = BrowserApp.getTabForId(aData);
         if (!tab) {
@@ -214,48 +208,16 @@ var Reader = {
     if (browser.isArticle) {
       showPageAction("drawable://reader", Strings.reader.GetStringFromName("readerView.enter"));
       this._buttonHistogram.add(this._buttonHistogramValues.SHOWN);
     } else {
       this._buttonHistogram.add(this._buttonHistogramValues.HIDDEN);
     }
   },
 
-  /**
-   * Downloads and caches content for a reading list item with a given URL and id.
-   */
-  _fetchContent: function(url, id) {
-    this._downloadAndCacheArticle(url).then(article => {
-      if (article == null) {
-        Messaging.sendRequest({
-          type: "Reader:UpdateList",
-          id: id,
-          status: this.STATUS_FETCH_FAILED_UNSUPPORTED_FORMAT,
-        });
-      } else {
-        Messaging.sendRequest({
-          type: "Reader:UpdateList",
-          id: id,
-          url: truncate(article.url, MAX_URI_LENGTH),
-          title: truncate(article.title, MAX_TITLE_LENGTH),
-          length: article.length,
-          excerpt: article.excerpt,
-          status: this.STATUS_FETCHED_ARTICLE,
-        });
-      }
-    }).catch(e => {
-      Cu.reportError("Error fetching content: " + e);
-      Messaging.sendRequest({
-        type: "Reader:UpdateList",
-        id: id,
-        status: this.STATUS_FETCH_FAILED_TEMPORARY,
-      });
-    });
-  },
-
   _downloadAndCacheArticle: Task.async(function* (url) {
     let article = yield ReaderMode.downloadAndParseDocument(url);
     if (article != null) {
       yield ReaderMode.storeArticleInCache(article);
     }
     return article;
   }),
 
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -148,17 +148,17 @@ var lazilyLoadedObserverScripts = [
   ["MemoryObserver", ["memory-pressure", "Memory:Dump"], "chrome://browser/content/MemoryObserver.js"],
   ["ConsoleAPI", ["console-api-log-event"], "chrome://browser/content/ConsoleAPI.js"],
   ["FindHelper", ["FindInPage:Opened", "FindInPage:Closed", "Tab:Selected"], "chrome://browser/content/FindHelper.js"],
   ["PermissionsHelper", ["Permissions:Check", "Permissions:Get", "Permissions:Clear"], "chrome://browser/content/PermissionsHelper.js"],
   ["FeedHandler", ["Feeds:Subscribe"], "chrome://browser/content/FeedHandler.js"],
   ["Feedback", ["Feedback:Show"], "chrome://browser/content/Feedback.js"],
   ["SelectionHandler", ["TextSelection:Get"], "chrome://browser/content/SelectionHandler.js"],
   ["EmbedRT", ["GeckoView:ImportScript"], "chrome://browser/content/EmbedRT.js"],
-  ["Reader", ["Reader:FetchContent", "Reader:AddToCache", "Reader:RemoveFromCache"], "chrome://browser/content/Reader.js"],
+  ["Reader", ["Reader:AddToCache", "Reader:RemoveFromCache"], "chrome://browser/content/Reader.js"],
   ["PrintHelper", ["Print:PDF"], "chrome://browser/content/PrintHelper.js"],
 ];
 
 lazilyLoadedObserverScripts.push(
 ["ActionBarHandler", ["TextSelection:Get", "TextSelection:Action", "TextSelection:End"],
   "chrome://browser/content/ActionBarHandler.js"]
 );