summaryrefslogtreecommitdiffstats
path: root/application/basilisk/base/content/browser-fxaccounts.js
diff options
context:
space:
mode:
Diffstat (limited to 'application/basilisk/base/content/browser-fxaccounts.js')
-rw-r--r--application/basilisk/base/content/browser-fxaccounts.js125
1 files changed, 14 insertions, 111 deletions
diff --git a/application/basilisk/base/content/browser-fxaccounts.js b/application/basilisk/base/content/browser-fxaccounts.js
index 94a591f1e..e1d556bff 100644
--- a/application/basilisk/base/content/browser-fxaccounts.js
+++ b/application/basilisk/base/content/browser-fxaccounts.js
@@ -77,15 +77,6 @@ var gFxAccounts = {
return Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED;
},
- get sendTabToDeviceEnabled() {
- return Services.prefs.getBoolPref("services.sync.sendTabToDevice.enabled");
- },
-
- get remoteClients() {
- return Weave.Service.clientsEngine.remoteClients
- .sort((a, b) => a.name.localeCompare(b.name));
- },
-
init: function () {
// Bail out if we're already initialized and for pop-up windows.
if (this._initialized || !window.toolbar.visible) {
@@ -153,11 +144,6 @@ var gFxAccounts = {
profileInfoEnabled = Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled");
} catch (e) { }
- // Bail out if FxA is disabled.
- if (!this.weave.fxAccountsEnabled) {
- return Promise.resolve();
- }
-
this.panelUIFooter.hidden = false;
// Make sure the button is disabled in customization mode.
@@ -176,6 +162,7 @@ var gFxAccounts = {
let defaultLabel = this.panelUIStatus.getAttribute("defaultlabel");
let errorLabel = this.panelUIStatus.getAttribute("errorlabel");
let unverifiedLabel = this.panelUIStatus.getAttribute("unverifiedlabel");
+ let settingslabel = this.panelUIStatus.getAttribute("settingslabel");
// The localization string is for the signed in text, but it's the default text as well
let defaultTooltiptext = this.panelUIStatus.getAttribute("signedinTooltiptext");
@@ -191,34 +178,19 @@ var gFxAccounts = {
this.panelUIFooter.removeAttribute("fxastatus");
this.panelUIFooter.removeAttribute("fxaprofileimage");
this.panelUIAvatar.style.removeProperty("list-style-image");
- let showErrorBadge = false;
- if (userData) {
- // At this point we consider the user as logged-in (but still can be in an error state)
- if (this.loginFailed) {
- let tooltipDescription = this.strings.formatStringFromName("reconnectDescription", [userData.email], 1);
- this.panelUIFooter.setAttribute("fxastatus", "error");
- this.panelUILabel.setAttribute("label", errorLabel);
- this.panelUIStatus.setAttribute("tooltiptext", tooltipDescription);
- showErrorBadge = true;
- } else if (!userData.verified) {
- let tooltipDescription = this.strings.formatStringFromName("verifyDescription", [userData.email], 1);
- this.panelUIFooter.setAttribute("fxastatus", "error");
- this.panelUIFooter.setAttribute("unverified", "true");
- this.panelUILabel.setAttribute("label", unverifiedLabel);
- this.panelUIStatus.setAttribute("tooltiptext", tooltipDescription);
- showErrorBadge = true;
- } else {
- this.panelUIFooter.setAttribute("fxastatus", "signedin");
- this.panelUILabel.setAttribute("label", userData.email);
- }
- if (profileInfoEnabled) {
- this.panelUIFooter.setAttribute("fxaprofileimage", "enabled");
- }
+
+ if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED) {
+ // Leave the default state
+ return;
}
- if (showErrorBadge) {
- gMenuButtonBadgeManager.addBadge(gMenuButtonBadgeManager.BADGEID_FXA, "fxa-needs-authentication");
+
+ if (this.loginFailed) {
+ this.panelUIFooter.setAttribute("fxastatus", "error");
+ this.panelUILabel.setAttribute("label", errorLabel);
} else {
- gMenuButtonBadgeManager.removeBadge(gMenuButtonBadgeManager.BADGEID_FXA);
+ this.panelUIFooter.setAttribute("fxastatus", "signedin");
+ this.panelUILabel.setAttribute("label", settingslabel);
+ this.panelUIStatus.setAttribute("tooltiptext", "");
}
}
@@ -322,81 +294,12 @@ var gFxAccounts = {
this.openAccountsPage("reauth", { entrypoint: entryPoint });
},
- sendTabToDevice: function (url, clientId, title) {
- Weave.Service.clientsEngine.sendURIToClientForDisplay(url, clientId, title);
- },
-
- populateSendTabToDevicesMenu: function (devicesPopup, url, title) {
- // remove existing menu items
- while (devicesPopup.hasChildNodes()) {
- devicesPopup.removeChild(devicesPopup.firstChild);
- }
-
- const fragment = document.createDocumentFragment();
-
- const onTargetDeviceCommand = (event) => {
- const clientId = event.target.getAttribute("clientId");
- const clients = clientId
- ? [clientId]
- : this.remoteClients.map(client => client.id);
-
- clients.forEach(clientId => this.sendTabToDevice(url, clientId, title));
- }
-
- function addTargetDevice(clientId, name) {
- const targetDevice = document.createElement("menuitem");
- targetDevice.addEventListener("command", onTargetDeviceCommand, true);
- targetDevice.setAttribute("class", "sendtab-target");
- targetDevice.setAttribute("clientId", clientId);
- targetDevice.setAttribute("label", name);
- fragment.appendChild(targetDevice);
- }
-
- const clients = this.remoteClients;
- for (let client of clients) {
- addTargetDevice(client.id, client.name);
- }
-
- // "All devices" menu item
- if (clients.length > 1) {
- const separator = document.createElement("menuseparator");
- fragment.appendChild(separator);
- const allDevicesLabel = this.strings.GetStringFromName("sendTabToAllDevices.menuitem");
- addTargetDevice("", allDevicesLabel);
- }
-
- devicesPopup.appendChild(fragment);
- },
-
updateTabContextMenu: function (aPopupMenu) {
- if (!this.sendTabToDeviceEnabled) {
- return;
- }
-
- const remoteClientPresent = this.remoteClients.length > 0;
- ["context_sendTabToDevice", "context_sendTabToDevice_separator"]
- .forEach(id => { document.getElementById(id).hidden = !remoteClientPresent });
+ // STUB
},
initPageContextMenu: function (contextMenu) {
- if (!this.sendTabToDeviceEnabled) {
- return;
- }
-
- const remoteClientPresent = this.remoteClients.length > 0;
- // showSendLink and showSendPage are mutually exclusive
- const showSendLink = remoteClientPresent
- && (contextMenu.onSaveableLink || contextMenu.onPlainTextLink);
- const showSendPage = !showSendLink && remoteClientPresent
- && !(contextMenu.isContentSelected ||
- contextMenu.onImage || contextMenu.onCanvas ||
- contextMenu.onVideo || contextMenu.onAudio ||
- contextMenu.onLink || contextMenu.onTextInput);
-
- ["context-sendpagetodevice", "context-sep-sendpagetodevice"]
- .forEach(id => contextMenu.showItem(id, showSendPage));
- ["context-sendlinktodevice", "context-sep-sendlinktodevice"]
- .forEach(id => contextMenu.showItem(id, showSendLink));
+ // STUB
}
};