Bug 1133485 - [ReadingList] Open the Reading List sidebar when the button in the location bar is used to add the current page to Reading List. r=markh a=readinglist
authorJared Wein <jwein@mozilla.com>
Fri, 20 Mar 2015 13:14:34 -0700
changeset 248453 54e9be44f35c5e041a91f64912b43a73c90c7363
parent 248452 7d452f002a02cbb1dc4682166a6a3a1d459cc31c
child 248454 e52d11853e9825f3dd8b3465c357f96046ec6a29
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)
reviewersmarkh, readinglist
bugs1133485
milestone38.0a2
Bug 1133485 - [ReadingList] Open the Reading List sidebar when the button in the location bar is used to add the current page to Reading List. r=markh a=readinglist
browser/app/profile/firefox.js
browser/base/content/browser-readinglist.js
browser/components/readinglist/sidebar.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1884,10 +1884,11 @@ pref("dom.ipc.reportProcessHangs", true)
 
 #ifndef NIGHTLY_BUILD
 // Disable reader mode by default.
 pref("reader.parse-on-load.enabled", false);
 #endif
 
 // Disable ReadingList browser UI by default.
 pref("browser.readinglist.enabled", false);
+pref("browser.readinglist.sidebarEverOpened", false);
 // Enable the readinglist engine by default.
 pref("readinglist.scheduler.enabled", true);
--- a/browser/base/content/browser-readinglist.js
+++ b/browser/base/content/browser-readinglist.js
@@ -318,16 +318,19 @@ let ReadingListUI = {
   },
 
   /**
    * ReadingList event handler for when an item is added.
    *
    * @param {ReadingListItem} item - Item added.
    */
   onItemAdded(item) {
+    if (!Services.prefs.getBoolPref("browser.readinglist.sidebarEverOpened")) {
+      SidebarUI.show("readingListSidebar");
+    }
     if (this.isItemForCurrentBrowser(item)) {
       this.setToolbarButtonState(true);
       if (this.isSidebarOpen) {
         let msg = {topic: "UpdateActiveItem", url: item.url};
         document.getElementById("sidebar").contentWindow.postMessage(msg, "*");
       }
     }
   },
--- a/browser/components/readinglist/sidebar.js
+++ b/browser/components/readinglist/sidebar.js
@@ -61,16 +61,18 @@ let RLSidebar = {
     this.list.addEventListener("mousemove", event => this.onListMouseMove(event));
     this.list.addEventListener("keydown", event => this.onListKeyDown(event), true);
 
     window.addEventListener("message", event => this.onMessage(event));
 
     this.listPromise = this.ensureListItems();
     ReadingList.addListener(this);
 
+    Services.prefs.setBoolPref("browser.readinglist.sidebarEverOpened", true);
+
     let initEvent = new CustomEvent("Initialized", {bubbles: true});
     document.documentElement.dispatchEvent(initEvent);
   },
 
   /**
    * Un-initialize the sidebar UI.
    */
   uninit() {