Fix JNI login manager. draft
authorNick Alexander <nalexander@mozilla.com>
Thu, 01 Jun 2017 15:49:54 -0700
changeset 589167 f4778846541f3fd56377994a904291f77c1feb80
parent 589166 168311314236a48d4de197b026b18583b312d7a7
child 589168 f18ddbad3abb5348b7f557f4c0b334a72428e701
push id62262
push usernalexander@mozilla.com
push dateMon, 05 Jun 2017 18:25:07 +0000
milestone55.0a1
Fix JNI login manager. MozReview-Commit-ID: 9q1kUWIGHsP
mobile/android/base/AppConstants.java.in
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/passwordmgr/storage-fennecStorage.js
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -315,14 +315,14 @@ public class AppConstants {
     public static final boolean MOZ_ANDROID_ACTIVITY_STREAM =
 //#ifdef MOZ_ANDROID_ACTIVITY_STREAM
         true;
 //#else
         false;
 //#endif
 
     public static final boolean MOZ_ANDROID_LOGINS_STORAGE_USE =
-//#ifdef MOZ_ANDROID_LOGINS_STORAGE_USE
+// #ifdef MOZ_ANDROID_LOGINS_STORAGE_USE
     true;
-//#else
-    false;
-//#endif
+// #else
+//    false;
+// #endif
 }
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -107,17 +107,17 @@ LoginManager.prototype = {
 
     Services.obs.addObserver(this._observer, "gather-telemetry");
   },
 
 
   _initStorage() {
     let contractID;
     if (AppConstants.platform == "android") {
-      contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
+      contractID = "@mozilla.org/login-manager/storage/fennecStorage;1";
     } else {
       contractID = "@mozilla.org/login-manager/storage/json;1";
     }
     try {
       let catMan = Cc["@mozilla.org/categorymanager;1"].
                    getService(Ci.nsICategoryManager);
       contractID = catMan.getCategoryEntry("login-manager-storage",
                                            "nsILoginManagerStorage");
--- a/toolkit/components/passwordmgr/storage-fennecStorage.js
+++ b/toolkit/components/passwordmgr/storage-fennecStorage.js
@@ -34,17 +34,17 @@ LoginManagerStorage_fennecStorage.protot
     return this.__uuidService;
   },
 
 
   // Common Java Class signatures.
   _SIG: {
     ContentValues: 'Landroid/content/ContentValues;',
     Cursor: 'Landroid/database/Cursor;',
-    GeckoAppShell: 'Lorg/mozilla/gecko/GeckoAppShell;',
+    BrowserApp: 'Lorg/mozilla/gecko/BrowserApp;',
     LoginsAccessor: 'Lorg/mozilla/gecko/db/LoginsAccessor;',
     String: 'Ljava/lang/String;',
     NULL: new ctypes.voidptr_t(null)
   },
 
 
   /*
    * initialize
@@ -475,23 +475,23 @@ LoginManagerStorage_fennecStorage.protot
         { name: 'removeLogin', sig: '(J)V' },
         { name: 'modifyLogin', sig: '(J'+ this._SIG.ContentValues + ')V' },
         { name: 'removeAllLogins', sig: '()V' },
         { name: 'getLoginsSavedEnabled', sig: '(' + this._SIG.String + ')' + this._SIG.Cursor },
         { name: 'setLoginSavingEnabled', sig: '(' + this._SIG.String + 'Z)V' },
       ]
     });
 
-    var geckoAppShell = JNI.LoadClass(my_jenv, this._SIG.GeckoAppShell.substr(1, this._SIG.GeckoAppShell.length - 2), {
+    var browserApp = JNI.LoadClass(my_jenv, this._SIG.BrowserApp.substr(1, this._SIG.BrowserApp.length - 2), {
       static_methods: [
         { name: 'getLoginsAccessor', sig: '()' + this._SIG.LoginsAccessor }
       ]
     });
 
-    return geckoAppShell.getLoginsAccessor();
+    return browserApp.getLoginsAccessor();
   },
 
 
   _populateContentValues : function(my_jenv, loginClone) {
       if (!my_jenv) {
         throw new Error('my_jenv pointer is undefined');
       }
 
@@ -582,16 +582,20 @@ LoginManagerStorage_fennecStorage.protot
         case "timesUsed":
           if (value) {
             selectionQuery.push(field + " = ?");
             selectionParams.push(value);
           } else {
             selectionQuery.push(field + " is null");
           }
           break;
+      case "schemeUpgrades":
+        // Not yet handled.
+        break;
+
         // Fail if caller requests an unknown property.
         default:
           throw new Error("Unexpected field: " + field);
       }
     }
 
     return this._waitForSync(new Promise((resolve, reject) => {
       var my_jenv;
@@ -818,9 +822,9 @@ LoginManagerStorage_fennecStorage.protot
 }; // end of nsLoginManagerStorage_fennecStorage implementation
 
 XPCOMUtils.defineLazyGetter(this.LoginManagerStorage_fennecStorage.prototype, "log", () => {
   let logger = LoginHelper.createLogger("Login storage");
   return logger.log.bind(logger);
 });
 
 var component = [LoginManagerStorage_fennecStorage];
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component);
\ No newline at end of file
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component);