Bug 1613731 - Move the 'fill login' menuitem up to the top of the context menu. r=MattN
☠☠ backed out by 9c9df438d620 ☠ ☠
authorJared Wein <jwein@mozilla.com>
Thu, 06 Feb 2020 20:15:00 +0000
changeset 512915 f15513c3ad0e8bb898ae2f5d739eb03dce2467e9
parent 512914 5a4eb6758bed2fdeddf87a43821089305b8b5f5e
child 512916 f7b40adefad02586b491485185614c48a0d53941
push id37101
push usernerli@mozilla.com
push dateSat, 08 Feb 2020 09:25:03 +0000
treeherdermozilla-central@cb56699431a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1613731
milestone74.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 1613731 - Move the 'fill login' menuitem up to the top of the context menu. r=MattN Differential Revision: https://phabricator.services.mozilla.com/D61919
browser/base/content/browser-context.inc
browser/base/content/nsContextMenu.js
browser/base/content/test/contextMenu/browser_contextmenu_input.js
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -228,21 +228,42 @@
         <menupopup id="context-sendpagetodevice-popup"
                    onpopupshowing="(() => { gSync.populateSendTabToDevicesMenu(event.target, gBrowser.currentURI.spec, gBrowser.contentTitle); })()"/>
       </menu>
       <menuseparator id="context-sep-viewbgimage"/>
       <menuitem id="context-viewbgimage"
                 data-l10n-id="main-context-menu-view-background-image"
                 oncommand="gContextMenu.viewBGImage(event);"
                 onclick="checkForMiddleClick(this, event);"/>
+      <menu id="fill-login"
+            label="&fillLoginMenu.label;"
+            label-login="&fillLoginMenu.label;"
+            label-password="&fillPasswordMenu.label;"
+            label-username="&fillUsernameMenu.label;"
+            accesskey="&fillLoginMenu.accesskey;"
+            accesskey-login="&fillLoginMenu.accesskey;"
+            accesskey-password="&fillPasswordMenu.accesskey;"
+            accesskey-username="&fillUsernameMenu.accesskey;"
+            hidden="true">
+        <menupopup id="fill-login-popup">
+          <menuitem id="fill-login-no-logins"
+                    label="&noLoginSuggestions.label;"
+                    disabled="true"
+                    hidden="true"/>
+          <menuseparator id="saved-logins-separator"/>
+          <menuitem id="fill-login-saved-passwords"
+                    label="&viewSavedLogins.label;"
+                    oncommand="gContextMenu.openPasswordManager();"/>
+        </menupopup>
+      </menu>
      <menuitem id="fill-login-generated-password"
                data-l10n-id="main-context-menu-generate-new-password"
                hidden="true"
                oncommand="gContextMenu.useGeneratedPassword();"/>
-      <menuseparator id="generated-password-separator"/>
+      <menuseparator id="fill-login-and-generated-password-separator"/>
       <menuitem id="context-undo"
                 data-l10n-id="text-action-undo"
                 command="cmd_undo"/>
       <menuseparator id="context-sep-undo"/>
       <menuitem id="context-cut"
                 data-l10n-id="text-action-cut"
                 command="cmd_cut"/>
       <menuitem id="context-copy"
@@ -349,38 +370,16 @@
       </menu>
       <menuseparator hidden="true" id="context-sep-bidi"/>
       <menuitem hidden="true" id="context-bidi-text-direction-toggle"
                 data-l10n-id="main-context-menu-bidi-switch-text"
                 command="cmd_switchTextDirection"/>
       <menuitem hidden="true" id="context-bidi-page-direction-toggle"
                 data-l10n-id="main-context-menu-bidi-switch-page"
                 oncommand="gContextMenu.switchPageDirection();"/>
-      <menuseparator id="fill-login-separator" hidden="true"/>
-      <menu id="fill-login"
-            label="&fillLoginMenu.label;"
-            label-login="&fillLoginMenu.label;"
-            label-password="&fillPasswordMenu.label;"
-            label-username="&fillUsernameMenu.label;"
-            accesskey="&fillLoginMenu.accesskey;"
-            accesskey-login="&fillLoginMenu.accesskey;"
-            accesskey-password="&fillPasswordMenu.accesskey;"
-            accesskey-username="&fillUsernameMenu.accesskey;"
-            hidden="true">
-        <menupopup id="fill-login-popup">
-          <menuitem id="fill-login-no-logins"
-                    label="&noLoginSuggestions.label;"
-                    disabled="true"
-                    hidden="true"/>
-          <menuseparator id="saved-logins-separator"/>
-          <menuitem id="fill-login-saved-passwords"
-                    label="&viewSavedLogins.label;"
-                    oncommand="gContextMenu.openPasswordManager();"/>
-        </menupopup>
-      </menu>
       <menuseparator id="inspect-separator" hidden="true"/>
       <menuitem id="context-inspect"
                 hidden="true"
                 data-l10n-id="main-context-menu-inspect-element"
                 oncommand="gContextMenu.inspectNode();"/>
       <menuitem id="context-inspect-a11y"
                 hidden="true"
                 data-l10n-id="main-context-menu-inspect-a11y-properties"
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -979,20 +979,22 @@ class nsContextMenu {
 
       if (!fragment) {
         return;
       }
       let popup = document.getElementById("fill-login-popup");
       let insertBeforeElement = document.getElementById("fill-login-no-logins");
       popup.insertBefore(fragment, insertBeforeElement);
     } finally {
-      this.showItem("fill-login-separator", showFill);
       this.showItem("fill-login", showFill);
       this.showItem("fill-login-generated-password", showGenerate);
-      this.showItem("generated-password-separator", showGenerate);
+      this.showItem(
+        "fill-login-and-generated-password-separator",
+        showFill || showGenerate
+      );
     }
   }
 
   initSyncItems() {
     gSync.updateContentContextMenu(this);
   }
 
   openPasswordManager() {
--- a/browser/base/content/test/contextMenu/browser_contextmenu_input.js
+++ b/browser/base/content/test/contextMenu/browser_contextmenu_input.js
@@ -224,45 +224,45 @@ add_task(async function test_password_in
   todo(
     false,
     "context-selectall is enabled on osx-e10s, and windows when" +
       " it should be disabled"
   );
   await test_contextmenu(
     "#input_password",
     [
+      "fill-login",
+      null,
+      [
+        "fill-login-no-logins",
+        false,
+        "---",
+        null,
+        "fill-login-saved-passwords",
+        true,
+      ],
+      null,
+      "---",
+      null,
       "context-undo",
       false,
       "---",
       null,
       "context-cut",
       true,
       "context-copy",
       true,
       "context-paste",
       null, // ignore clipboard state
       "context-delete",
       false,
       "---",
       null,
       "context-selectall",
       null,
-      "---",
-      null,
-      "fill-login",
-      null,
-      [
-        "fill-login-no-logins",
-        false,
-        "---",
-        null,
-        "fill-login-saved-passwords",
-        true,
-      ],
-      null,
     ],
     {
       skipFocusChange: true,
       // Need to dynamically add/remove the "password" type or LoginManager
       // will think that the form inputs on the page are part of a login
       // and will add fill-login context menu items.
       async preCheckContextMenuFn() {
         await SpecialPowers.spawn(