Bug 1534290 p1 - Make login item host read-only. r=nalexander
authorEdouard Oger <eoger@fastmail.com>
Mon, 18 Mar 2019 16:22:02 +0000
changeset 464890 8536a746d9cc72bb27c510a40ae7518c2e630ea2
parent 464889 f525479fabd6ff2bbd6cce61bced03824b4e2c90
child 464891 15dd5838706f24b57a2f69711625a911a850a95b
push id35727
push userdvarga@mozilla.com
push dateTue, 19 Mar 2019 09:48:59 +0000
treeherdermozilla-central@70baa37ae1eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1534290
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 1534290 p1 - Make login item host read-only. r=nalexander 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>