Bug 1205286 - Make about:home Sync icon always link to about:preferences#sync r=markh

This commit is contained in:
Zachary Carter 2015-09-29 16:49:21 -07:00
parent 48bb3e0096
commit 844ee8a3a2
2 changed files with 14 additions and 19 deletions

View File

@ -472,15 +472,24 @@ var gTests = [
})
},
{
desc: "Sync button should open about:accounts page with `abouthome` entrypoint",
desc: "Sync button should open about:preferences#sync",
setup: function () {},
run: Task.async(function* () {
let syncButton = gBrowser.selectedBrowser.contentDocument.getElementById("sync");
let oldOpenPrefs = window.openPreferences;
let openPrefsPromise = new Promise(resolve => {
window.openPreferences = function (pane, params) {
resolve({ pane: pane, params: params });
};
});
yield EventUtils.synthesizeMouseAtCenter(syncButton, {}, gBrowser.contentWindow);
yield promiseTabLoadEvent(gBrowser.selectedTab, null, "load");
is(gBrowser.currentURI.spec, "about:accounts?entrypoint=abouthome",
"Entry point should be `abouthome`.");
let result = yield openPrefsPromise;
window.openPreferences = oldOpenPrefs;
is(result.pane, "paneSync", "openPreferences should be called with paneSync");
is(result.params.urlParams.entrypoint, "abouthome", "openPreferences should be called with abouthome entrypoint");
})
}

View File

@ -143,21 +143,7 @@ var AboutHome = {
break;
case "AboutHome:Sync":
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?entrypoint=abouthome");
}
});
} else {
window.openPreferences("paneSync");
}
window.openPreferences("paneSync", { urlParams: { entrypoint: "abouthome" } });
break;
case "AboutHome:Settings":