From 5119706eb6684ccf208b49c95ca47145486a0db1 Mon Sep 17 00:00:00 2001 From: Bogdan Tara Date: Tue, 24 Sep 2019 20:33:37 +0300 Subject: [PATCH] Backed out changeset f54538dd8a6f (bug 1576654) for pageActions/browser_page_action_menu* failures CLOSED TREE --- browser/base/content/browser-sync.js | 36 +++++++++---------- .../en-US/chrome/browser/browser.properties | 1 + 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/browser/base/content/browser-sync.js b/browser/base/content/browser-sync.js index 7fee58eb4740..9485776e8d57 100644 --- a/browser/base/content/browser-sync.js +++ b/browser/base/content/browser-sync.js @@ -85,6 +85,10 @@ var gSync = { ); }, + get offline() { + return Weave.Service.scheduler.offline; + }, + _generateNodeGetters() { for (let k of ["Status", "Avatar", "Label"]) { let prop = "appMenu" + k; @@ -307,6 +311,13 @@ var gSync = { if (panelNode) { PanelMultiView.hidePopup(panelNode); } + // There are items in the subview that don't represent devices: "Sign + // in", "Learn about Sync", etc. Device items will be .sendtab-target. + if (event.target.classList.contains("sendtab-target")) { + let action = PageActions.actionForID("sendToDevice"); + let messageId = gSync.offline && "sendToDeviceOffline"; + showBrowserPageActionFeedback(action, event, messageId); + } }); return item; } @@ -724,7 +735,6 @@ var gSync = { console.error(`Target ${target.id} unsuitable for send tab.`); } } - let numFailed = 0; if (fxaCommandsDevices.length) { console.log( `Sending a tab to ${fxaCommandsDevices @@ -745,7 +755,6 @@ var gSync = { console.error( `Could not find associated Sync device for ${device.name}` ); - numFailed++; continue; } oldSendTabClients.push(device.clientRecord); @@ -760,11 +769,9 @@ var gSync = { title ); } catch (e) { - numFailed++; console.error("Could not send tab to device.", e); } } - return numFailed < targets.length; // Good enough. }, populateSendTabToDevicesMenu( @@ -842,26 +849,17 @@ var gSync = { }) : [{ url, title }]; - const send = to => { - Promise.all( - tabsToSend.map(t => - // sendTabToDevice does not reject. - this.sendTabToDevice(t.url, to, t.title) - ) - ).then(results => { - if (results.includes(true)) { - let action = PageActions.actionForID("sendToDevice"); - showBrowserPageActionFeedback(action); - } - }); - }; const onSendAllCommand = event => { - send(targets); + for (let t of tabsToSend) { + this.sendTabToDevice(t.url, targets, t.title); + } }; const onTargetDeviceCommand = event => { const targetId = event.target.getAttribute("clientId"); const target = targets.find(t => t.id == targetId); - send([target]); + for (let t of tabsToSend) { + this.sendTabToDevice(t.url, [target], t.title); + } }; function addTargetDevice(targetId, name, targetType, lastModified) { diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index e4e8c2c427da..a0ecec71b0bb 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -997,6 +997,7 @@ storageAccess.description.label = You may want to block %1$S on this site if you storageAccess.description.learnmore = third-party trackers confirmationHint.sendToDevice.label = Sent! +confirmationHint.sendToDeviceOffline.label = Queued (offline) confirmationHint.copyURL.label = Copied to clipboard! confirmationHint.pageBookmarked.label = Saved to Library! confirmationHint.addSearchEngine.label = Search engine added!