Bug 1654604 - Hold CSV Import to Nightly for Fx80. r=severin,fluent-reviewers,flod
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Thu, 23 Jul 2020 06:32:30 +0000
changeset 541731 1273eeabfc21c482bbe0930a46266ba7cc4bd55a
parent 541730 ca50830f9edaf22e261ae9218e15b799047b250b
child 541732 8754a74ef0f8392812458246b61756096e0f35cb
push id37631
push userbtara@mozilla.com
push dateThu, 23 Jul 2020 16:21:22 +0000
treeherdermozilla-central@38eb7e998859 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseverin, fluent-reviewers, flod
bugs1654604
milestone80.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 1654604 - Hold CSV Import to Nightly for Fx80. r=severin,fluent-reviewers,flod Differential Revision: https://phabricator.services.mozilla.com/D84619
browser/app/profile/firefox.js
browser/components/aboutlogins/AboutLoginsChild.jsm
browser/components/aboutlogins/content/aboutLogins.html
browser/components/aboutlogins/content/components/login-intro.js
browser/components/aboutlogins/content/components/menu-button.js
browser/components/aboutlogins/tests/browser/browser_noLoginsView.js
browser/components/aboutlogins/tests/chrome/aboutlogins_common.js
browser/components/aboutlogins/tests/chrome/test_menu_button.html
browser/locales/en-US/browser/aboutLogins.ftl
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1784,18 +1784,20 @@ pref("browser.migrate.chrome.history.lim
 pref("browser.migrate.chrome.history.maxAgeInDays", 180);
 
 pref("extensions.pocket.api", "api.getpocket.com");
 pref("extensions.pocket.enabled", true);
 pref("extensions.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
 pref("extensions.pocket.site", "getpocket.com");
 
 #ifdef NIGHTLY_BUILD
+pref("signon.management.page.fileImport.enabled", true);
 pref("signon.management.page.os-auth.enabled", true);
 #else
+pref("signon.management.page.fileImport.enabled", false);
 pref("signon.management.page.os-auth.enabled", false);
 #endif
 pref("signon.management.page.breach-alerts.enabled", true);
 pref("signon.management.page.vulnerable-passwords.enabled", true);
 pref("signon.management.page.sort", "name");
 // The utm_creative value is appended within the code (specific to the location on
 // where it is clicked). Be sure that if these two prefs are updated, that
 // the utm_creative param be last.
--- a/browser/components/aboutlogins/AboutLoginsChild.jsm
+++ b/browser/components/aboutlogins/AboutLoginsChild.jsm
@@ -87,16 +87,19 @@ class AboutLoginsChild extends JSWindowA
 
             that.sendAsyncMessage(
               "AboutLogins:MasterPasswordRequest",
               messageId
             );
 
             return masterPasswordPromise;
           },
+          fileImportEnabled: Services.prefs.getBoolPref(
+            "signon.management.page.fileImport.enabled"
+          ),
           // Default to enabled just in case a search is attempted before we get a response.
           masterPasswordEnabled: true,
           passwordRevealVisible: true,
         };
         waivedContent.AboutLoginsUtils = Cu.cloneInto(
           AboutLoginsUtils,
           waivedContent,
           {
--- a/browser/components/aboutlogins/content/aboutLogins.html
+++ b/browser/components/aboutlogins/content/aboutLogins.html
@@ -136,17 +136,20 @@
         <p class="description" data-l10n-id="login-intro-description"></p>
         <ul>
           <li data-l10n-id="login-intro-instruction-fxa"></li>
           <li data-l10n-id="login-intro-instruction-fxa-settings"></li>
           <li data-l10n-id="about-logins-intro-instruction-help">
             <a data-l10n-name="help-link" class="intro-help-link" target="_blank" rel="noreferrer"></a>
           </li>
         </ul>
-        <p class="description intro-import-text" hidden data-l10n-id="about-logins-intro-import2">
+        <p class="description intro-import-text no-file-import" hidden data-l10n-id="about-logins-intro-import">
+          <a data-l10n-name="import-link" href="#"></a>
+        </p>
+        <p class="description intro-import-text file-import" hidden data-l10n-id="about-logins-intro-import2">
           <a data-l10n-name="import-browser-link" href="#"></a>
           <a data-l10n-name="import-file-link" href="#"></a>
         </p>
       </section>
     </template>
 
     <template id="login-item-template">
       <link rel="stylesheet" href="chrome://global/skin/in-content/common.css">
--- a/browser/components/aboutlogins/content/components/login-intro.js
+++ b/browser/components/aboutlogins/content/components/login-intro.js
@@ -7,19 +7,16 @@ export default class LoginIntro extends 
     if (this.shadowRoot) {
       return;
     }
 
     let loginIntroTemplate = document.querySelector("#login-intro-template");
     let shadowRoot = this.attachShadow({ mode: "open" });
     document.l10n.connectRoot(shadowRoot);
     shadowRoot.appendChild(loginIntroTemplate.content.cloneNode(true));
-
-    this._importText = shadowRoot.querySelector(".intro-import-text");
-    this._importText.addEventListener("click", this);
   }
 
   focus() {
     let helpLink = this.shadowRoot.querySelector(".intro-help-link");
     helpLink.focus();
   }
 
   handleEvent(event) {
@@ -48,17 +45,23 @@ export default class LoginIntro extends 
       this.shadowRoot.querySelector(".heading"),
       l10nId
     );
 
     this.shadowRoot
       .querySelector(".illustration")
       .classList.toggle("logged-in", syncState.loggedIn);
 
-    this._importText.hidden = !window.AboutLoginsUtils.importVisible;
     let supportURL =
       window.AboutLoginsUtils.supportBaseURL + "firefox-lockwise";
     this.shadowRoot
       .querySelector(".intro-help-link")
       .setAttribute("href", supportURL);
+
+    let importClass = window.AboutLoginsUtils.fileImportEnabled
+      ? ".intro-import-text.file-import"
+      : ".intro-import-text.no-file-import";
+    let importText = this.shadowRoot.querySelector(importClass);
+    importText.addEventListener("click", this);
+    importText.hidden = !window.AboutLoginsUtils.importVisible;
   }
 }
 customElements.define("login-intro", LoginIntro);
--- a/browser/components/aboutlogins/content/components/menu-button.js
+++ b/browser/components/aboutlogins/content/components/menu-button.js
@@ -130,16 +130,19 @@ export default class MenuButton extends 
   }
 
   _hideMenu() {
     this._menu.hidden = true;
     document.documentElement.removeEventListener("click", this, true);
   }
 
   _showMenu() {
+    this._menu.querySelector(".menuitem-import-file").hidden = !window
+      .AboutLoginsUtils.fileImportEnabled;
+
     this._menu.hidden = false;
 
     // Add a catch-all event listener to close the menu.
     document.documentElement.addEventListener("click", this, true);
   }
 
   /**
    * Toggles the visibility of the menu.
--- a/browser/components/aboutlogins/tests/browser/browser_noLoginsView.js
+++ b/browser/components/aboutlogins/tests/browser/browser_noLoginsView.js
@@ -71,28 +71,33 @@ add_task(async function test_no_logins_c
       is(
         content.document.l10n.getAttributes(
           loginIntro.shadowRoot.querySelector(".heading")
         ).id,
         "about-logins-login-intro-heading-logged-in",
         "When logged in the message should update"
       );
 
+      let importClass = Services.prefs.getBoolPref(
+        "signon.management.page.fileImport.enabled"
+      )
+        ? ".intro-import-text.file-import"
+        : ".intro-import-text.no-file-import";
       is(
         ContentTaskUtils.is_hidden(
-          loginIntro.shadowRoot.querySelector(".intro-import-text")
+          loginIntro.shadowRoot.querySelector(importClass)
         ),
         aPlatform == "linux",
         "the import link should be hidden on Linux builds"
       );
       if (aPlatform == "linux") {
         // End the test now for Linux since the link is hidden.
         return;
       }
-      loginIntro.shadowRoot.querySelector(".intro-import-text > a").click();
+      loginIntro.shadowRoot.querySelector(importClass + " > a").click();
       info("waiting for MigrationWizard to open");
     }
   );
   if (AppConstants.platform == "linux") {
     // End the test now for Linux since the link is hidden.
     return;
   }
   await TestUtils.waitForCondition(() => {
--- a/browser/components/aboutlogins/tests/chrome/aboutlogins_common.js
+++ b/browser/components/aboutlogins/tests/chrome/aboutlogins_common.js
@@ -64,11 +64,14 @@ Object.defineProperty(window, "AboutLogi
     },
     doLoginsMatch(login1, login2) {
       return (
         login1.origin == login2.origin &&
         login1.username == login2.username &&
         login1.password == login2.password
       );
     },
+    fileImportEnabled: SpecialPowers.getBoolPref(
+      "signon.management.page.fileImport.enabled"
+    ),
     masterPasswordEnabled: false,
   },
 });
--- a/browser/components/aboutlogins/tests/chrome/test_menu_button.html
+++ b/browser/components/aboutlogins/tests/chrome/test_menu_button.html
@@ -52,33 +52,34 @@ add_task(async function test_menu_open_c
 
   sendKey("ESCAPE");
   await new Promise(resolve => requestAnimationFrame(resolve));
   ok(menu.hidden, "menu should be hidden after pressing 'escape'");
   is(gMenuButton.shadowRoot.activeElement, gMenuButton.shadowRoot.querySelector(".menu-button"),
     "the .menu-button should be focused after closing the menu via keyboard");
 
   sendKey("RETURN");
-
   let firstVisibleItem = gMenuButton.shadowRoot.querySelector(".menuitem-button:not([hidden])");
   await SimpleTest.promiseWaitForCondition(() => firstVisibleItem.matches(":focus"),
     "waiting for firstVisibleItem to get focus");
 
   ok(!menu.hidden, "menu should be visible after pressing 'return'");
   ok(firstVisibleItem.matches(":focus"), "firstVisibleItem should be focused after opening popup");
 
   synthesizeKey("VK_TAB", { shiftKey: true });
   await SimpleTest.promiseWaitForCondition(() => !firstVisibleItem.matches(":focus"),
     "waiting for firstVisibleItem to lose focus");
   ok(!firstVisibleItem.matches(":focus"), "firstVisibleItem should lose focus after tabbing away from it");
   sendKey("TAB");
   await SimpleTest.promiseWaitForCondition(() => firstVisibleItem.matches(":focus"),
     "waiting for firstVisibleItem to get focus again");
   ok(firstVisibleItem.matches(":focus"), "firstVisibleItem should be focused after tabbing to it again");
-  sendKey("TAB"); // Import from file
+  if (SpecialPowers.getBoolPref("signon.management.page.fileImport.enabled")) {
+    sendKey("TAB"); // Import from file
+  }
   sendKey("TAB"); // Export
 
   if (navigator.platform == "Win32" || navigator.platform == "MacIntel") {
     // The Import menuitem is only visible on Windows/macOS, where we will need another Tab
     // press to get to the Preferences item.
     let preferencesItem = gMenuButton.shadowRoot.querySelector(".menuitem-preferences");
     sendKey("DOWN");
     await SimpleTest.promiseWaitForCondition(() => preferencesItem.matches(":focus"),
@@ -119,23 +120,25 @@ add_task(async function test_menu_keyboa
     );
   }
 
   function getFocusedMenuItem() {
     return gMenuButton.shadowRoot.querySelector(".menuitem-button:focus");
   }
 
   let allItems = [
-    "menuitem-import-file",
     "menuitem-export",
     "menuitem-preferences",
     "menuitem-help",
     "menuitem-mobile-android",
     "menuitem-mobile-ios",
   ];
+  if (SpecialPowers.getBoolPref("signon.management.page.fileImport.enabled")) {
+    allItems = ["menuitem-import-file", ...allItems];
+  }
   if (navigator.platform == "Win32" || navigator.platform == "MacIntel") {
     allItems = ["menuitem-import-browser", ...allItems];
   }
 
   let menu = gMenuButton.shadowRoot.querySelector(".menu");
 
   is(document.activeElement, gMenuButton, "menu-button should be focused to start the test");
   is(true, menu.hidden, "menu should be hidden before pressing 'space'");
--- a/browser/locales/en-US/browser/aboutLogins.ftl
+++ b/browser/locales/en-US/browser/aboutLogins.ftl
@@ -71,16 +71,17 @@ about-logins-list-item-vulnerable-passwo
 ## Introduction screen
 
 about-logins-login-intro-heading-logged-out = Looking for your saved logins? Set up { -sync-brand-short-name } or Import Them.
 about-logins-login-intro-heading-logged-in = No synced logins found.
 login-intro-description = If you saved your logins to { -brand-product-name } on a different device, here’s how to get them here:
 login-intro-instruction-fxa = Create or sign in to your { -fxaccount-brand-name } on the device where your logins are saved
 login-intro-instruction-fxa-settings = Make sure you’ve selected the Logins checkbox in { -sync-brand-short-name } Settings
 about-logins-intro-instruction-help = Visit <a data-l10n-name="help-link">{ -lockwise-brand-short-name } Support</a> for more help
+about-logins-intro-import = If your logins are saved in another browser, you can <a data-l10n-name="import-link">import them into { -lockwise-brand-short-name }</a>
 about-logins-intro-import2 = If your logins are saved outside of { -brand-product-name }, you can <a data-l10n-name="import-browser-link">import them from another browser</a> or <a data-l10n-name="import-file-link">from a file</a>
 
 ## Login
 
 login-item-new-login-title = Create New Login
 login-item-edit-button = Edit
 about-logins-login-item-remove-button = Remove
 login-item-origin-label = Website address