Bug 976683 - Tools menu copy should match customize menu for reauth, and should direct user to FxA reauth page r=markh

This commit is contained in:
Tim Taubert 2014-03-06 20:42:54 +01:00
parent 011f2cd4eb
commit 8cf5dd5be5
4 changed files with 27 additions and 2 deletions

View File

@ -469,6 +469,11 @@
accesskey="&syncSyncNowItem.accesskey;"
observes="sync-syncnow-state"
oncommand="gSyncUI.doSync(event);"/>
<menuitem id="sync-reauthitem"
label="&syncReAuthItem.label;"
accesskey="&syncReAuthItem.accesskey;"
observes="sync-reauth-state"
oncommand="gSyncUI.openSignInAgainPage();"/>
#endif
<menuseparator id="devToolsSeparator"/>
<menu id="webDeveloperMenu"

View File

@ -177,6 +177,7 @@
#ifdef MOZ_SERVICES_SYNC
<broadcaster id="sync-setup-state"/>
<broadcaster id="sync-syncnow-state"/>
<broadcaster id="sync-reauth-state"/>
#endif
<broadcaster id="workOfflineMenuitemState"/>
<broadcaster id="socialSidebarBroadcaster" hidden="true"/>

View File

@ -96,10 +96,24 @@ let gSyncUI = {
firstSync == "notReady";
},
_loginFailed: function () {
// Referencing Weave.Service will implicitly initialize sync, and we don't
// want to force that - so first check if it is ready.
let service = Cc["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
if (!service.ready) {
return false;
}
return Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED;
},
updateUI: function SUI_updateUI() {
let needsSetup = this._needsSetup();
document.getElementById("sync-setup-state").hidden = !needsSetup;
document.getElementById("sync-syncnow-state").hidden = needsSetup;
let loginFailed = this._loginFailed();
document.getElementById("sync-setup-state").hidden = loginFailed || !needsSetup;
document.getElementById("sync-syncnow-state").hidden = loginFailed || needsSetup;
document.getElementById("sync-reauth-state").hidden = !loginFailed;
if (!gBrowser)
return;
@ -338,6 +352,9 @@ let gSyncUI = {
openPreferences("paneSync");
},
openSignInAgainPage: function () {
switchToTabHavingURI("about:accounts?action=reauth", true);
},
// Helpers
_updateLastSyncTime: function SUI__updateLastSyncTime() {

View File

@ -660,6 +660,8 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY syncSetup.accesskey "Y">
<!ENTITY syncSyncNowItem.label "Sync Now">
<!ENTITY syncSyncNowItem.accesskey "S">
<!ENTITY syncReAuthItem.label "Reconnect to &syncBrand.shortName.label;…">
<!ENTITY syncReAuthItem.accesskey "R">
<!ENTITY syncToolbarButton.label "Sync">
<!ENTITY socialToolbar.title "Social Toolbar Button">