Bug 1143388 - Loading an item from the readinglist shouldn't make the user leave the reader mode if it was active, r=jaws.
authorFlorian Quèze <florian@queze.net>
Tue, 24 Mar 2015 23:44:28 +0100
changeset 265820 992418b89168a917173efcc4b2f346955afab2e6
parent 265819 74cf6d15cfdde05e4263b7ee12b0067b6feebf3c
child 265821 538dfc749e7344ac907f9e83a6df8e272b63ea54
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1143388
milestone39.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 1143388 - Loading an item from the readinglist shouldn't make the user leave the reader mode if it was active, r=jaws.
browser/base/content/content.js
browser/components/readinglist/sidebar.js
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -514,16 +514,17 @@ let AboutReaderListener = {
         if (!this.isAboutReader) {
           return;
         }
 
         if (content.document.body) {
           // Update the toolbar icon to show the "reader active" icon.
           sendAsyncMessage("Reader:UpdateReaderButton");
           new AboutReader(global, content, this._articlePromise);
+          this._articlePromise = null;
         }
         break;
 
       case "pagehide":
         sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: false });
         break;
 
       case "pageshow":
--- a/browser/components/readinglist/sidebar.js
+++ b/browser/components/readinglist/sidebar.js
@@ -296,16 +296,21 @@ let RLSidebar = {
     log.debug(`Opening page ${url}`);
 
     let mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIWebNavigation)
                            .QueryInterface(Ci.nsIDocShellTreeItem)
                            .rootTreeItem
                            .QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindow);
+
+    let currentUrl = mainWindow.gBrowser.currentURI.spec;
+    if (currentUrl.startsWith("about:reader"))
+      url = "about:reader?url=" + encodeURIComponent(url);
+
     mainWindow.openUILink(url, event);
   },
 
   /**
    * Get the ID of the Item associated with a given list item element.
    * @param {element} node - List item element to get an ID for.
    * @return {string} Assocated Item ID.
    */
@@ -417,17 +422,17 @@ let RLSidebar = {
         index = this.numItems - 1;
       }
 
       this.selectedIndex = index;
       this.selectedItem.focus();
     } else if (event.keyCode == KeyEvent.DOM_VK_RETURN) {
       let selectedItem = this.selectedItem;
       if (selectedItem) {
-        this.activeItem = this.selectedItem;
+        this.activeItem = selectedItem;
         this.openActiveItem(event);
       }
     }
   },
 
   /**
    * Handle a message, typically sent from browser-readinglist.js
    * @param {Event} event - Triggering event.