Bug 1534290 p1 - Make login item host read-only. r=nalexander a=pascalc
authorEdouard Oger <eoger@fastmail.com>
Mon, 18 Mar 2019 16:22:02 +0000
changeset 525655 521bfa11e24897365a5dbe4301afa4038aa08449
parent 525654 515db7d568340e65ab0eb5925eed4ae434b98923
child 525656 ca7498a112a57cecf230de625565c7adfad0df2e
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, pascalc
bugs1534290
milestone67.0
Bug 1534290 p1 - Make login item host read-only. r=nalexander a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D23233
mobile/android/chrome/content/aboutLogins.js
mobile/android/chrome/content/aboutLogins.xhtml
--- a/mobile/android/chrome/content/aboutLogins.js
+++ b/mobile/android/chrome/content/aboutLogins.js
@@ -270,25 +270,22 @@ var Logins = {
         updateBtn.classList.remove("disabled-btn");
       }
     });
   },
 
   _onSaveEditLogin: function() {
     let newUsername = document.getElementById("username").value;
     let newPassword = document.getElementById("password").value;
-    let newDomain  = document.getElementById("hostname").value;
     let origUsername = this._selectedLogin.username;
     let origPassword = this._selectedLogin.password;
     let origDomain = this._selectedLogin.hostname;
 
     try {
-      if ((newUsername === origUsername) &&
-          (newPassword === origPassword) &&
-          (newDomain === origDomain) ) {
+      if ((newUsername === origUsername) && (newPassword === origPassword)) {
         Snackbars.show(gStringBundle.GetStringFromName("editLogin.saved1"), Snackbars.LENGTH_LONG);
         this._showList();
         return;
       }
 
       let logins = Services.logins.findLogins({}, origDomain, origDomain, null);
 
       for (let i = 0; i < logins.length; i++) {
@@ -296,19 +293,16 @@ var Logins = {
           let propBag = Cc["@mozilla.org/hash-property-bag;1"].
             createInstance(Ci.nsIWritablePropertyBag);
           if (newUsername !== origUsername) {
             propBag.setProperty("username", newUsername);
           }
           if (newPassword !== origPassword) {
             propBag.setProperty("password", newPassword);
           }
-          if (newDomain !== origDomain) {
-            propBag.setProperty("hostname", newDomain);
-          }
           Services.logins.modifyLogin(logins[i], propBag);
           break;
         }
       }
     } catch (e) {
       Snackbars.show(gStringBundle.GetStringFromName("editLogin.couldNotSave"), Snackbars.LENGTH_LONG);
       return;
     }
--- a/mobile/android/chrome/content/aboutLogins.xhtml
+++ b/mobile/android/chrome/content/aboutLogins.xhtml
@@ -67,17 +67,17 @@
     </div>
 
     <div id="edit-login-page" class="hidden">
       <div id="edit-login-header" class="header">
         <div id="edit-login-header-text"/>
       </div>
       <div class="edit-login-div">
         <div id="favicon" class="edit-login-icon"/>
-          <input type="text" name="hostname" id="hostname" class="edit-login-input"/>
+          <input type="text" name="hostname" id="hostname" class="edit-login-input" disabled="disabled"/>
       </div>
       <div class="edit-login-div">
         <input type="text" name="username" id="username" class="edit-login-input" autocomplete="off"/>
       </div>
       <div class="edit-login-div">
         <input type="password" id="password" name="password" value="password" class="edit-login-input" />
         <button id="password-btn"></button>
       </div>