Bug 1152385 - Change sync entries points linking to about:accounts to link to about:preferences#sync. r=markh

This commit is contained in:
Edouard Oger 2015-08-24 19:40:00 -04:00
Родитель 10a5977913
Коммит 4426a9a7a8
6 изменённых файлов: 50 добавлений и 37 удалений

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

@ -447,7 +447,7 @@ let gFxAccounts = {
this.openPreferences();
break;
default:
this.openAccountsPage(null, { entrypoint: "menupanel" });
this.openPreferences();
break;
}
@ -455,7 +455,7 @@ let gFxAccounts = {
},
openPreferences: function () {
openPreferences("paneSync");
openPreferences("paneSync", { urlParams: { entrypoint: "menupanel" } });
},
openAccountsPage: function (action, urlParams={}) {

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

@ -271,20 +271,12 @@ let gSyncUI = {
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
if (xps.fxAccountsEnabled) {
fxAccounts.getSignedInUser().then(userData => {
if (userData) {
this.openPrefs();
} else {
// If the user is also in an uitour, set the entrypoint to `uitour`
if (UITour.tourBrowsersByWindow.get(window) &&
UITour.tourBrowsersByWindow.get(window).has(gBrowser.selectedBrowser)) {
entryPoint = "uitour";
}
switchToTabHavingURI("about:accounts?entrypoint=" + entryPoint, true, {
replaceQueryString: true
});
}
});
// If the user is also in an uitour, set the entrypoint to `uitour`
if (UITour.tourBrowsersByWindow.get(window) &&
UITour.tourBrowsersByWindow.get(window).has(gBrowser.selectedBrowser)) {
entryPoint = "uitour";
}
this.openPrefs(entryPoint);
} else {
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
if (win)
@ -309,8 +301,8 @@ let gSyncUI = {
"syncAddDevice", "centerscreen,chrome,resizable=no");
},
openPrefs: function SUI_openPrefs() {
openPreferences("paneSync");
openPrefs: function (entryPoint) {
openPreferences("paneSync", { urlParams: { entrypoint: entryPoint } });
},
openSignInAgainPage: function (entryPoint = "syncbutton") {

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

@ -84,9 +84,9 @@ add_task(function* test_nouser() {
Assert.ok(!panelUIFooter.hasAttribute("fxastatus"), "no fxsstatus when signed out");
Assert.ok(!panelUIFooter.hasAttribute("fxaprofileimage"), "no fxaprofileimage when signed out");
let promiseOpen = promiseTabOpen("about:accounts?entrypoint=menupanel");
let promisePreferencesOpened = promiseObserver("test:browser_fxaccounts:openPreferences");
panelUIStatus.click();
yield promiseOpen;
yield promisePreferencesOpened;
});
/*

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

@ -532,7 +532,17 @@ function openPreferences(paneID, extraArgs)
if (getBoolPref("browser.preferences.inContent")) {
let win = Services.wm.getMostRecentWindow("navigator:browser");
let friendlyCategoryName = internalPrefCategoryNameToFriendlyName(paneID);
let preferencesURL = "about:preferences" +
let params;
if (extraArgs && extraArgs["urlParams"]) {
params = new URLSearchParams();
let urlParams = extraArgs["urlParams"];
for (let name in urlParams) {
if (urlParams[name] !== undefined) {
params.set(name, urlParams[name]);
}
}
}
let preferencesURL = "about:preferences" + (params ? "?" + params : "") +
(friendlyCategoryName ? "#" + friendlyCategoryName : "");
let newLoad = true;
let browser = null;

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

@ -45,8 +45,8 @@ function openAboutAccountsFromMenuPanel(entryPoint) {
yield deferred.promise;
newTab = gBrowser.selectedTab;
is(gBrowser.currentURI.spec, "about:accounts?entrypoint=" + entryPoint,
"Firefox Sync page opened with `menupanel` entrypoint");
is(gBrowser.currentURI.spec, "about:preferences?entrypoint=" + entryPoint + "#sync",
"Firefox Sync preference page opened with `menupanel` entrypoint");
ok(!isPanelUIOpen(), "The panel closed");
if(isPanelUIOpen()) {

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

@ -565,6 +565,25 @@ let gSyncPane = {
gSyncUtils.resetPassphrase();
},
_getEntryPoint: function () {
let params = new URLSearchParams(document.URL.split("#")[0].split("?")[1] || "");
return params.get("entrypoint") || "preferences";
},
_openAboutAccounts: function(action) {
let entryPoint = this._getEntryPoint();
let params = new URLSearchParams();
if (action) {
params.set("action", action);
}
params.set("entrypoint", entryPoint);
this.openContentInBrowser("about:accounts?" + params, {
replaceQueryString: true
});
},
/**
* Invoke the Sync setup wizard.
*
@ -580,9 +599,7 @@ let gSyncPane = {
.wrappedJSObject;
if (service.fxAccountsEnabled) {
this.openContentInBrowser("about:accounts?entrypoint=preferences", {
replaceQueryString: true
});
this._openAboutAccounts();
} else {
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
if (win)
@ -618,25 +635,19 @@ let gSyncPane = {
},
signUp: function() {
this.openContentInBrowser("about:accounts?action=signup&entrypoint=preferences", {
replaceQueryString: true
});
this._openAboutAccounts("signup");
},
signIn: function() {
this.openContentInBrowser("about:accounts?action=signin&entrypoint=preferences", {
replaceQueryString: true
});
this._openAboutAccounts("signin");
},
reSignIn: function() {
this.openContentInBrowser("about:accounts?action=reauth&entrypoint=preferences", {
replaceQueryString: true
});
this._openAboutAccounts("reauth");
},
openChangeProfileImage: function() {
fxAccounts.promiseAccountsChangeProfileURI("preferences", "avatar")
fxAccounts.promiseAccountsChangeProfileURI(this._getEntryPoint(), "avatar")
.then(url => {
this.openContentInBrowser(url, {
replaceQueryString: true
@ -645,7 +656,7 @@ let gSyncPane = {
},
manageFirefoxAccount: function() {
fxAccounts.promiseAccountsManageURI("preferences")
fxAccounts.promiseAccountsManageURI(this._getEntryPoint())
.then(url => {
this.openContentInBrowser(url, {
replaceQueryString: true