Bug 1116231 - Move reader.parse-on-load. pref change observer back to Reader.js. r=bnicholson
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 29 Dec 2014 15:12:45 -0500
changeset 221825 9198ef9c7df6797d1c393227d0c219ccacb36260
parent 221824 8a9910d1105bbc3f11b0f66c1996f06db0356ff5
child 221826 d5a6e28f71322f7f40a90021787f16f3a70ff4d2
push id10635
push usermleibovic@mozilla.com
push dateFri, 02 Jan 2015 18:03:40 +0000
treeherderfx-team@9198ef9c7df6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs1116231
milestone37.0a1
Bug 1116231 - Move reader.parse-on-load. pref change observer back to Reader.js. r=bnicholson
mobile/android/chrome/content/Reader.js
toolkit/components/reader/ReaderMode.jsm
--- a/mobile/android/chrome/content/Reader.js
+++ b/mobile/android/chrome/content/Reader.js
@@ -80,16 +80,22 @@ let Reader = {
 
   observe: function(aMessage, aTopic, aData) {
     switch(aTopic) {
       case "Reader:Removed": {
         let uri = Services.io.newURI(aData, null, null);
         ReaderMode.removeArticleFromCache(uri).catch(e => Cu.reportError("Error removing article from cache: " + e));
         break;
       }
+
+      case "nsPref:changed":
+        if (aData.startsWith("reader.parse-on-load.")) {
+          this.isEnabledForParseOnLoad = this._getStateForParseOnLoad();
+        }
+        break;
     }
   },
 
   _addTabToReadingList: Task.async(function* (tabID) {
     let tab = BrowserApp.getTabForId(tabID);
     if (!tab) {
       throw new Error("Can't add tab to reading list because no tab found for ID: " + tabID);
     }
--- a/toolkit/components/reader/ReaderMode.jsm
+++ b/toolkit/components/reader/ReaderMode.jsm
@@ -22,27 +22,16 @@ let ReaderMode = {
   CACHE_VERSION: 1,
 
   DEBUG: 0,
 
   // Don't try to parse the page if it has too many elements (for memory and
   // performance reasons)
   MAX_ELEMS_TO_PARSE: 3000,
 
-  observe: function(aMessage, aTopic, aData) {
-    switch(aTopic) {
-      case "nsPref:changed": {
-        if (aData.startsWith("reader.parse-on-load.")) {
-          this.isEnabledForParseOnLoad = this._getStateForParseOnLoad();
-        }
-        break;
-      }
-    }
-  },
-
   /**
    * Gets an article from a loaded browser's document. This method will parse the document
    * if it does not find the article in the cache.
    *
    * @param browser A browser with a loaded page.
    * @return {Promise}
    * @resolves JS object representing the article, or null if no article is found.
    */