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 4f3a5da261
commit df74df08f6
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 // we need to tell the page we successfully received the message, but
// then bail without telling fxAccounts // then bail without telling fxAccounts
this.injectData("message", { status: "login" }); this.injectData("message", { status: "login" });
// and re-init the page by navigating to about:accounts // after a successful login we return to preferences
window.location = "about:accounts"; openPrefs();
return; return;
} }
delete accountData.verifiedCanLinkAccount; delete accountData.verifiedCanLinkAccount;
@ -333,7 +333,9 @@ function retry() {
} }
function openPrefs() { 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() { function init() {
@ -511,8 +513,9 @@ function initObservers() {
window.location = "about:accounts?action=signin"; window.location = "about:accounts?action=signin";
return; 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) { for (let topic of OBSERVER_TOPICS) {

View File

@ -607,10 +607,7 @@ var gSyncPane = {
} }
params.set("entrypoint", entryPoint); params.set("entrypoint", entryPoint);
this.openContentInBrowser("about:accounts?" + params, { this.replaceTabWithUrl("about:accounts?" + params);
replaceQueryString: true
});
}, },
/** /**
@ -653,6 +650,17 @@ var gSyncPane = {
win.switchToTabHavingURI(url, true, options); 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) { openPrivacyPolicy: function(aEvent) {
aEvent.stopPropagation(); aEvent.stopPropagation();
gSyncUtils.openPrivacyPolicy(); gSyncUtils.openPrivacyPolicy();