Bug 1114600 - Get rid of unnecessary reader enabled flag in Java. r=rnewman
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Sat, 20 Dec 2014 19:45:13 -0800
changeset 220922 b8e5a6a721a5cac4eea8fee2c013bbfc0f43579a
parent 220921 475377e005defa7f6410b9fa17cf8f02eeacd057
child 220923 9d54f4c91c31b7f902c15205e3439cd24b97c305
push id28003
push userryanvm@gmail.com
push dateMon, 22 Dec 2014 22:44:16 +0000
treeherdermozilla-central@d5167dc0ded3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1114600
milestone37.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 1114600 - Get rid of unnecessary reader enabled flag in Java. r=rnewman
mobile/android/base/Tab.java
mobile/android/base/Tabs.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/Tab.java
+++ b/mobile/android/base/Tab.java
@@ -48,17 +48,16 @@ public class Tab {
     private Bitmap mFavicon;
     private String mFaviconUrl;
 
     // The set of all available Favicons for this tab, sorted by attractiveness.
     final TreeSet<RemoteFavicon> mAvailableFavicons = new TreeSet<>();
     private boolean mHasFeeds;
     private boolean mHasOpenSearch;
     private final SiteIdentity mSiteIdentity;
-    private boolean mReaderEnabled;
     private BitmapDrawable mThumbnail;
     private final int mParentId;
     private final boolean mExternal;
     private boolean mBookmark;
     private int mFaviconLoadId;
     private String mContentType;
     private boolean mHasTouchListeners;
     private ZoomConstraints mZoomConstraints;
@@ -257,20 +256,16 @@ public class Tab {
     public boolean hasOpenSearch() {
         return mHasOpenSearch;
     }
 
     public SiteIdentity getSiteIdentity() {
         return mSiteIdentity;
     }
 
-    public boolean getReaderEnabled() {
-        return mReaderEnabled;
-    }
-
     public boolean isBookmark() {
         return mBookmark;
     }
 
     public boolean isExternal() {
         return mExternal;
     }
 
@@ -469,21 +464,16 @@ public class Tab {
     public void setHasOpenSearch(boolean hasOpenSearch) {
         mHasOpenSearch = hasOpenSearch;
     }
 
     public void updateIdentityData(JSONObject identityData) {
         mSiteIdentity.update(identityData);
     }
 
-    public void setReaderEnabled(boolean readerEnabled) {
-        mReaderEnabled = readerEnabled;
-        Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.MENU_UPDATED);
-    }
-
     void updateBookmark() {
         if (getURL() == null) {
             return;
         }
 
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
@@ -524,17 +514,17 @@ public class Tab {
                 Tabs.getInstance().notifyListeners(Tab.this, Tabs.TabEvents.BOOKMARK_REMOVED);
             }
         });
     }
 
     public void toggleReaderMode() {
         if (AboutPages.isAboutReader(mUrl)) {
             Tabs.getInstance().loadUrl(ReaderModeUtils.getUrlFromAboutReader(mUrl));
-        } else if (mReaderEnabled) {
+        } else {
             mEnteringReaderMode = true;
             Tabs.getInstance().loadUrl(ReaderModeUtils.getAboutReaderForUrl(mUrl, mId));
         }
     }
 
     public boolean isEnteringReaderMode() {
         return mEnteringReaderMode;
     }
@@ -609,17 +599,16 @@ public class Tab {
 
         setContentType(message.getString("contentType"));
         updateUserRequested(message.getString("userRequested"));
         mBaseDomain = message.optString("baseDomain");
 
         setHasFeeds(false);
         setHasOpenSearch(false);
         updateIdentityData(null);
-        setReaderEnabled(false);
         setZoomConstraints(new ZoomConstraints(true));
         setHasTouchListeners(false);
         setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
         setErrorType(ErrorType.NONE);
         setLoadProgressIfLoading(LOAD_PROGRESS_LOCATION_CHANGE);
 
         Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.LOCATION_CHANGE, oldUrl);
     }
@@ -627,17 +616,16 @@ public class Tab {
     private static boolean shouldShowProgress(final String url) {
         return !AboutPages.isAboutPage(url);
     }
 
     void handleDocumentStart(boolean restoring, String url) {
         setLoadProgress(LOAD_PROGRESS_START);
         setState((!restoring && shouldShowProgress(url)) ? STATE_LOADING : STATE_SUCCESS);
         updateIdentityData(null);
-        setReaderEnabled(false);
     }
 
     void handleDocumentStop(boolean success) {
         setState(success ? STATE_SUCCESS : STATE_ERROR);
 
         final String oldURL = getURL();
         final Tab tab = this;
         tab.setLoadProgress(LOAD_PROGRESS_STOP);
--- a/mobile/android/base/Tabs.java
+++ b/mobile/android/base/Tabs.java
@@ -87,17 +87,16 @@ public class Tabs implements GeckoEventL
 
     private Tabs() {
         EventDispatcher.getInstance().registerGeckoThreadListener(this,
             "Tab:Added",
             "Tab:Close",
             "Tab:Select",
             "Content:LocationChange",
             "Content:SecurityChange",
-            "Content:ReaderEnabled",
             "Content:StateChange",
             "Content:LoadError",
             "Content:PageShow",
             "DOMContentLoaded",
             "DOMTitleChanged",
             "Link:Favicon",
             "Link:Feed",
             "Link:OpenSearch",
@@ -450,19 +449,16 @@ public class Tabs implements GeckoEventL
                 closeTab(tab);
             } else if (event.equals("Tab:Select")) {
                 selectTab(tab.getId());
             } else if (event.equals("Content:LocationChange")) {
                 tab.handleLocationChange(message);
             } else if (event.equals("Content:SecurityChange")) {
                 tab.updateIdentityData(message.getJSONObject("identity"));
                 notifyListeners(tab, TabEvents.SECURITY_CHANGE);
-            } else if (event.equals("Content:ReaderEnabled")) {
-                tab.setReaderEnabled(true);
-                notifyListeners(tab, TabEvents.READER_ENABLED);
             } else if (event.equals("Content:StateChange")) {
                 int state = message.getInt("state");
                 if ((state & GeckoAppShell.WPL_STATE_IS_NETWORK) != 0) {
                     if ((state & GeckoAppShell.WPL_STATE_START) != 0) {
                         boolean restoring = message.getBoolean("restoring");
                         tab.handleDocumentStart(restoring, message.getString("uri"));
                         notifyListeners(tab, Tabs.TabEvents.START);
                     } else if ((state & GeckoAppShell.WPL_STATE_STOP) != 0) {
@@ -572,17 +568,16 @@ public class Tabs implements GeckoEventL
         UNSELECTED,
         ADDED,
         RESTORED,
         LOCATION_CHANGE,
         MENU_UPDATED,
         PAGE_SHOW,
         LINK_FEED,
         SECURITY_CHANGE,
-        READER_ENABLED,
         DESKTOP_MODE_CHANGE,
         VIEWPORT_CHANGE,
         RECORDING_CHANGE,
         BOOKMARK_ADDED,
         BOOKMARK_REMOVED
     }
 
     public void notifyListeners(Tab tab, TabEvents msg) {
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4294,21 +4294,16 @@ Tab.prototype = {
 
           // Do nothing if there's no article or the page in this tab has changed.
           if (article == null || (article.url != currentURL)) {
             return;
           }
 
           this.savedArticle = article;
           Reader.updatePageAction(this);
-
-          Messaging.sendRequest({
-            type: "Content:ReaderEnabled",
-            tabID: this.id
-          });
         }).catch(e => Cu.reportError("Error parsing document from tab: " + e));
       }
     }
   },
 
   onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
     let contentWin = aWebProgress.DOMWindow;
     if (contentWin != contentWin.top)