Bug 1618696 - Enable signon.passwordEditCapture.enabled by default. r=MattN
authorSam Foster <sfoster@mozilla.com>
Sat, 07 Mar 2020 02:14:49 +0000
changeset 517686 cc4ec8298e520d16655ff7e8f6a86a32cc423206
parent 517685 469e5a0fc374bc96451f986606268ec5deb97712
child 517687 2be4c9a3f053fa67f0d821e926c49abe2a947654
push id37199
push useropoprus@mozilla.com
push dateTue, 10 Mar 2020 03:43:44 +0000
treeherdermozilla-central@6f21f98dcfcd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1618696
milestone76.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 1618696 - Enable signon.passwordEditCapture.enabled by default. r=MattN Differential Revision: https://phabricator.services.mozilla.com/D64843
browser/app/profile/firefox.js
toolkit/components/passwordmgr/test/browser/browser_doorhanger_dismissed_for_ccnumber.js
toolkit/components/passwordmgr/test/browser/browser_doorhanger_generated_password.js
toolkit/components/passwordmgr/test/browser/browser_doorhanger_password_edits.js
toolkit/components/passwordmgr/test/browser/browser_doorhanger_username_edits.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1730,16 +1730,17 @@ pref("signon.management.overrideURI", "a
 // where it is clicked). Be sure that if these two prefs are updated, that
 // the utm_creative param be last.
 pref("signon.management.page.mobileAndroidURL", "https://app.adjust.com/6tteyjo?redirect=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dmozilla.lockbox&utm_campaign=Desktop&utm_adgroup=InProduct&utm_creative=");
 pref("signon.management.page.mobileAppleURL", "https://app.adjust.com/6tteyjo?redirect=https%3A%2F%2Fitunes.apple.com%2Fapp%2Fid1314000270%3Fmt%3D8&utm_campaign=Desktop&utm_adgroup=InProduct&utm_creative=");
 pref("signon.management.page.breachAlertUrl",
      "https://monitor.firefox.com/breach-details/");
 pref("signon.management.page.hideMobileFooter", false);
 pref("signon.management.page.showPasswordSyncNotification", true);
+pref("signon.passwordEditCapture.enabled", true);
 
 // Enable the "Simplify Page" feature in Print Preview. This feature
 // is disabled by default in toolkit.
 pref("print.use_simplify_page", true);
 
 // Space separated list of URLS that are allowed to send objects (instead of
 // only strings) through webchannels. This list is duplicated in mobile/android/app/mobile.js
 pref("webchannel.allowObject.urlWhitelist", "https://content.cdn.mozilla.net https://support.mozilla.org https://install.mozilla.org");
--- a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_dismissed_for_ccnumber.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_dismissed_for_ccnumber.js
@@ -10,22 +10,33 @@ add_task(async function test_doorhanger_
       gBrowser,
       url,
     },
     async function test_un_value_as_ccnumber(browser) {
       // If the username field has a credit card number and if
       // the password field is a three digit numberic value,
       // we automatically dismiss the save logins prompt on submission.
 
+      let passwordFilledPromise = listenForTestNotification(
+        "PasswordEditedOrGenerated"
+      );
       await changeContentFormValues(browser, {
         "#form-basic-password": "123",
         // We are interested in the state of the doorhanger created and don't want a
         // false positive from the password-edited handling
         "#form-basic-username": "4111111111111111",
       });
+      info("Waiting for passwordFilledPromise");
+      await passwordFilledPromise;
+      // reset doorhanger/notifications, we're only interested in the submit outcome
+      await cleanupDoorhanger();
+      await cleanupPasswordNotifications();
+      // reset message cache so we can disambiguate between dismissed doorhanger from
+      // password edited vs form submitted w. cc number as username
+      await clearMessageCache(browser);
 
       let processedPromise = listenForTestNotification("FormSubmit");
       await SpecialPowers.spawn(browser, [], async () => {
         content.document.getElementById("form-basic-submit").click();
       });
       info("Waiting for FormSubmit");
       await processedPromise;
 
@@ -44,25 +55,35 @@ add_task(async function test_doorhanger_
       gBrowser,
       url,
     },
     async function test_pw_value_as_ccnumber(browser) {
       // If the password field has a credit card number and if
       // the password field is also tagged autocomplete="cc-number",
       // we automatically dismiss the save logins prompt on submission.
 
+      let passwordFilledPromise = listenForTestNotification(
+        "PasswordEditedOrGenerated"
+      );
       await changeContentFormValues(browser, {
         "#form-basic-password": "4111111111111111",
         "#form-basic-username": "aaa",
       });
       await SpecialPowers.spawn(browser, [], async () => {
         content.document
           .getElementById("form-basic-password")
           .setAttribute("autocomplete", "cc-number");
       });
+      await passwordFilledPromise;
+      // reset doorhanger/notifications, we're only interested in the submit outcome
+      await cleanupDoorhanger();
+      await cleanupPasswordNotifications();
+      // reset message cache so we can disambiguate between dismissed doorhanger from
+      // password edited vs form submitted w. cc number as password
+      await clearMessageCache(browser);
 
       let processedPromise = listenForTestNotification("FormSubmit");
       await SpecialPowers.spawn(browser, [], async () => {
         content.document.getElementById("form-basic-submit").click();
       });
       await processedPromise;
 
       let notif = getCaptureDoorhanger("password-save");
@@ -79,21 +100,32 @@ add_task(async function test_doorhanger_
     {
       gBrowser,
       url,
     },
     async function test_un_with_invalid_cc_number(browser) {
       // If the username field has a CC number that is invalid,
       // we show the doorhanger to save logins like we usually do.
 
+      let passwordFilledPromise = listenForTestNotification(
+        "PasswordEditedOrGenerated"
+      );
       await changeContentFormValues(browser, {
         "#form-basic-password": "411",
         "#form-basic-username": "1234123412341234",
       });
 
+      await passwordFilledPromise;
+      // reset doorhanger/notifications, we're only interested in the submit outcome
+      await cleanupDoorhanger();
+      await cleanupPasswordNotifications();
+      // reset message cache so we can disambiguate between dismissed doorhanger from
+      // password edited vs form submitted w. cc number as password
+      await clearMessageCache(browser);
+
       let processedPromise = listenForTestNotification("FormSubmit");
       await SpecialPowers.spawn(browser, [], async () => {
         content.document.getElementById("form-basic-submit").click();
       });
       await processedPromise;
 
       let notif = await getCaptureDoorhangerThatMayOpen("password-save");
       ok(notif, "got notification popup");
@@ -125,20 +157,31 @@ add_task(async function test_doorhanger_
         null,
         "4111111111111111",
         "111", // password looks like a card security code
         "form-basic-username",
         "form-basic-password"
       );
       Services.logins.addLogin(login);
 
+      let passwordFilledPromise = listenForTestNotification(
+        "PasswordEditedOrGenerated"
+      );
+
       await changeContentFormValues(browser, {
         "#form-basic-password": "222", // password looks like a card security code
         "#form-basic-username": "4111111111111111",
       });
+      await passwordFilledPromise;
+      // reset doorhanger/notifications, we're only interested in the submit outcome
+      await cleanupDoorhanger();
+      await cleanupPasswordNotifications();
+      // reset message cache so we can disambiguate between dismissed doorhanger from
+      // password edited vs form submitted w. cc number as username
+      await clearMessageCache(browser);
 
       let processedPromise = listenForTestNotification("FormSubmit");
       await SpecialPowers.spawn(browser, [], async () => {
         content.document.getElementById("form-basic-submit").click();
       });
       await processedPromise;
 
       let notif = getCaptureDoorhanger("password-change");
--- a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_generated_password.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_generated_password.js
@@ -346,17 +346,17 @@ add_task(async function autocomplete_gen
   await setup_withOneLogin("", "xyzpassword");
   await openFormInNewTab(
     TEST_ORIGIN + FORM_PAGE_PATH,
     {
       password: {
         selector: passwordInputSelector,
         expectedValue: "xyzpassword",
         setValue: "",
-        expectedMessage: "",
+        expectedMessage: "PasswordEditedOrGenerated",
       },
       username: { selector: usernameInputSelector, expectedValue: "" },
     },
     async function taskFn(browser) {
       let [savedLogin] = Services.logins.getAllLogins();
       let storageChangedPromise = TestUtils.topicObserved(
         "passwordmgr-storage-changed",
         (_, data) => data == "modifyLogin"
@@ -409,17 +409,17 @@ add_task(async function autocomplete_gen
   await setup_withOneLogin("user1", "xyzpassword");
   await openFormInNewTab(
     TEST_ORIGIN + FORM_PAGE_PATH,
     {
       password: {
         selector: passwordInputSelector,
         expectedValue: "xyzpassword",
         setValue: "",
-        expectedMessage: "",
+        expectedMessage: "PasswordEditedOrGenerated",
       },
       username: {
         selector: usernameInputSelector,
         expectedValue: "user1",
       },
     },
     async function taskFn(browser) {
       let storageChangedPromise = TestUtils.topicObserved(
@@ -503,17 +503,17 @@ add_task(async function ac_gen_pw_saved_
   await setup_withOneLogin("", "xyzpassword");
   await openFormInNewTab(
     TEST_ORIGIN + FORM_PAGE_PATH,
     {
       password: {
         selector: passwordInputSelector,
         expectedValue: "xyzpassword",
         setValue: "",
-        expectedMessage: "",
+        expectedMessage: "PasswordEditedOrGenerated",
       },
       username: {
         selector: usernameInputSelector,
         expectedValue: "",
         setValue: "myusername",
         // with an empty password value, no message is sent for a username change
         expectedMessage: "",
       },
@@ -577,17 +577,17 @@ add_task(async function contextfill_gene
   await setup_withOneLogin("", "xyzpassword");
   await openFormInNewTab(
     TEST_ORIGIN + FORM_PAGE_PATH,
     {
       password: {
         selector: passwordInputSelector,
         expectedValue: "xyzpassword",
         setValue: "",
-        expectedMessage: "",
+        expectedMessage: "PasswordEditedOrGenerated",
       },
       username: { selector: usernameInputSelector, expectedValue: "" },
     },
     async function taskFn(browser) {
       let [savedLogin] = Services.logins.getAllLogins();
       let storageChangedPromise = TestUtils.topicObserved(
         "passwordmgr-storage-changed",
         (_, data) => data == "modifyLogin"
@@ -644,17 +644,17 @@ add_task(async function autocomplete_gen
   await setup_withOneLogin("", "xyzpassword");
   await openFormInNewTab(
     TEST_ORIGIN + FORM_PAGE_PATH,
     {
       password: {
         selector: passwordInputSelector,
         expectedValue: "xyzpassword",
         setValue: "",
-        expectedMessage: "",
+        expectedMessage: "PasswordEditedOrGenerated",
       },
       username: { selector: usernameInputSelector, expectedValue: "" },
     },
     async function taskFn(browser) {
       let [savedLogin] = Services.logins.getAllLogins();
       let storageChangedPromise = TestUtils.topicObserved(
         "passwordmgr-storage-changed",
         (_, data) => data == "modifyLogin"
@@ -749,17 +749,17 @@ add_task(async function contextmenu_fill
   await setup_withOneLogin("olduser", "xyzpassword");
   await openFormInNewTab(
     TEST_ORIGIN + FORM_PAGE_PATH,
     {
       password: {
         selector: passwordInputSelector,
         expectedValue: "xyzpassword",
         setValue: "",
-        expectedMessage: "",
+        expectedMessage: "PasswordEditedOrGenerated",
       },
       username: {
         selector: usernameInputSelector,
         expectedValue: "olduser",
         setValue: "differentuser",
         // with an empty password value, no message is sent for a username change
         expectedMessage: "",
       },
@@ -1134,17 +1134,17 @@ add_task(async function autosaved_login_
   await setup_withOneLogin("user1", "xyzpassword");
   await openFormInNewTab(
     TEST_ORIGIN + FORM_PAGE_PATH,
     {
       password: {
         selector: passwordInputSelector,
         expectedValue: "xyzpassword",
         setValue: "",
-        expectedMessage: "",
+        expectedMessage: "PasswordEditedOrGenerated",
       },
       username: {
         selector: usernameInputSelector,
         expectedValue: "user1",
         setValue: "",
         // with an empty password value, no message is sent for a username change
         expectedMessage: "",
       },
@@ -1318,20 +1318,16 @@ add_task(async function autosaved_login_
 });
 
 add_task(async function form_change_from_autosaved_login_to_existing_login() {
   // test when changing from a generated password in a form to an existing saved login
   // * the auto-saved login should not be deleted
   // * the metadata for the matching login should be updated
   // * the by-origin cache for the password should point at the autosaved login
 
-  await SpecialPowers.pushPrefEnv({
-    set: [["signon.passwordEditCapture.enabled", true]],
-  });
-
   await setup_withOneLogin("user1", "xyzpassword");
   await openFormInNewTab(
     TEST_ORIGIN + FORM_PAGE_PATH,
     {
       password: {
         selector: passwordInputSelector,
         expectedValue: "xyzpassword",
         setValue: "",
@@ -1433,16 +1429,17 @@ add_task(async function form_change_from
       let hintDidShow = false;
       hintPromiseShown = BrowserTestUtils.waitForPopupEvent(
         confirmationHint,
         "shown"
       );
       hintPromiseShown.then(() => (hintDidShow = true));
 
       info("Entering username and password for the previously saved login");
+
       await changeContentFormValues(browser, {
         [passwordInputSelector]: user1LoginSnapshot.password,
         [usernameInputSelector]: user1LoginSnapshot.username,
       });
       info(
         "form edited, waiting for test notification of PasswordEditedOrGenerated"
       );
 
@@ -1513,10 +1510,9 @@ add_task(async function form_change_from
         autoSavedLogin.password,
         LoginManagerParent.getGeneratedPasswordsByPrincipalOrigin().get(
           "https://example.com"
         ).value,
         "Generated password cache entry has the expected password value"
       );
     }
   );
-  await SpecialPowers.popPrefEnv();
 });
--- a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_password_edits.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_password_edits.js
@@ -105,20 +105,31 @@ add_task(async function test_edit_passwo
         await formFilledPromise;
 
         // Set the form to a known state so we can expect a single PasswordEditedOrGenerated message
         await initForm(browser, {
           "#form-basic-username": testCase.usernameInPage,
           "#form-basic-password": "",
         });
 
+        let passwordEditedPromise = listenForTestNotification(
+          "PasswordEditedOrGenerated"
+        );
         info("Editing the form");
         await changeContentFormValues(browser, {
           "#form-basic-password": testCase.passwordInPage,
         });
+        info("Waiting for passwordEditedPromise");
+        await passwordEditedPromise;
+
+        // reset doorhanger/notifications, we're only interested in the submit outcome
+        await cleanupDoorhanger();
+        await cleanupPasswordNotifications();
+        // reset message cache, we're only interested in the submit outcome
+        await clearMessageCache(browser);
 
         // Submit the form in the content page with the credentials from the test
         // case. This will cause the doorhanger notification to be displayed.
         info("Submitting the form");
         let formSubmittedPromise = listenForTestNotification("FormSubmit");
         let promiseShown = BrowserTestUtils.waitForEvent(
           PopupNotifications.panel,
           "popupshown",
--- a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_username_edits.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_username_edits.js
@@ -88,19 +88,31 @@ add_task(async function test_edit_userna
           "passwordmgr/test/browser/form_basic.html",
       },
       async function(browser) {
         await formFilledPromise;
         await initForm(browser, {
           "#form-basic-username": testCase.usernameInPage,
         });
 
+        let passwordEditedPromise = listenForTestNotification(
+          "PasswordEditedOrGenerated"
+        );
+        info("Editing the form");
         await changeContentFormValues(browser, {
           "#form-basic-password": "password",
         });
+        info("Waiting for passwordEditedPromise");
+        await passwordEditedPromise;
+
+        // reset doorhanger/notifications, we're only interested in the submit outcome
+        await cleanupDoorhanger();
+        await cleanupPasswordNotifications();
+        // reset message cache, we're only interested in the submit outcome
+        await clearMessageCache(browser);
 
         // Submit the form in the content page with the credentials from the test
         // case. This will cause the doorhanger notification to be displayed.
         info("Submitting the form");
         let formSubmittedPromise = listenForTestNotification("FormSubmit");
         let promiseShown = BrowserTestUtils.waitForEvent(
           PopupNotifications.panel,
           "popupshown",