Bug 1270198 - Remove unused Reader:FetchContent and associated logic r=margaret
authorAndrzej Hunt <ahunt@mozilla.com>
Wed, 04 May 2016 10:47:43 -0700
changeset 296385 eacfa3e222b31ad989e8d6689808b4fe1b7e67c7
parent 296384 7189e5f1105bb41782187b9876bbcc625f4208d8
child 296386 e4e6e8589b76d09f1fa43186cbca61bdac430254
push id76311
push usercbook@mozilla.com
push dateFri, 06 May 2016 12:26:12 +0000
treeherdermozilla-inbound@84a3e5716801 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1270198
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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) {
@@ -215,56 +209,16 @@ var Reader = {
       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;
-  }),
-
-  /**
    * Gets an article for a given URL. This method will download and parse a document
    * if it does not find the article in the cache.
    *
    * @param url The article URL.
    * @return {Promise}
    * @resolves JS object representing the article, or null if no article is found.
    */
   _getArticle: Task.async(function* (url) {
--- 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"]
 );