Bug 1483167 - Copy Link and Send Tab to Device page action button tooltips say "coypURL-title" and "sendToDevice-title" r=Gijs
authorDrew Willcoxon <adw@mozilla.com>
Thu, 23 Aug 2018 10:20:54 +0000
changeset 488250 68654fc447f8c941b9533bc741fea0ef5c2cec96
parent 488249 c80c839f05d114bf913657266bac1d85d99171ee
child 488251 1eb34707779fdb6acecf803904abddb64593f57b
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1483167
milestone63.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 1483167 - Copy Link and Send Tab to Device page action button tooltips say "coypURL-title" and "sendToDevice-title" r=Gijs Replacing onPlacedInPanel with onBeforePlacedInWindow is the right fix. Differential Revision: https://phabricator.services.mozilla.com/D4028
browser/base/content/browser-pageActions.js
browser/modules/PageActions.jsm
--- a/browser/base/content/browser-pageActions.js
+++ b/browser/base/content/browser-pageActions.js
@@ -448,27 +448,16 @@ var BrowserPageActions = {
     }
 
     let insertBeforeNode = this._getNextNode(action, true);
     this.mainButtonNode.parentNode.insertBefore(node, insertBeforeNode);
     this.updateAction(action, null, {
       urlbarNode: node,
     });
     action.onPlacedInUrlbar(node);
-
-    // urlbar buttons should always have tooltips, so if the node doesn't have
-    // one, then as a last resort use the label of the corresponding panel
-    // button.  Why not set tooltiptext to action.title when the node is
-    // created?  Because the consumer may set a title dynamically.
-    if (!node.hasAttribute("tooltiptext")) {
-      let panelNode = this.panelButtonNodeForActionID(action.id);
-      if (panelNode) {
-        node.setAttribute("tooltiptext", panelNode.getAttribute("label"));
-      }
-    }
   },
 
   _makeUrlbarButtonNode(action) {
     let buttonNode = document.createXULElement("image");
     buttonNode.classList.add("urlbar-icon", "urlbar-page-action");
     buttonNode.setAttribute("actionid", action.id);
     buttonNode.setAttribute("role", "button");
     buttonNode.addEventListener("click", event => {
@@ -962,47 +951,47 @@ BrowserPageActions.bookmark = {
   onCommand(event, buttonNode) {
     PanelMultiView.hidePopup(BrowserPageActions.panelNode);
     BookmarkingUI.onStarCommand(event);
   },
 };
 
 // copy URL
 BrowserPageActions.copyURL = {
-  onPlacedInPanel(buttonNode) {
+  onBeforePlacedInWindow(browserWindow) {
     let action = PageActions.actionForID("copyURL");
     BrowserPageActions.takeActionTitleFromPanel(action);
   },
 
   onCommand(event, buttonNode) {
     PanelMultiView.hidePopup(BrowserPageActions.panelNode);
     Cc["@mozilla.org/widget/clipboardhelper;1"]
       .getService(Ci.nsIClipboardHelper)
       .copyString(gURLBar.makeURIReadable(gBrowser.selectedBrowser.currentURI).displaySpec);
     let action = PageActions.actionForID("copyURL");
     showBrowserPageActionFeedback(action, event);
   },
 };
 
 // email link
 BrowserPageActions.emailLink = {
-  onPlacedInPanel(buttonNode) {
+  onBeforePlacedInWindow(browserWindow) {
     let action = PageActions.actionForID("emailLink");
     BrowserPageActions.takeActionTitleFromPanel(action);
   },
 
   onCommand(event, buttonNode) {
     PanelMultiView.hidePopup(BrowserPageActions.panelNode);
     MailIntegration.sendLinkForBrowser(gBrowser.selectedBrowser);
   },
 };
 
 // send to device
 BrowserPageActions.sendToDevice = {
-  onPlacedInPanel(buttonNode) {
+  onBeforePlacedInWindow(browserWindow) {
     let action = PageActions.actionForID("sendToDevice");
     BrowserPageActions.takeActionTitleFromPanel(action);
   },
 
   onSubviewPlaced(panelViewNode) {
     let bodyNode = panelViewNode.querySelector(".panel-subview-body");
     let notReady = document.createXULElement("toolbarbutton");
     notReady.classList.add(
@@ -1193,17 +1182,17 @@ BrowserPageActions.addSearchEngine = {
 };
 
 // share URL
 BrowserPageActions.shareURL = {
   onShowingInPanel(buttonNode) {
     this._cached = false;
   },
 
-  onPlacedInPanel(buttonNode) {
+  onBeforePlacedInWindow(browserWindow) {
     let action = PageActions.actionForID("shareURL");
     BrowserPageActions.takeActionTitleFromPanel(action);
   },
 
   onShowingSubview(panelViewNode) {
     let bodyNode = panelViewNode.querySelector(".panel-subview-body");
 
     // We cache the providers + the UI if the user selects the share
--- a/browser/modules/PageActions.jsm
+++ b/browser/modules/PageActions.jsm
@@ -1082,30 +1082,32 @@ var gBuiltInActions = [
     id: ACTION_ID_BOOKMARK_SEPARATOR,
     _isSeparator: true,
   },
 
   // copy URL
   {
     id: "copyURL",
     title: "copyURL-title",
-    onPlacedInPanel(buttonNode) {
-      browserPageActions(buttonNode).copyURL.onPlacedInPanel(buttonNode);
+    onBeforePlacedInWindow(browserWindow) {
+      browserPageActions(browserWindow).copyURL
+        .onBeforePlacedInWindow(browserWindow);
     },
     onCommand(event, buttonNode) {
       browserPageActions(buttonNode).copyURL.onCommand(event, buttonNode);
     },
   },
 
   // email link
   {
     id: "emailLink",
     title: "emailLink-title",
-    onPlacedInPanel(buttonNode) {
-      browserPageActions(buttonNode).emailLink.onPlacedInPanel(buttonNode);
+    onBeforePlacedInWindow(browserWindow) {
+      browserPageActions(browserWindow).emailLink
+        .onBeforePlacedInWindow(browserWindow);
     },
     onCommand(event, buttonNode) {
       browserPageActions(buttonNode).emailLink.onCommand(event, buttonNode);
     },
   },
 
   // add search engine
   {
@@ -1128,18 +1130,19 @@ var gBuiltInActions = [
 ];
 
 if (Services.prefs.getBoolPref("identity.fxaccounts.enabled")) {
   gBuiltInActions.push(
   // send to device
   {
     id: "sendToDevice",
     title: "sendToDevice-title",
-    onPlacedInPanel(buttonNode) {
-      browserPageActions(buttonNode).sendToDevice.onPlacedInPanel(buttonNode);
+    onBeforePlacedInWindow(browserWindow) {
+      browserPageActions(browserWindow).sendToDevice
+        .onBeforePlacedInWindow(browserWindow);
     },
     onLocationChange(browserWindow) {
       browserPageActions(browserWindow).sendToDevice.onLocationChange();
     },
     wantsSubview: true,
     onSubviewPlaced(panelViewNode) {
       browserPageActions(panelViewNode).sendToDevice
         .onSubviewPlaced(panelViewNode);
@@ -1155,18 +1158,19 @@ if (AppConstants.platform == "macosx") {
   gBuiltInActions.push(
   // Share URL
   {
     id: "shareURL",
     title: "shareURL-title",
     onShowingInPanel(buttonNode) {
       browserPageActions(buttonNode).shareURL.onShowingInPanel(buttonNode);
     },
-    onPlacedInPanel(buttonNode) {
-      browserPageActions(buttonNode).shareURL.onPlacedInPanel(buttonNode);
+    onBeforePlacedInWindow(browserWindow) {
+      browserPageActions(browserWindow).shareURL
+        .onBeforePlacedInWindow(browserWindow);
     },
     wantsSubview: true,
     onSubviewShowing(panelViewNode) {
         browserPageActions(panelViewNode).shareURL
           .onShowingSubview(panelViewNode);
     },
   });
 }