Bug 1406051 - Don't show two separators in context menu. r=jaws
authorEdouard Oger <eoger@fastmail.com>
Tue, 10 Oct 2017 16:46:09 -0400
changeset 385953 4730ce3175f8ce3f10c40af5e21c6831668187a8
parent 385952 2ad9ea63f3cc4413097e3fa2ab978b25836954f1
child 385954 5ede138b6e27cfd84d87e65e039623a5dc683121
push id32672
push userarchaeopteryx@coole-files.de
push dateFri, 13 Oct 2017 09:00:05 +0000
treeherdermozilla-central@3efcb26e5f37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1406051
milestone58.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 1406051 - Don't show two separators in context menu. r=jaws MozReview-Commit-ID: H32PX0zh3eU
browser/base/content/browser-sync.js
--- a/browser/base/content/browser-sync.js
+++ b/browser/base/content/browser-sync.js
@@ -460,19 +460,22 @@ var gSync = {
     // showSendLink and showSendPage are mutually exclusive
     const showSendLink = contextMenu.onSaveableLink || contextMenu.onPlainTextLink;
     const showSendPage = !showSendLink
                          && !(contextMenu.isContentSelected ||
                               contextMenu.onImage || contextMenu.onCanvas ||
                               contextMenu.onVideo || contextMenu.onAudio ||
                               contextMenu.onLink || contextMenu.onTextInput);
 
-    ["context-sendpagetodevice", "context-sep-sendpagetodevice"]
+    // Avoids double separator on images with links.
+    const hideSeparator = contextMenu.isContentSelected &&
+                          contextMenu.onLink && contextMenu.onImage;
+    ["context-sendpagetodevice", ...(hideSeparator ? [] : ["context-sep-sendpagetodevice"])]
     .forEach(id => contextMenu.showItem(id, showSendPage));
-    ["context-sendlinktodevice", "context-sep-sendlinktodevice"]
+    ["context-sendlinktodevice", ...(hideSeparator ? [] : ["context-sep-sendlinktodevice"])]
     .forEach(id => contextMenu.showItem(id, showSendLink));
 
     if (!showSendLink && !showSendPage) {
       return;
     }
 
     const targetURI = showSendLink ? contextMenu.linkURL :
                                      contextMenu.browser.currentURI.spec;