Backed out changeset 3c369626af41 (bug 1184950) for bc7 test failures
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 15 Apr 2016 10:43:28 +0200
changeset 331308 d0c2f09a6285ad7a9f25fcb704de38c9c5168369
parent 331307 6b620569c320cecd53f6ca44cc4285641995e978
child 331309 529cff9c5663a3581dfb5e690727144f07e8e23c
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1184950
milestone48.0a1
backs out3c369626af41eec1fc9a3f145a6ddb0d4c475c31
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
Backed out changeset 3c369626af41 (bug 1184950) for bc7 test failures
browser/base/content/tab-content.js
browser/base/content/test/general/browser_bug1124271_readerModePinnedTab.js
browser/base/content/test/general/browser_readerMode.js
browser/modules/ReaderParent.jsm
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -246,42 +246,25 @@ var AboutReaderListener = {
 
   _articlePromise: null,
 
   init: function() {
     addEventListener("AboutReaderContentLoaded", this, false, true);
     addEventListener("DOMContentLoaded", this, false);
     addEventListener("pageshow", this, false);
     addEventListener("pagehide", this, false);
-    addMessageListener("Reader:ToggleReaderMode", this);
+    addMessageListener("Reader:ParseDocument", this);
     addMessageListener("Reader:PushState", this);
   },
 
   receiveMessage: function(message) {
     switch (message.name) {
-      case "Reader:ToggleReaderMode":
-        let url = content.document.location.href;
-        if (!this.isAboutReader) {
-          this._articlePromise = ReaderMode.parseDocument(content.document).catch(Cu.reportError);
-          content.document.location = "about:reader?url=" + encodeURIComponent(url);
-        } else {
-          let originalURL = ReaderMode.getOriginalUrl(url);
-          let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
-          let sh = webNav.sessionHistory;
-          if (webNav.canGoBack) {
-            let prevEntry = sh.getEntryAtIndex(sh.index - 1, false);
-            let prevURL = prevEntry.URI.spec;
-            if (prevURL && (prevURL == originalURL || !originalURL)) {
-              webNav.goBack();
-              break;
-            }
-          }
-
-          content.document.location = originalURL;
-        }
+      case "Reader:ParseDocument":
+        this._articlePromise = ReaderMode.parseDocument(content.document).catch(Cu.reportError);
+        content.document.location = "about:reader?url=" + encodeURIComponent(message.data.url);
         break;
 
       case "Reader:PushState":
         this.updateReaderButton(!!(message.data && message.data.isArticle));
         break;
     }
   },
 
--- a/browser/base/content/test/general/browser_bug1124271_readerModePinnedTab.js
+++ b/browser/base/content/test/general/browser_bug1124271_readerModePinnedTab.js
@@ -33,15 +33,15 @@ add_task(function* () {
 
   readerButton.click();
   yield promiseTabLoadEvent(tab);
 
   // Ensure no new tabs are opened when exiting reader mode in a pinned tab
   is(gBrowser.tabs.length, initialTabsCount, "No additional tabs were opened.");
 
   readerButton.click();
-  yield promiseTabLoadEvent(tab, "", "pageshow");
+  yield promiseTabLoadEvent(tab);
 
   // Ensure no new tabs are opened when exiting reader mode in a pinned tab
   is(gBrowser.tabs.length, initialTabsCount, "No additional tabs were opened.");
 
   gBrowser.removeCurrentTab();
 });
--- a/browser/base/content/test/general/browser_readerMode.js
+++ b/browser/base/content/test/general/browser_readerMode.js
@@ -66,21 +66,19 @@ add_task(function* test_reader_button() 
       gURLBar.focus();
       gURLBar.select();
       goDoCommand("cmd_copy");
     }, resolve, reject);
   });
 
   // Switch page back out of reader mode.
   readerButton.click();
-  yield promiseTabLoadEvent(tab, "", "pageshow");
+  yield promiseTabLoadEvent(tab);
   is(gBrowser.selectedBrowser.currentURI.spec, url,
-    "Back to the original page after clicking active reader mode button");
-  ok(gBrowser.selectedBrowser.canGoForward,
-    "Moved one step back in the session history.");
+    "Original page loaded after clicking active reader mode button");
 
   // Load a new tab that is NOT reader-able.
   let newTab = gBrowser.selectedTab = gBrowser.addTab();
   yield promiseTabLoadEvent(newTab, "about:robots");
   yield promiseWaitForCondition(() => readerButton.hidden);
   is_element_hidden(readerButton, "Reader mode button is not present on a non-reader-able page");
 
   // Switch back to the original tab to make sure reader mode button is still visible.
--- a/browser/modules/ReaderParent.jsm
+++ b/browser/modules/ReaderParent.jsm
@@ -128,17 +128,28 @@ var ReaderParent = {
       return;
     }
     this.toggleReaderMode(event);
   },
 
   toggleReaderMode: function(event) {
     let win = event.target.ownerDocument.defaultView;
     let browser = win.gBrowser.selectedBrowser;
-    browser.messageManager.sendAsyncMessage("Reader:ToggleReaderMode");
+    let url = browser.currentURI.spec;
+
+    if (url.startsWith("about:reader")) {
+      let originalURL = ReaderMode.getOriginalUrl(url);
+      if (!originalURL) {
+        Cu.reportError("Error finding original URL for about:reader URL: " + url);
+      } else {
+        win.openUILinkIn(originalURL, "current", {"allowPinnedTabHostChange": true});
+      }
+    } else {
+      browser.messageManager.sendAsyncMessage("Reader:ParseDocument", { url: url });
+    }
   },
 
   /**
    * Shows an info panel from the UITour for Reader Mode.
    *
    * @param browser The <browser> that the tour should be started for.
    */
   showReaderModeInfoPanel(browser) {