firefox-patches/disable-send-to-device.patch

179 lines
7.8 KiB
Diff
Raw Permalink Normal View History

2017-11-20 20:14:25 +01:00
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
2018-01-07 17:12:58 +01:00
@@ -279,14 +279,6 @@
2017-11-20 20:14:25 +01:00
label="&savePageCmd.label;"
accesskey="&savePageCmd.accesskey2;"
oncommand="gContextMenu.savePageAs();"/>
- <menuseparator id="context-sep-sendpagetodevice" hidden="true"/>
- <menu id="context-sendpagetodevice"
- label="&sendPageToDevice.label;"
- accesskey="&sendPageToDevice.accesskey;"
- hidden="true">
- <menupopup id="context-sendpagetodevice-popup"
2018-01-07 17:12:58 +01:00
- onpopupshowing="(() => { let browser = gBrowser || getPanelBrowser(); gFxAccounts.populateSendTabToDevicesMenu(event.target, browser.currentURI.spec, browser.contentTitle); })()"/>
2017-11-20 20:14:25 +01:00
- </menu>
<menuseparator id="context-sep-viewbgimage"/>
<menuitem id="context-viewbgimage"
label="&viewBGImageCmd.label;"
2018-01-07 17:12:58 +01:00
@@ -326,14 +318,6 @@
oncommand="AddKeywordForSearchField();"/>
<menuitem id="context-searchselect"
oncommand="BrowserSearch.loadSearchFromContext(this.searchTerms);"/>
- <menuseparator id="context-sep-sendlinktodevice" hidden="true"/>
- <menu id="context-sendlinktodevice"
- label="&sendLinkToDevice.label;"
- accesskey="&sendLinkToDevice.accesskey;"
- hidden="true">
- <menupopup id="context-sendlinktodevice-popup"
- onpopupshowing="gFxAccounts.populateSendTabToDevicesMenu(event.target, gContextMenu.linkURL, gContextMenu.linkTextStr);"/>
- </menu>
<menuitem id="context-shareselect"
label="&shareSelect.label;"
accesskey="&shareSelect.accesskey;"
--- a/browser/base/content/browser-fxaccounts.js
+++ b/browser/base/content/browser-fxaccounts.js
@@ -371,81 +371,13 @@ var gFxAccounts = {
},
sendTabToDevice: function (url, clientId, title) {
- Weave.Service.clientsEngine.sendURIToClientForDisplay(url, clientId, title);
},
populateSendTabToDevicesMenu: function (devicesPopup, url, title) {
2017-11-20 20:14:25 +01:00
- // remove existing menu items
2018-01-07 17:12:58 +01:00
- while (devicesPopup.hasChildNodes()) {
- devicesPopup.removeChild(devicesPopup.firstChild);
2017-11-20 20:14:25 +01:00
- }
-
- const fragment = document.createDocumentFragment();
-
- const onTargetDeviceCommand = (event) => {
2018-01-07 17:12:58 +01:00
- const clientId = event.target.getAttribute("clientId");
- const clients = clientId
- ? [clientId]
- : this.remoteClients.map(client => client.id);
2017-11-20 20:14:25 +01:00
-
- clients.forEach(clientId => this.sendTabToDevice(url, clientId, title));
- }
-
2018-01-07 17:12:58 +01:00
- function addTargetDevice(clientId, name) {
- const targetDevice = document.createElement("menuitem");
2017-11-20 20:14:25 +01:00
- targetDevice.addEventListener("command", onTargetDeviceCommand, true);
2018-01-07 17:12:58 +01:00
- targetDevice.setAttribute("class", "sendtab-target");
2017-11-20 20:14:25 +01:00
- targetDevice.setAttribute("clientId", clientId);
- targetDevice.setAttribute("label", name);
- fragment.appendChild(targetDevice);
- }
-
- const clients = this.remoteClients;
- for (let client of clients) {
2018-01-07 17:12:58 +01:00
- addTargetDevice(client.id, client.name);
2017-11-20 20:14:25 +01:00
- }
-
2018-01-07 17:12:58 +01:00
- // "All devices" menu item
2017-11-20 20:14:25 +01:00
- if (clients.length > 1) {
2018-01-07 17:12:58 +01:00
- const separator = document.createElement("menuseparator");
2017-11-20 20:14:25 +01:00
- fragment.appendChild(separator);
2018-01-07 17:12:58 +01:00
- const allDevicesLabel = this.strings.GetStringFromName("sendTabToAllDevices.menuitem");
- addTargetDevice("", allDevicesLabel);
2017-11-20 20:14:25 +01:00
- }
-
2018-01-07 17:12:58 +01:00
- devicesPopup.appendChild(fragment);
},
updateTabContextMenu: function (aPopupMenu) {
- if (!this.sendTabToDeviceEnabled) {
- return;
2017-11-20 20:14:25 +01:00
- }
-
2018-01-07 17:12:58 +01:00
- const remoteClientPresent = this.remoteClients.length > 0;
- ["context_sendTabToDevice", "context_sendTabToDevice_separator"]
- .forEach(id => { document.getElementById(id).hidden = !remoteClientPresent });
},
2017-11-20 20:14:25 +01:00
-
2018-01-07 17:12:58 +01:00
- initPageContextMenu: function (contextMenu) {
- if (!this.sendTabToDeviceEnabled) {
- return;
2017-11-20 20:14:25 +01:00
- }
-
2018-01-07 17:12:58 +01:00
- const remoteClientPresent = this.remoteClients.length > 0;
2017-11-20 20:14:25 +01:00
- // showSendLink and showSendPage are mutually exclusive
2018-01-07 17:12:58 +01:00
- const showSendLink = remoteClientPresent
- && (contextMenu.onSaveableLink || contextMenu.onPlainTextLink);
- const showSendPage = !showSendLink && remoteClientPresent
2017-11-20 20:14:25 +01:00
- && !(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));
2018-01-07 17:12:58 +01:00
- }
};
2017-11-20 20:14:25 +01:00
2018-01-07 17:12:58 +01:00
XPCOMUtils.defineLazyGetter(gFxAccounts, "FxAccountsCommon", function () {
2018-04-04 11:10:55 +02:00
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -104,13 +104,6 @@
hidden="true"
oncommand="gBrowser.openNonRemoteWindow(TabContextMenu.contextTab);"/>
#endif
- <menuseparator id="context_sendTabToDevice_separator" hidden="true"/>
- <menu id="context_sendTabToDevice" label="&sendTabToDevice.label;"
- accesskey="&sendTabToDevice.accesskey;" hidden="true">
- <menupopup id="context_sendTabToDevicePopupMenu"
- onpopupshowing="gFxAccounts.populateSendTabToDevicesMenu(event.target, TabContextMenu.contextTab.linkedBrowser.currentURI.spec, TabContextMenu.contextTab.linkedBrowser.contentTitle);"/>
- </menu>
- <menuseparator/>
<menuitem id="context_reloadAllTabs" label="&reloadAllTabs.label;" accesskey="&reloadAllTabs.accesskey;"
tbattr="tabbrowser-multiple-visible"
oncommand="gBrowser.reloadAllTabs();"/>
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -894,7 +894,6 @@ var SessionStoreInternal = {
SessionStoreInternal._resetLocalTabRestoringState(tab);
SessionStoreInternal.restoreNextTab();
- this._sendTabRestoredNotification(tab, data.isRemotenessUpdate);
break;
case "SessionStore:crashedTabRevived":
// The browser was revived by navigating to a different page
@@ -4272,22 +4271,6 @@ var SessionStoreInternal = {
aWindow.dispatchEvent(event);
},
- /**
- * Dispatch the SSTabRestored event for the given tab.
- * @param aTab
- * The tab which has been restored
- * @param aIsRemotenessUpdate
- * True if this tab was restored due to flip from running from
- * out-of-main-process to in-main-process or vice-versa.
- */
- _sendTabRestoredNotification(aTab, aIsRemotenessUpdate) {
- let event = aTab.ownerDocument.createEvent("CustomEvent");
- event.initCustomEvent("SSTabRestored", true, false, {
- isRemotenessUpdate: aIsRemotenessUpdate,
- });
- aTab.dispatchEvent(event);
- },
-
/**
* @param aWindow
* Window reference
--- a/browser/locales/en-US/chrome/browser/accounts.properties
+++ b/browser/locales/en-US/chrome/browser/accounts.properties
@@ -35,10 +35,6 @@ syncStartNotification.body2 = %S will begin syncing momentarily.
deviceDisconnectedNotification.title = Sync disconnected
deviceDisconnectedNotification.body = This computer has been successfully disconnected from Firefox Sync.
-# LOCALIZATION NOTE (sendTabToAllDevices.menuitem)
-# Displayed in the Send Tabs context menu when right clicking a tab, a page or a link.
-sendTabToAllDevices.menuitem = All Devices
-
# LOCALIZATION NOTE (tabArrivingNotification.title, tabArrivingNotificationWithDevice.title,
# tabsArrivingNotification.title, unnamedTabsArrivingNotification2.body,
# unnamedTabsArrivingNotificationMultiple2.body, unnamedTabsArrivingNotificationNoDevice.body)