Backed out changeset ad4e4ea6550a (bug 1166947) for failing on own test
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 28 Jul 2016 14:36:57 +0200
changeset 332165 59488654684dc0e60ad4ef4efd561ea63d48d80a
parent 332164 18f864f24423d9d726972bdd17e63959c574fcfd
child 332166 75f7f076c3a84c8095b81ecfb208e82c5d74db32
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1166947
milestone50.0a1
backs outad4e4ea6550a47c0034608ab9fe038eca8be44d6
Backed out changeset ad4e4ea6550a (bug 1166947) for failing on own test
modules/libpref/init/all.js
toolkit/components/passwordmgr/LoginHelper.jsm
toolkit/components/passwordmgr/LoginManagerContent.jsm
toolkit/components/passwordmgr/test/browser/browser.ini
toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js
toolkit/components/passwordmgr/test/mochitest/mochitest.ini
toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation.html
toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation_negative.html
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4282,17 +4282,16 @@ pref("font.name.monospace.x-unicode", "d
 pref("signon.rememberSignons",              true);
 #ifdef NIGHTLY_BUILD
 pref("signon.rememberSignons.visibilityToggle", true);
 #else
 pref("signon.rememberSignons.visibilityToggle", false);
 #endif
 pref("signon.autofillForms",                true);
 pref("signon.autologin.proxy",              false);
-pref("signon.formlessCapture.enabled",      true);
 pref("signon.storeWhenAutocompleteOff",     true);
 pref("signon.ui.experimental",              false);
 pref("signon.debug",                        false);
 pref("signon.recipes.path",                 "chrome://passwordmgr/content/recipes.json");
 pref("signon.schemeUpgrades",               false);
 
 // Satchel (Form Manager) prefs
 pref("browser.formfill.debug",            false);
--- a/toolkit/components/passwordmgr/LoginHelper.jsm
+++ b/toolkit/components/passwordmgr/LoginHelper.jsm
@@ -30,17 +30,16 @@ Cu.import("resource://gre/modules/XPCOMU
 /**
  * Contains functions shared by different Login Manager components.
  */
 this.LoginHelper = {
   /**
    * Warning: these only update if a logger was created.
    */
   debug: Services.prefs.getBoolPref("signon.debug"),
-  formlessCaptureEnabled: Services.prefs.getBoolPref("signon.formlessCapture.enabled"),
   schemeUpgrades: Services.prefs.getBoolPref("signon.schemeUpgrades"),
 
   createLogger(aLogPrefix) {
     let getMaxLogLevel = () => {
       return this.debug ? "debug" : "warn";
     };
 
     // Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref.
@@ -49,17 +48,16 @@ this.LoginHelper = {
       maxLogLevel: getMaxLogLevel(),
       prefix: aLogPrefix,
     };
     let logger = new ConsoleAPI(consoleOptions);
 
     // Watch for pref changes and update this.debug and the maxLogLevel for created loggers
     Services.prefs.addObserver("signon.", () => {
       this.debug = Services.prefs.getBoolPref("signon.debug");
-      this.formlessCaptureEnabled = Services.prefs.getBoolPref("signon.formlessCapture.enabled");
       this.schemeUpgrades = Services.prefs.getBoolPref("signon.schemeUpgrades");
       logger.maxLogLevel = getMaxLogLevel();
     }, false);
 
     return logger;
   },
 
   /**
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -39,17 +39,16 @@ XPCOMUtils.defineLazyGetter(this, "log",
 });
 
 // These mirror signon.* prefs.
 var gEnabled, gAutofillForms, gStoreWhenAutocompleteOff;
 
 var observer = {
   QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
                                           Ci.nsIFormSubmitObserver,
-                                          Ci.nsIWebProgressListener,
                                           Ci.nsISupportsWeakReference]),
 
   // nsIFormSubmitObserver
   notify(formElement, aWindow, actionURI) {
     log("observer notified for form submission.");
 
     // We're invoked before the content's |onsubmit| handlers, so we
     // can grab form data before it might be modified (see bug 257781).
@@ -65,55 +64,16 @@ var observer = {
     return true; // Always return true, or form submit will be canceled.
   },
 
   onPrefChange() {
     gEnabled = Services.prefs.getBoolPref("signon.rememberSignons");
     gAutofillForms = Services.prefs.getBoolPref("signon.autofillForms");
     gStoreWhenAutocompleteOff = Services.prefs.getBoolPref("signon.storeWhenAutocompleteOff");
   },
-
-  // nsIWebProgressListener
-  onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
-    // Only handle pushState/replaceState here.
-    if (!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) ||
-        !(aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_PUSHSTATE)) {
-      return;
-    }
-
-    log("onLocationChange handled:", aLocation.spec, aWebProgress.DOMWindow.document);
-
-    LoginManagerContent._onNavigation(aWebProgress.DOMWindow.document);
-  },
-
-  onStateChange(aWebProgress, aRequest, aState, aStatus) {
-    if (!(aState & Ci.nsIWebProgressListener.STATE_START)) {
-      return;
-    }
-
-    // We only care about when a page triggered a load, not the user. For example:
-    // clicking refresh/back/forward, typing a URL and hitting enter, and loading a bookmark aren't
-    // likely to be when a user wants to save a login.
-    let channel = aRequest.QueryInterface(Ci.nsIChannel);
-    let triggeringPrincipal = channel.loadInfo.triggeringPrincipal;
-    if (triggeringPrincipal.isNullPrincipal ||
-        triggeringPrincipal.equals(Services.scriptSecurityManager.getSystemPrincipal())) {
-      return;
-    }
-
-    // Don't handle history navigation, reload, or pushState not triggered via chrome UI.
-    // e.g. history.go(-1), location.reload(), history.replaceState()
-    if (!(aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_NORMAL)) {
-      log("onStateChange: loadType isn't LOAD_CMD_NORMAL:", aWebProgress.loadType);
-      return;
-    }
-
-    log("onStateChange handled:", channel);
-    LoginManagerContent._onNavigation(aWebProgress.DOMWindow.document);
-  },
 };
 
 Services.obs.addObserver(observer, "earlyformsubmit", false);
 var prefBranch = Services.prefs.getBranch("signon.");
 prefBranch.addObserver("", observer.onPrefChange, false);
 
 observer.onPrefChange(); // read initial values
 
@@ -314,53 +274,32 @@ var LoginManagerContent = {
                         rect: aRect,
                         remote: remote };
 
     return this._sendRequest(messageManager, requestData,
                              "RemoteLogins:autoCompleteLogins",
                              messageData);
   },
 
-  setupProgressListener(window) {
-    if (!LoginHelper.formlessCaptureEnabled) {
-      return;
-    }
-
-    try {
-      let webProgress = window.QueryInterface(Ci.nsIInterfaceRequestor).
-                        getInterface(Ci.nsIWebNavigation).
-                        QueryInterface(Ci.nsIDocShell).
-                        QueryInterface(Ci.nsIInterfaceRequestor).
-                        getInterface(Ci.nsIWebProgress);
-      webProgress.addProgressListener(observer,
-                                      Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT |
-                                      Ci.nsIWebProgress.NOTIFY_LOCATION);
-    } catch (ex) {
-      // Ignore NS_ERROR_FAILURE if the progress listener was already added
-    }
-  },
-
   onDOMFormHasPassword(event, window) {
     if (!event.isTrusted) {
       return;
     }
 
     let form = event.target;
     let formLike = FormLikeFactory.createFromForm(form);
     log("onDOMFormHasPassword:", form, formLike);
     this._fetchLoginsFromParentAndFillForm(formLike, window);
   },
 
   onDOMInputPasswordAdded(event, window) {
     if (!event.isTrusted) {
       return;
     }
 
-    this.setupProgressListener(window);
-
     let pwField = event.target;
     if (pwField.form) {
       // Handled by onDOMFormHasPassword which is already throttled.
       return;
     }
 
     let formLike = FormLikeFactory.createFromField(pwField);
     log("onDOMInputPasswordAdded:", pwField, formLike);
@@ -372,16 +311,17 @@ var LoginManagerContent = {
 
       deferredTask = new DeferredTask(function* deferredInputProcessing() {
         // Get the updated formLike instead of the one at the time of creating the DeferredTask via
         // a closure since it could be stale since FormLike.elements isn't live.
         let formLike2 = this._formLikeByRootElement.get(formLike.rootElement);
         log("Running deferred processing of onDOMInputPasswordAdded", formLike2);
         this._deferredPasswordAddedTasksByRootElement.delete(formLike2.rootElement);
         this._fetchLoginsFromParentAndFillForm(formLike2, window);
+        this._formLikeByRootElement.delete(formLike.rootElement);
       }.bind(this), PASSWORD_INPUT_ADDED_COALESCING_THRESHOLD_MS);
 
       this._deferredPasswordAddedTasksByRootElement.set(formLike.rootElement, deferredTask);
     }
 
     if (deferredTask.isArmed) {
       log("DeferredTask is already armed so just updating the FormLike");
       // We update the FormLike so it (most important .elements) is fresh when the task eventually
@@ -403,16 +343,19 @@ var LoginManagerContent = {
 
   /**
    * Fetch logins from the parent for a given form and then attempt to fill it.
    *
    * @param {FormLike} form to fetch the logins for then try autofill.
    * @param {Window} window
    */
   _fetchLoginsFromParentAndFillForm(form, window) {
+    // Always record the most recently added form with a password field.
+    this.stateForDocument(form.ownerDocument).loginForm = form;
+
     this._updateLoginFormPresence(window);
 
     let messageManager = messageManagerFromWindow(window);
     messageManager.sendAsyncMessage("LoginStats:LoginEncountered");
 
     if (!gEnabled) {
       return;
     }
@@ -429,48 +372,45 @@ var LoginManagerContent = {
   /**
    * Maps all DOM content documents in this content process, including those in
    * frames, to the current state used by the Login Manager.
    */
   loginFormStateByDocument: new WeakMap(),
 
   /**
    * Retrieves a reference to the state object associated with the given
-   * document. This is initialized to an object with default values.
+   * document. This is initialized to an empty object.
    */
   stateForDocument(document) {
     let loginFormState = this.loginFormStateByDocument.get(document);
     if (!loginFormState) {
-      loginFormState = {
-        loginFormRootElements: new Set(),
-      };
+      loginFormState = {};
       this.loginFormStateByDocument.set(document, loginFormState);
     }
     return loginFormState;
   },
 
   /**
    * Compute whether there is a login form on any frame of the current page, and
    * notify the parent process. This is one of the factors used to control the
    * visibility of the password fill doorhanger anchor.
    */
   _updateLoginFormPresence(topWindow) {
-    log("_updateLoginFormPresence", topWindow.location.href);
     // For the login form presence notification, we currently support only one
     // origin for each browser, so the form origin will always match the origin
     // of the top level document.
     let loginFormOrigin =
         LoginUtils._getPasswordOrigin(topWindow.document.documentURI);
 
     // Returns the first known loginForm present in this window or in any
     // same-origin subframes. Returns null if no loginForm is currently present.
     let getFirstLoginForm = thisWindow => {
-      let loginForms = this.stateForDocument(thisWindow.document).loginFormRootElements;
-      if (loginForms.size) {
-        return [...loginForms][0];
+      let loginForm = this.stateForDocument(thisWindow.document).loginForm;
+      if (loginForm) {
+        return loginForm;
       }
       for (let i = 0; i < thisWindow.frames.length; i++) {
         let frame = thisWindow.frames[i];
         if (LoginUtils._getPasswordOrigin(frame.document.documentURI) !=
             loginFormOrigin) {
           continue;
         }
         let loginForm = getFirstLoginForm(frame);
@@ -480,26 +420,25 @@ var LoginManagerContent = {
       }
       return null;
     };
 
     // Returns true if this window or any subframes have insecure login forms.
     let hasInsecureLoginForms = (thisWindow, parentIsInsecure) => {
       let doc = thisWindow.document;
       let isInsecure = parentIsInsecure || !this.isDocumentSecure(doc);
-      let hasLoginForm = this.stateForDocument(doc).loginFormRootElements.size > 0;
+      let hasLoginForm = !!this.stateForDocument(doc).loginForm;
       return (hasLoginForm && isInsecure) ||
              Array.some(thisWindow.frames,
                         frame => hasInsecureLoginForms(frame, isInsecure));
     };
 
     // Store the actual form to use on the state for the top-level document.
     let topState = this.stateForDocument(topWindow.document);
     topState.loginFormForFill = getFirstLoginForm(topWindow);
-    log("_updateLoginFormPresence: topState.loginFormForFill", topState.loginFormForFill);
 
     // Determine whether to show the anchor icon for the current tab.
     let messageManager = messageManagerFromWindow(topWindow);
     messageManager.sendAsyncMessage("RemoteLogins:updateLoginFormPresence", {
       loginFormOrigin,
       loginFormPresent: !!topState.loginFormForFill,
       hasInsecureLoginForms: hasInsecureLoginForms(topWindow, false),
     });
@@ -795,74 +734,39 @@ var LoginManagerContent = {
       } else {
         // Just assume that the 2nd password is the new password
         oldPasswordField = pwFields[0].element;
         newPasswordField = pwFields[1].element;
       }
     }
 
     log("Password field (new) id/name is: ", newPasswordField.id, " / ", newPasswordField.name);
-    if (oldPasswordField) {
+    if (oldPasswordField)
       log("Password field (old) id/name is: ", oldPasswordField.id, " / ", oldPasswordField.name);
-    } else {
-      log("Password field (old):", oldPasswordField);
-    }
     return [usernameField, newPasswordField, oldPasswordField];
   },
 
 
   /**
    * @return true if the page requests autocomplete be disabled for the
    *              specified element.
    */
   _isAutocompleteDisabled(element) {
     return element && element.autocomplete == "off";
   },
 
   /**
-   * Trigger capture on any relevant FormLikes due to a navigation alone (not
-   * necessarily due to an actual form submission). This method is used to
-   * capture logins for cases where form submit events are not used.
-   *
-   * To avoid multiple notifications for the same FormLike, this currently
-   * avoids capturing when dealing with a real <form> which are ideally already
-   * using a submit event.
-   *
-   * @param {Document} document being navigated
-   */
-  _onNavigation(aDocument) {
-    let state = this.stateForDocument(aDocument);
-    let loginFormRootElements = state.loginFormRootElements;
-    log("_onNavigation: state:", state, "loginFormRootElements size:", loginFormRootElements.size,
-        "document:", aDocument);
-
-    for (let formRoot of state.loginFormRootElements) {
-      if (formRoot instanceof Ci.nsIDOMHTMLFormElement) {
-        // For now only perform capture upon navigation for FormLike's without
-        // a <form> to avoid capture from both an earlyformsubmit and
-        // navigation for the same "form".
-        log("Ignoring navigation for the form root to avoid multiple prompts " +
-            "since it was for a real <form>");
-        continue;
-      }
-      let formLike = this._formLikeByRootElement.get(formRoot);
-      this._onFormSubmit(formLike);
-    }
-  },
-
-  /**
    * Called by our observer when notified of a form submission.
    * [Note that this happens before any DOM onsubmit handlers are invoked.]
    * Looks for a password change in the submitted form, so we can update
    * our stored password.
    *
    * @param {FormLike} form
    */
   _onFormSubmit(form) {
-    log("_onFormSubmit", form);
     var doc = form.ownerDocument;
     var win = doc.defaultView;
 
     if (PrivateBrowsingUtils.isContentWindowPrivate(win)) {
       // We won't do anything in private browsing mode anyway,
       // so there's no need to perform further checks.
       log("(form submission ignored in private browsing mode)");
       return;
@@ -947,17 +851,16 @@ var LoginManagerContent = {
    *                             the user
    * @param {nsILoginInfo[]} foundLogins is an array of nsILoginInfo that could be used for the form
    * @param {Set} recipes that could be used to affect how the form is filled
    * @param {Object} [options = {}] is a list of options for this method.
             - [inputElement] is an optional target input element we want to fill
    */
   _fillForm(form, autofillForm, clobberUsername, clobberPassword,
                         userTriggered, foundLogins, recipes, {inputElement} = {}) {
-    log("_fillForm", form.elements);
     let ignoreAutocomplete = true;
     const AUTOFILL_RESULT = {
       FILLED: 0,
       NO_PASSWORD_FIELD: 1,
       PASSWORD_DISABLED_READONLY: 2,
       NO_LOGINS_FIT: 3,
       NO_SAVED_LOGINS: 4,
       EXISTING_PASSWORD: 5,
@@ -1255,17 +1158,16 @@ var LoginUtils = {
   _getPasswordOrigin(uriString, allowJS) {
     var realm = "";
     try {
       var uri = Services.io.newURI(uriString, null, null);
 
       if (allowJS && uri.scheme == "javascript")
         return "javascript:";
 
-      // Build this manually instead of using prePath to avoid including the userPass portion.
       realm = uri.scheme + "://" + uri.hostPort;
     } catch (e) {
       // bug 159484 - disallow url types that don't support a hostPort.
       // (although we handle "javascript:..." as a special case above.)
       log("Couldn't parse origin for", uriString, e);
       realm = null;
     }
 
@@ -1406,22 +1308,16 @@ var FormLikeFactory = {
       rootElement: aForm,
     };
 
     for (let prop of this._propsFromForm) {
       formLike[prop] = aForm[prop];
     }
 
     this._addToJSONProperty(formLike);
-
-    let state = LoginManagerContent.stateForDocument(formLike.ownerDocument);
-    state.loginFormRootElements.add(formLike.rootElement);
-    log("adding", formLike.rootElement, "to loginFormRootElements for", formLike.ownerDocument);
-
-    LoginManagerContent._formLikeByRootElement.set(formLike.rootElement, formLike);
     return formLike;
   },
 
   /**
    * Create a FormLike object from a password or username field.
    *
    * If the field is in a <form>, construct the FormLike from the form.
    * Otherwise, create a FormLike with a rootElement (wrapper) according to
@@ -1460,23 +1356,16 @@ var FormLikeFactory = {
       autocomplete: "on",
       // Exclude elements inside the rootElement that are already in a <form> as
       // they will be handled by their own FormLike.
       elements,
       ownerDocument: doc,
       rootElement: doc.documentElement,
     };
 
-    let state = LoginManagerContent.stateForDocument(formLike.ownerDocument);
-    state.loginFormRootElements.add(formLike.rootElement);
-    log("adding", formLike.rootElement, "to loginFormRootElements for", formLike.ownerDocument);
-
-
-    LoginManagerContent._formLikeByRootElement.set(formLike.rootElement, formLike);
-
     this._addToJSONProperty(formLike);
     return formLike;
   },
 
   /**
    * Add a `toJSON` property to a FormLike so logging which ends up going
    * through dump doesn't include usless garbage from DOM objects.
    */
--- a/toolkit/components/passwordmgr/test/browser/browser.ini
+++ b/toolkit/components/passwordmgr/test/browser/browser.ini
@@ -35,17 +35,16 @@ support-files =
   subtst_notifications_11.html
   subtst_notifications_11_popup.html
 [browser_username_select_dialog.js]
 support-files =
   subtst_notifications_change_p.html
 [browser_DOMFormHasPassword.js]
 [browser_DOMInputPasswordAdded.js]
 [browser_filldoorhanger.js]
-[browser_formless_submit_chrome.js]
 [browser_hasInsecureLoginForms.js]
 [browser_hasInsecureLoginForms_streamConverter.js]
 [browser_insecurePasswordWarning.js]
 [browser_notifications.js]
 [browser_notifications_2.js]
 [browser_passwordmgr_editing.js]
 skip-if = os == "linux"
 [browser_context_menu.js]
deleted file mode 100644
--- a/toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Test that browser chrome UI interactions don't trigger a capture doorhanger.
- */
-
-"use strict";
-
-function* fillTestPage(aBrowser) {
-  yield ContentTask.spawn(aBrowser, null, function*() {
-    content.document.getElementById("form-basic-username").value = "my_username";
-    content.document.getElementById("form-basic-password").value = "my_password";
-  });
-  info("fields filled");
-}
-
-function* withTestPage(aTaskFn) {
-  return BrowserTestUtils.withNewTab({
-    gBrowser,
-    url: "https://example.com" + DIRECTORY_PATH + "formless_basic.html",
-  }, function*(aBrowser) {
-    info("tab opened");
-    yield fillTestPage(aBrowser);
-    yield* aTaskFn(aBrowser);
-
-    // Give a chance for the doorhanger to appear
-    yield new Promise(resolve => SimpleTest.executeSoon(resolve));
-    ok(!getCaptureDoorhanger("any"), "No doorhanger should be present");
-  });
-}
-
-add_task(function* setup() {
-  yield SimpleTest.promiseFocus(window);
-});
-
-add_task(function* test_urlbar_new_URL() {
-  yield withTestPage(function*(aBrowser) {
-    gURLBar.value = "";
-    let focusPromise = BrowserTestUtils.waitForEvent(gURLBar, "focus");
-    gURLBar.focus();
-    yield focusPromise;
-    info("focused");
-    EventUtils.sendString("http://mochi.test:8888/");
-    EventUtils.synthesizeKey("VK_RETURN", {});
-    yield BrowserTestUtils.browserLoaded(aBrowser, false, "http://mochi.test:8888/");
-  });
-});
-
-add_task(function* test_urlbar_fragment_enter() {
-  yield withTestPage(function*(aBrowser) {
-    gURLBar.focus();
-    EventUtils.synthesizeKey("VK_RIGHT", {});
-    EventUtils.sendString("#fragment");
-    EventUtils.synthesizeKey("VK_RETURN", {});
-  });
-});
-
-add_task(function* test_backButton_forwardButton() {
-  yield withTestPage(function*(aBrowser) {
-    // Load a new page in the tab so we can test going back
-    aBrowser.loadURI("https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
-    yield BrowserTestUtils.browserLoaded(aBrowser, false,
-                                         "https://example.com" + DIRECTORY_PATH +
-                                         "formless_basic.html?second");
-    yield fillTestPage(aBrowser);
-
-    let backPromise = BrowserTestUtils.browserStopped(aBrowser);
-    EventUtils.synthesizeMouseAtCenter(document.getElementById("back-button"), {});
-    yield backPromise;
-
-    // Give a chance for the doorhanger to appear
-    yield new Promise(resolve => SimpleTest.executeSoon(resolve));
-    ok(!getCaptureDoorhanger("any"), "No doorhanger should be present");
-
-    // Now go forward again after filling
-    yield fillTestPage(aBrowser);
-
-    let forwardButton = document.getElementById("forward-button");
-    yield BrowserTestUtils.waitForEvent(forwardButton, "transitionend");
-    info("transition done");
-    yield BrowserTestUtils.waitForCondition(() => {
-      return forwardButton.disabled == false;
-    });
-    let forwardPromise = BrowserTestUtils.browserStopped(aBrowser);
-    info("click the forward button");
-    EventUtils.synthesizeMouseAtCenter(forwardButton, {});
-    yield forwardPromise;
-  });
-});
-
-
-add_task(function* test_reloadButton() {
-  yield withTestPage(function*(aBrowser) {
-    let reloadButton = document.getElementById("urlbar-reload-button");
-    let loadPromise = BrowserTestUtils.browserLoaded(aBrowser, false,
-                                                     "https://example.com" + DIRECTORY_PATH +
-                                                     "formless_basic.html");
-
-    yield BrowserTestUtils.waitForCondition(() => {
-      return reloadButton.disabled == false;
-    });
-    EventUtils.synthesizeMouseAtCenter(reloadButton, {});
-    yield loadPromise;
-  });
-});
-
-add_task(function* test_back_keyboard_shortcut() {
-  if (Services.prefs.getIntPref("browser.backspace_action") != 0) {
-    ok(true, "Skipped testing backspace to go back since it's disabled");
-    return;
-  }
-  yield withTestPage(function*(aBrowser) {
-    // Load a new page in the tab so we can test going back
-    aBrowser.loadURI("https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
-    yield BrowserTestUtils.browserLoaded(aBrowser, false,
-                                         "https://example.com" + DIRECTORY_PATH +
-                                         "formless_basic.html?second");
-    yield fillTestPage(aBrowser);
-
-    let backPromise = BrowserTestUtils.browserStopped(aBrowser);
-    EventUtils.synthesizeKey("VK_BACK_SPACE", {});
-    yield backPromise;
-  });
-});
--- a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini
+++ b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini
@@ -1,17 +1,16 @@
 [DEFAULT]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g'
 support-files =
   ../../../prompts/test/chromeScript.js
   ../../../prompts/test/prompt_common.js
   ../../../satchel/test/parent_utils.js
   ../../../satchel/test/satchel_common.js
   ../authenticate.sjs
-  ../blank.html
   ../browser/form_basic.html
   ../browser/form_cross_origin_secure_action.html
   ../notification_common.js
   ../pwmgr_common.js
   auth2/authenticate.sjs
 
 [test_autocomplete_https_upgrade.html]
 skip-if = toolkit == 'android' # autocomplete
@@ -37,18 +36,16 @@ skip-if = toolkit == 'android' # Tests d
 skip-if = toolkit == 'android' # autocomplete
 [test_form_action_1.html]
 [test_form_action_2.html]
 [test_form_action_javascript.html]
 [test_formless_autofill.html]
 skip-if = toolkit == 'android' # Bug 1259768
 [test_formless_submit.html]
 skip-if = toolkit == 'android' # Bug 1259768
-[test_formless_submit_navigation.html]
-[test_formless_submit_navigation_negative.html]
 [test_input_events.html]
 [test_input_events_for_identical_values.html]
 [test_maxlength.html]
 [test_passwords_in_type_password.html]
 [test_prompt.html]
 skip-if = e10s || os == "linux" || toolkit == 'android' # Tests desktop prompts
 [test_recipe_login_fields.html]
 [test_xhr_2.html]
deleted file mode 100644
--- a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation.html
+++ /dev/null
@@ -1,191 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test capturing of fields outside of a form due to navigation</title>
-  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script src="/tests/SimpleTest/SpawnTask.js"></script>
-  <script src="pwmgr_common.js"></script>
-  <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<script type="application/javascript;version=1.8">
-const LMCBackstagePass = SpecialPowers.Cu.import("resource://gre/modules/LoginManagerContent.jsm");
-const { LoginManagerContent, FormLikeFactory } = LMCBackstagePass;
-
-let chromeScript = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
-
-let loadPromise = new Promise(resolve => {
-  document.addEventListener("DOMContentLoaded", () => {
-    document.getElementById("loginFrame").addEventListener("load", (evt) => {
-      resolve();
-    });
-  });
-});
-
-add_task(function* setup() {
-  yield SpecialPowers.pushPrefEnv({
-    set: [
-      ["signon.formlessCapture.enabled", true],
-    ],
-  });
-
-  info("Waiting for page and frame loads");
-  yield loadPromise;
-
-  yield loadRecipes({
-    siteRecipes: [{
-      hosts: ["test1.mochi.test:8888"],
-      usernameSelector: "input[name='recipeuname']",
-      passwordSelector: "input[name='recipepword']",
-    }],
-  });
-});
-
-const DEFAULT_ORIGIN = "http://test1.mochi.test:8888";
-const SCRIPTS = {
-  PUSHSTATE: `history.pushState({}, "Pushed state", "?pushed");`,
-  WINDOW_LOCATION: `window.location = "data:text/html;charset=utf-8,window.location";`,
-};
-const TESTCASES = [
-  {
-    // Inputs
-    document: `<input type=password value="pass1">`,
-
-    // Expected outputs similar to RemoteLogins:onFormSubmit
-    hostname: DEFAULT_ORIGIN,
-    formSubmitURL: DEFAULT_ORIGIN,
-    usernameFieldValue: null,
-    newPasswordFieldValue: "pass1",
-    oldPasswordFieldValue: null,
-  },
-  {
-    document: `<input value="user1">
-      <input type=password value="pass1">`,
-
-    hostname: DEFAULT_ORIGIN,
-    formSubmitURL: DEFAULT_ORIGIN,
-    usernameFieldValue: "user1",
-    newPasswordFieldValue: "pass1",
-    oldPasswordFieldValue: null,
-  },
-  {
-    document: `<input value="user1">
-      <input type=password value="pass1">
-      <input type=password value="pass2">`,
-
-    hostname: DEFAULT_ORIGIN,
-    formSubmitURL: DEFAULT_ORIGIN,
-    usernameFieldValue: "user1",
-    newPasswordFieldValue: "pass2",
-    oldPasswordFieldValue: "pass1",
-  },
-  {
-    document: `<input value="user1">
-      <input type=password value="pass1">
-      <input type=password value="pass2">
-      <input type=password value="pass2">`,
-
-    hostname: DEFAULT_ORIGIN,
-    formSubmitURL: DEFAULT_ORIGIN,
-    usernameFieldValue: "user1",
-    newPasswordFieldValue: "pass2",
-    oldPasswordFieldValue: "pass1",
-  },
-  {
-    document: `<input value="user1">
-      <input type=password value="user2" form="form1">
-      <input type=password value="pass1">
-      <form id="form1">
-        <input value="user3">
-        <input type=password value="pass2">
-      </form>`,
-
-    hostname: DEFAULT_ORIGIN,
-    formSubmitURL: DEFAULT_ORIGIN,
-    usernameFieldValue: "user1",
-    newPasswordFieldValue: "pass1",
-    oldPasswordFieldValue: null,
-  },
-  {
-    document: `<!-- recipe field override -->
-      <input name="recipeuname" value="username from recipe">
-      <input value="default field username">
-      <input type=password value="pass1">
-      <input name="recipepword" type=password value="pass2">`,
-
-    hostname: DEFAULT_ORIGIN,
-    formSubmitURL: DEFAULT_ORIGIN,
-    usernameFieldValue: "username from recipe",
-    newPasswordFieldValue: "pass2",
-    oldPasswordFieldValue: null,
-  },
-];
-
-function getSubmitMessage() {
-  info("getSubmitMessage");
-  return new Promise((resolve, reject) => {
-    chromeScript.addMessageListener("formSubmissionProcessed", function processed(...args) {
-      info("got formSubmissionProcessed");
-      chromeScript.removeMessageListener("formSubmissionProcessed", processed);
-      resolve(...args);
-    });
-  });
-}
-
-add_task(function* test() {
-  let loginFrame = document.getElementById("loginFrame");
-
-  for (let tc of TESTCASES) {
-    for (let scriptName of Object.keys(SCRIPTS)) {
-      info("Starting testcase with script " + scriptName + ": " + JSON.stringify(tc));
-      let loadedPromise = new Promise((resolve) => {
-        loginFrame.addEventListener("load", function frameLoaded() {
-          loginFrame.removeEventListener("load", frameLoaded);
-          resolve();
-        });
-      });
-      loginFrame.src = DEFAULT_ORIGIN + "/tests/toolkit/components/passwordmgr/test/mochitest/blank.html";
-      yield loadedPromise;
-
-      let frameDoc = SpecialPowers.wrap(loginFrame.contentWindow).document;
-      frameDoc.documentElement.innerHTML = tc.document;
-      // Wait for the form to be processed before trying to submit.
-      yield promiseFormsProcessed();
-      let processedPromise = getSubmitMessage();
-      info("Running " + scriptName + " script to cause a submission");
-      frameDoc.defaultView.eval(SCRIPTS[scriptName]);
-
-      let submittedResult = yield processedPromise;
-
-      // Check data sent via RemoteLogins:onFormSubmit
-      is(submittedResult.hostname, tc.hostname, "Check hostname");
-      is(submittedResult.formSubmitURL, tc.formSubmitURL, "Check formSubmitURL");
-
-      if (tc.usernameFieldValue === null) {
-        is(submittedResult.usernameField, tc.usernameFieldValue, "Check usernameField");
-      } else {
-        is(submittedResult.usernameField.value, tc.usernameFieldValue, "Check usernameField");
-      }
-
-      is(submittedResult.newPasswordField.value, tc.newPasswordFieldValue, "Check newPasswordFieldValue");
-
-      if (tc.oldPasswordFieldValue === null) {
-        is(submittedResult.oldPasswordField, tc.oldPasswordFieldValue, "Check oldPasswordFieldValue");
-      } else {
-        is(submittedResult.oldPasswordField.value, tc.oldPasswordFieldValue, "Check oldPasswordFieldValue");
-      }
-    }
-  }
-});
-
-</script>
-
-<p id="display"></p>
-
-<div id="content">
-  <iframe id="loginFrame" src="http://test1.mochi.test:8888/tests/toolkit/components/passwordmgr/test/mochitest/blank.html"></iframe>
-</div>
-<pre id="test"></pre>
-</body>
-</html>
deleted file mode 100644
--- a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation_negative.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test no capturing of fields outside of a form due to navigation</title>
-  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script src="/tests/SimpleTest/SpawnTask.js"></script>
-  <script src="pwmgr_common.js"></script>
-  <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<script type="application/javascript;version=1.8">
-const LMCBackstagePass = SpecialPowers.Cu.import("resource://gre/modules/LoginManagerContent.jsm");
-const { LoginManagerContent, FormLikeFactory } = LMCBackstagePass;
-
-SimpleTest.requestFlakyTimeout("Testing that a message doesn't arrive");
-
-let chromeScript = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
-
-let loadPromise = new Promise(resolve => {
-  document.addEventListener("DOMContentLoaded", () => {
-    document.getElementById("loginFrame").addEventListener("load", (evt) => {
-      resolve();
-    });
-  });
-});
-
-function submissionProcessed(...args) {
-  ok(false, "No formSubmissionProcessed should occur in this test");
-  info("got: " + JSON.stringify(args));
-}
-
-add_task(function* setup() {
-  yield SpecialPowers.pushPrefEnv({
-    set: [
-      ["signon.formlessCapture.enabled", true],
-    ],
-  });
-
-  info("Waiting for page and frame loads");
-  yield loadPromise;
-
-  chromeScript.addMessageListener("formSubmissionProcessed", submissionProcessed);
-
-  SimpleTest.registerCleanupFunction(() => {
-    chromeScript.removeMessageListener("formSubmissionProcessed", submissionProcessed);
-  });
-});
-
-const DEFAULT_ORIGIN = "http://test1.mochi.test:8888";
-const SCRIPTS = {
-  PUSHSTATE: `history.pushState({}, "Pushed state", "?pushed");`,
-  WINDOW_LOCATION: `window.location = "data:text/html;charset=utf-8,window.location";`,
-  WINDOW_LOCATION_RELOAD: `window.location.reload();`,
-  HISTORY_BACK: `history.back();`,
-  HISTORY_GO_MINUS1: `history.go(-1);`,
-};
-const TESTCASES = [
-  // Begin test cases that shouldn't trigger capture.
-  {
-    // For now we don't trigger upon navigation if <form> is used.
-    document: `<form><input type=password value="pass1"></form>`,
-  },
-  {
-    // Empty password field
-    document: `<input type=password value="">`,
-  },
-  {
-    // Test with an input that would normally be captured but with SCRIPTS that
-    // shouldn't trigger capture.
-    document: `<input type=password value="pass2">`,
-    wouldCapture: true,
-  },
-];
-
-add_task(function* test() {
-  let loginFrame = document.getElementById("loginFrame");
-
-  for (let tc of TESTCASES) {
-    for (let scriptName of Object.keys(SCRIPTS)) {
-      if (tc.wouldCapture && ["PUSHSTATE", "WINDOW_LOCATION"].includes(scriptName)) {
-        // Don't run scripts that should actually capture for this testcase.
-        continue;
-      }
-
-      info("Starting testcase with script " + scriptName + ": " + JSON.stringify(tc));
-      let loadedPromise = new Promise((resolve) => {
-        loginFrame.addEventListener("load", function frameLoaded() {
-          loginFrame.removeEventListener("load", frameLoaded);
-          resolve();
-        });
-      });
-      loginFrame.src = DEFAULT_ORIGIN + "/tests/toolkit/components/passwordmgr/test/mochitest/blank.html";
-      yield loadedPromise;
-
-      let frameDoc = SpecialPowers.wrap(loginFrame.contentWindow).document;
-      frameDoc.documentElement.innerHTML = tc.document;
-
-      // Wait for the form to be processed before trying to submit.
-      yield promiseFormsProcessed();
-
-      info("Running " + scriptName + " script to check for a submission");
-      frameDoc.defaultView.eval(SCRIPTS[scriptName]);
-
-      // Wait for 500ms to see if the promise above resolves.
-      yield new Promise(resolve => setTimeout(resolve, 500));
-      ok(true, "Done waiting for captures");
-    }
-  }
-});
-
-</script>
-
-<p id="display"></p>
-
-<div id="content">
-  <iframe id="loginFrame" src="http://test1.mochi.test:8888/tests/toolkit/components/passwordmgr/test/mochitest/blank.html"></iframe>
-</div>
-<pre id="test"></pre>
-</body>
-</html>