Backed out changeset f54538dd8a6f (bug 1576654) for pageActions/browser_page_action_menu* failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2019-09-24 20:33:37 +03:00
parent a20be9ee64
commit 5119706eb6
2 changed files with 18 additions and 19 deletions

View File

@ -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) {

View File

@ -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!