Bug 962709 - Fix about:home's sync entry point to work with about FxAccounts r=markh

This commit is contained in:
Tim Taubert 2014-01-22 20:07:06 +01:00
Родитель d51cde8d35
Коммит dfda4fc2cc
1 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -15,6 +15,8 @@ Components.utils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
"resource://gre/modules/FxAccounts.jsm");
// Url to fetch snippets, in the urlFormatter service format.
const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
@ -146,7 +148,21 @@ let AboutHome = {
break;
case "AboutHome:Sync":
window.openPreferences("paneSync");
let weave = Cc["@mozilla.org/weave/service;1"]
.getService(Ci.nsISupports)
.wrappedJSObject;
if (weave.fxAccountsEnabled) {
fxAccounts.getSignedInUser().then(userData => {
if (userData) {
window.openPreferences("paneSync");
} else {
window.loadURI("about:accounts");
}
});
} else {
window.openPreferences("paneSync");
}
break;
case "AboutHome:Settings":