Bug 1543258 - Handle NULL 'action_url' for Chrome login import. r=sfoster
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Thu, 09 May 2019 22:59:18 +0000
changeset 532151 a42caa9f04fc41044437ac56eab6f6086c841d9f
parent 532150 3ddac071d565fb30846e19708adb4d302a487466
child 532152 5d2aa419a72c9078f3c82d21da7638d9ce8f2006
child 532153 5567ad616234db69e9c4aff10805eca281c839ab
child 532255 f71645b9b3e028458b5a4bb1c49807424e5ee924
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfoster
bugs1543258
milestone68.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 1543258 - Handle NULL 'action_url' for Chrome login import. r=sfoster Save it with the wildcard "" value so it works with any form action. Differential Revision: https://phabricator.services.mozilla.com/D30332
browser/components/migration/ChromeProfileMigrator.jsm
browser/components/migration/tests/unit/AppData/Local/Google/Chrome/User Data/Default/Login Data
browser/components/migration/tests/unit/test_Chrome_passwords.js
--- a/browser/components/migration/ChromeProfileMigrator.jsm
+++ b/browser/components/migration/ChromeProfileMigrator.jsm
@@ -375,21 +375,28 @@ async function GetWindowsPasswordsResour
             passwordElement: row.getResultByName("password_element"),
             timeCreated: ChromeMigrationUtils.chromeTimeToDate(
               row.getResultByName("date_created") + 0).getTime(),
             timesUsed: row.getResultByName("times_used") + 0,
           };
 
           switch (row.getResultByName("scheme")) {
             case AUTH_TYPE.SCHEME_HTML:
-              let action_url = NetUtil.newURI(row.getResultByName("action_url"));
-              if (!kValidSchemes.has(action_url.scheme)) {
+              let action_url = row.getResultByName("action_url");
+              if (!action_url) {
+                // If there is no action_url, store the wildcard "" value.
+                // See the `formSubmitURL` IDL comments.
+                loginInfo.formSubmitURL = "";
+                break;
+              }
+              let action_uri = NetUtil.newURI(action_url);
+              if (!kValidSchemes.has(action_uri.scheme)) {
                 continue; // This continues the outer for loop.
               }
-              loginInfo.formSubmitURL = action_url.prePath;
+              loginInfo.formSubmitURL = action_uri.prePath;
               break;
             case AUTH_TYPE.SCHEME_BASIC:
             case AUTH_TYPE.SCHEME_DIGEST:
               // signon_realm format is URIrealm, so we need remove URI
               loginInfo.httpRealm = row.getResultByName("signon_realm")
                                        .substring(loginInfo.hostname.length + 1);
               break;
             default:
index 914149c710a8c748b97543c541aaedfee74aa1f6..ac859eff6155306f5af57de81bab15fd424e6cdb
GIT binary patch
literal 24576
zc%1E93v?638lGg+Y##)vQbJm*i(Y|hn_7E>%cG<ZA{1(0v_Ls<<0jcAYc|=iyJ=}T
zqEy8LxAGFf2kPPF3sE>nJ(q`yJPvZNRS*$S<cde?feI)n*i*qfGkG*=nu_8%TyVa2
zUo-#A{Qp0b`Tm{VolsH2D;!fRN^VwRazQ*$sX#u%004%=trzHoCa?ve0>6#nz}Tll
zNB;t7$^vK?y-(9bkJ1<^i-x*{(gXxoH)ape(t5pK)igk1tpX=2tRmxGVo{~Jpvuft
z6%>}38Jxrn7A4-ndn|U*&GH^*VnJom*n&!?w5*CLtu85H$}5ZSEvT$v#+z$08IS1Y
zWQ$Goc@(C&w8}ijT$#z(dD+d&GAne=fDK5B#m>T?dLS)SZAJ#I)#vF|fcMzB8S-=i
z&IcCOr-=C4f>pER;6qYnoK`=`pptQxAVOtji_AMbqQ`%s4OmrNI@&y$i4b7QN&^YZ
zV1J55;#k3*@#rv$)*B3}dG}%$`DOfjO@xzzr2}5_NkWv1G8xvU@M1(}CgYPi$-}xi
z3ny@H4!R{er;ZhTTxYtMmF0R-vPYK)<@ie!mXsAj@A|B6UWpbCw=-H-Sr$+&ygjN*
zGQAR4%SjT~O&01yiw#z(beC%tSer}WWteHPHdv5-(L%D#2^H<8)u3%kgEy3&=@n&}
zhaF=HI!pFjt?=*^C5F_<L@a^^8S9t8s>%%>TbKwOp<aP)u%L=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INS = [
     formSubmitURL: null,
     httpRealm: "Fake Realm", // Basic auth.
     usernameField: "",
     passwordField: "",
     timeCreated: 1437787539233,
     timePasswordChanged: 1437787539233,
     timesUsed: 1,
   },
+  {
+    id: 6,
+    username: "username",
+    password: "password6",
+    hostname: "https://www.example.com",
+    formSubmitURL: "", // NULL `action_url`
+    httpRealm: null,
+    usernameField: "",
+    passwordField: "pass",
+    timeCreated: 1557291348878,
+    timePasswordChanged: 1557291348878,
+    timesUsed: 1,
+  },
 ];
 
 var crypto = new OSCrypto();
 var dbConn;
 
 function promiseSetPassword(login) {
   let passwordValue = new Uint8Array(crypto.stringToArray(crypto.encryptData(login.password)));
   return dbConn.execute(`UPDATE logins