Bug 1417597 - Show a different feedback message in send tab when we're offline. r=jaws
authorEdouard Oger <eoger@fastmail.com>
Thu, 16 Nov 2017 16:11:46 -0500
changeset 448266 5c849056fcf23218de40bdb1732409d05b6e37d3
parent 448265 cc275683d12d4018a241d2c96c2ba39ed22a8a8f
child 448267 d76f30fd68022233f6368bcab6fb03dad3b4744e
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1417597
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1417597 - Show a different feedback message in send tab when we're offline. r=jaws MozReview-Commit-ID: Emsx0LwFAE1
browser/base/content/browser-pageActions.js
browser/base/content/browser-sync.js
browser/base/content/browser.xul
browser/locales/en-US/chrome/browser/browser.dtd
--- a/browser/base/content/browser-pageActions.js
+++ b/browser/base/content/browser-pageActions.js
@@ -867,18 +867,18 @@ var BrowserPageActionFeedback = {
     return this.feedbackAnimationBox = document.getElementById("pageActionFeedbackAnimatableBox");
   },
 
   get feedbackLabel() {
     delete this.feedbackLabel;
     return this.feedbackLabel = document.getElementById("pageActionFeedbackMessage");
   },
 
-  show(action, event) {
-    this.feedbackLabel.textContent = this.panelNode.getAttribute(action.id + "Feedback");
+  show(action, event, textContentOverride) {
+    this.feedbackLabel.textContent = this.panelNode.getAttribute((textContentOverride || action.id) + "Feedback");
     this.panelNode.hidden = false;
 
     let anchor = BrowserPageActions.panelAnchorNodeForAction(action, event);
     this.panelNode.openPopup(anchor, {
       position: "bottomcenter topright",
       triggerEvent: event,
     });
 
@@ -989,17 +989,18 @@ BrowserPageActions.sendToDevice = {
       item.addEventListener("command", event => {
         if (panelNode) {
           panelNode.hidePopup();
         }
         // 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");
-          BrowserPageActionFeedback.show(action, event);
+          let textOverride = gSync.offline && "sendToDeviceOffline";
+          BrowserPageActionFeedback.show(action, event, textOverride);
         }
       });
       return item;
     });
 
     bodyNode.removeAttribute("state");
     // In the first ~10 sec after startup, Sync may not be loaded and the list
     // of devices will be empty.
--- a/browser/base/content/browser-sync.js
+++ b/browser/base/content/browser-sync.js
@@ -60,16 +60,20 @@ var gSync = {
     return UIState.get().status == UIState.STATUS_SIGNED_IN;
   },
 
   get remoteClients() {
     return Weave.Service.clientsEngine.remoteClients
            .sort((a, b) => a.name.localeCompare(b.name));
   },
 
+  get offline() {
+    return Weave.Service.scheduler.offline;
+  },
+
   _generateNodeGetters() {
     for (let k of ["Status", "Avatar", "Label", "Container"]) {
       let prop = "appMenu" + k;
       let suffix = k.toLowerCase();
       delete this[prop];
       this.__defineGetter__(prop, function() {
         delete this[prop];
         return this[prop] = document.getElementById("appMenu-fxa-" + suffix);
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -431,17 +431,18 @@
            role="alert"
            type="arrow"
            hidden="true"
            flip="slide"
            position="bottomcenter topright"
            tabspecific="true"
            noautofocus="true"
            copyURLFeedback="&copyURLFeedback.label;"
-           sendToDeviceFeedback="&sendToDeviceFeedback.label;">
+           sendToDeviceFeedback="&sendToDeviceFeedback.label;"
+           sendToDeviceOfflineFeedback="&sendToDeviceOfflineFeedback.label;">
       <hbox id="pageActionFeedbackAnimatableBox">
         <image id="pageActionFeedbackAnimatableImage"/>
       </hbox>
       <label id="pageActionFeedbackMessage"/>
     </panel>
 
     <menupopup id="pageActionContextMenu"
                onpopupshowing="BrowserPageActions.onContextMenuShowing(event, this);">
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -46,16 +46,17 @@ can reach it easily. -->
 <!ENTITY  unpinTab.accesskey                 "b">
 <!ENTITY  sendTabToDevice.label              "Send Tab to Device">
 <!ENTITY  sendTabToDevice.accesskey          "n">
 <!ENTITY  sendPageToDevice.label             "Send Page to Device">
 <!ENTITY  sendPageToDevice.accesskey         "n">
 <!ENTITY  sendLinkToDevice.label             "Send Link to Device">
 <!ENTITY  sendLinkToDevice.accesskey         "n">
 <!ENTITY  sendToDeviceFeedback.label         "Sent!">
+<!ENTITY  sendToDeviceOfflineFeedback.label  "Queued (offline)">
 <!ENTITY  moveToNewWindow.label              "Move to New Window">
 <!ENTITY  moveToNewWindow.accesskey          "W">
 <!ENTITY  bookmarkAllTabs.label              "Bookmark All Tabs…">
 <!ENTITY  bookmarkAllTabs.accesskey          "T">
 <!ENTITY  undoCloseTab.label                 "Undo Close Tab">
 <!ENTITY  undoCloseTab.accesskey             "U">
 <!ENTITY  closeTab.label                     "Close Tab">
 <!ENTITY  closeTab.accesskey                 "c">