Bug 969474 - fix behaviour of 'back' button on about:accounts. r=adw
--- 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);