Bug 969474 - fix behaviour of 'back' button on about:accounts. r=adw
authorMark Hammond <mhammond@skippinet.com.au>
Fri, 11 Sep 2015 10:41:03 +1000
changeset 261683 f064857f340e5d48accb8e2ad128f61c0b487eb9
parent 261682 46e36965f0c87a6d373ea8e155698d1ffd235a33
child 261684 de2a61fb88ab78fa69320c9d1711cd00f6842d7f
child 261711 7b1cfb1606ec447506bf7373b645b7a09f3aa238
push id15128
push usermhammond@skippinet.com.au
push dateFri, 11 Sep 2015 00:41:38 +0000
treeherderfx-team@f064857f340e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs969474
milestone43.0a1
Bug 969474 - fix behaviour of 'back' button on about:accounts. r=adw
browser/base/content/aboutaccounts/aboutaccounts.js
browser/base/content/test/general/content_aboutAccounts.js
--- a/browser/base/content/aboutaccounts/aboutaccounts.js
+++ b/browser/base/content/aboutaccounts/aboutaccounts.js
@@ -122,22 +122,25 @@ let wrapper = {
 
     // Ideally we'd just merge urlParams with new URL(url).searchParams, but our
     // URLSearchParams implementation doesn't support iteration (bug 1085284).
     let urlParamStr = urlParams.toString();
     if (urlParamStr) {
       url += (url.includes("?") ? "&" : "?") + urlParamStr;
     }
     this.url = url;
-    iframe.src = url;
+    // Set the iframe's location with loadURI/LOAD_FLAGS_BYPASS_HISTORY to
+    // avoid having a new history entry being added.
+    let webNav = iframe.frameLoader.docShell.QueryInterface(Ci.nsIWebNavigation);
+    webNav.loadURI(url, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
   },
 
   retry: function () {
     let webNav = this.iframe.frameLoader.docShell.QueryInterface(Ci.nsIWebNavigation);
-    webNav.loadURI(this.url, null, null, null, null);
+    webNav.loadURI(this.url, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
   },
 
   iframeListener: {
     QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
                                          Ci.nsISupportsWeakReference,
                                          Ci.nsISupports]),
 
     onStateChange: function(aWebProgress, aRequest, aState, aStatus) {
--- a/browser/base/content/test/general/content_aboutAccounts.js
+++ b/browser/base/content/test/general/content_aboutAccounts.js
@@ -31,17 +31,17 @@ addEventListener("DOMContentLoaded", fun
   // We use DOMContentLoaded here as that fires for our iframe even when we've
   // arranged for the URL in the iframe to cause an error.
   addEventListener("DOMContentLoaded", function iframeLoaded(event) {
     if (iframe.contentWindow.location.href == "about:blank" ||
         event.target != iframe.contentDocument) {
       return;
     }
     removeEventListener("DOMContentLoaded", iframeLoaded, true);
-    sendAsyncMessage("test:iframe:load", {url: iframe.getAttribute("src")});
+    sendAsyncMessage("test:iframe:load", {url: iframe.contentDocument.location.href});
     // And an event listener for the test responses, which we send to the test
     // via a message.
     iframe.contentWindow.addEventListener("FirefoxAccountsTestResponse", function (event) {
       sendAsyncMessage("test:response", {data: event.detail.data});
     }, true);
   }, true);
 }, true);
 
@@ -74,14 +74,14 @@ addMessageListener("test:load-with-mocke
     let iframe = content.document.getElementById("remote");
     iframe.addEventListener("load", function iframeLoaded(event) {
       if (iframe.contentWindow.location.href == "about:blank" ||
           event.target != iframe) {
         return;
       }
       iframe.removeEventListener("load", iframeLoaded, true);
       sendAsyncMessage("test:load-with-mocked-profile-path-response",
-                       {url: iframe.getAttribute("src")});
+                       {url: iframe.contentDocument.location.href});
     }, true);
   });
   let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
   webNav.loadURI(message.data.url, webNav.LOAD_FLAGS_NONE, null, null, null);
 }, true);