Bug 1143388 - Loading an item from the readinglist shouldn't make the user leave the reader mode if it was active, r=jaws. a=readinglist
authorFlorian Quèze <florian@queze.net>
Tue, 24 Mar 2015 23:44:28 +0100
changeset 248468 57a010d48a4722d9b1ac815acaecd30107c380aa
parent 248467 8f553b5d176835c39516d8419d2ad6a05cbf4206
child 248469 2bc473feb50a6327dfef164d1df2329760b4299a
push id7837
push userjwein@mozilla.com
push dateFri, 27 Mar 2015 00:27:16 +0000
treeherdermozilla-aurora@cb0db44ce60e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, readinglist
bugs1143388
milestone38.0a2
Bug 1143388 - Loading an item from the readinglist shouldn't make the user leave the reader mode if it was active, r=jaws. a=readinglist
browser/base/content/content.js
browser/components/readinglist/sidebar.js
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -513,16 +513,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.