Bug 1199303 - improve sync login and registration by using fewers tabs. r=adw

This commit is contained in:
Mark Hammond 2015-09-18 08:28:51 +10:00
parent 22a125049d
commit 9499a4f5d0
2 changed files with 20 additions and 9 deletions

View File

@ -219,8 +219,8 @@ var wrapper = {
// we need to tell the page we successfully received the message, but
// then bail without telling fxAccounts
this.injectData("message", { status: "login" });
// and re-init the page by navigating to about:accounts
window.location = "about:accounts";
// after a successful login we return to preferences
openPrefs();
return;
}
delete accountData.verifiedCanLinkAccount;
@ -333,7 +333,9 @@ function retry() {
}
function openPrefs() {
window.openPreferences("paneSync");
// Bug 1199303 calls for this tab to always be replaced with Preferences
// rather than it opening in a different tab.
window.location = "about:preferences#sync";
}
function init() {
@ -511,8 +513,9 @@ function initObservers() {
window.location = "about:accounts?action=signin";
return;
}
// must be onverified - just about:accounts is loaded.
window.location = "about:accounts";
// must be onverified - we want to open preferences.
openPrefs();
}
for (let topic of OBSERVER_TOPICS) {

View File

@ -607,10 +607,7 @@ var gSyncPane = {
}
params.set("entrypoint", entryPoint);
this.openContentInBrowser("about:accounts?" + params, {
replaceQueryString: true
});
this.replaceTabWithUrl("about:accounts?" + params);
},
/**
@ -653,6 +650,17 @@ var gSyncPane = {
win.switchToTabHavingURI(url, true, options);
},
// Replace the current tab with the specified URL.
replaceTabWithUrl(url) {
// Get the <browser> element hosting us.
let browser = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
// And tell it to load our URL.
browser.loadURI(url);
},
openPrivacyPolicy: function(aEvent) {
aEvent.stopPropagation();
gSyncUtils.openPrivacyPolicy();