Bug 1581903 - Use the frame origin in LMP.onFormSubmit. r=sfoster a=lizzard
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 24 Sep 2019 01:40:45 +0000
changeset 555370 22126085ed7ef535e2c16cf7637ce6c9ae64d6bf
parent 555369 c1868de79e07f9a82a7a26ca58c129531bf13c34
child 555371 03cfeb80125f67a01b424568855a6fa5682bf6ba
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfoster, lizzard
bugs1581903
milestone70.0
Bug 1581903 - Use the frame origin in LMP.onFormSubmit. r=sfoster a=lizzard Writing a test would be tedious as it involves subframes, password generation and the doorhanger and this change is trivial so I didn't make one. This code will also get rewritten to use BrowsingContexts properly to improve sandboxing shortly. Differential Revision: https://phabricator.services.mozilla.com/D46860
toolkit/components/passwordmgr/LoginManagerParent.jsm
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -592,22 +592,17 @@ this.LoginManagerParent = {
     }
 
     // Below here we have one login per hostPort + action + username with the
     // matching scheme being preferred.
     let logins = this._searchAndDedupeLogins(origin, {
       formActionOrigin,
     });
 
-    let { browsingContext } = browser;
-    let framePrincipalOrigin =
-      browsingContext.currentWindowGlobal.documentPrincipal.origin;
-    let generatedPW = this._generatedPasswordsByPrincipalOrigin.get(
-      framePrincipalOrigin
-    );
+    let generatedPW = this._generatedPasswordsByPrincipalOrigin.get(origin);
     let autoSavedStorageGUID = "";
     if (generatedPW && generatedPW.storageGUID) {
       autoSavedStorageGUID = generatedPW.storageGUID;
     }
 
     // If we didn't find a username field, but seem to be changing a
     // password, allow the user to select from a list of applicable
     // logins to update the password for.