diff options
author | Gaming4JC <g4jc@bulletmail.org> | 2018-12-17 19:38:37 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@bulletmail.org> | 2018-12-17 19:38:37 -0500 |
commit | 451f5abe980ba64920039a756330cc5f0355db7a (patch) | |
tree | 6340df8f4b187b9115d4bf95211694a36ba93219 | |
parent | c1914df48eb95c087c662904863c20eb743c0888 (diff) | |
download | iceweasel-uxp-451f5abe980ba64920039a756330cc5f0355db7a.tar.gz |
backport uxp: Stub out FxA context menu functions.v2.3
-rw-r--r-- | base/content/browser-fxaccounts.js | 77 |
1 files changed, 2 insertions, 75 deletions
diff --git a/base/content/browser-fxaccounts.js b/base/content/browser-fxaccounts.js index 74a14c1..c7337b1 100644 --- a/base/content/browser-fxaccounts.js +++ b/base/content/browser-fxaccounts.js @@ -77,10 +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)); @@ -303,81 +299,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 } }; |