Merge backout from fx-sync. a=mconnor
authorPhilipp von Weitershausen <philipp@weitershausen.de>
Wed, 06 Oct 2010 18:06:51 +0200
changeset 54955 d2efed071e641f261745e6a13993b45a4759aa97
parent 54952 119df91582525f8390557da26aaf070456ccbdf8 (current diff)
parent 54954 77c720c70bc4cafe97fd1cacc1b911e6687eaeb7 (diff)
child 54956 ea0dcfd46c613a78b0e0995a0ce519033545f320
push id16100
push userpweitershausen@mozilla.com
push dateWed, 06 Oct 2010 16:07:40 +0000
treeherdermozilla-central@d2efed071e64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconnor
milestone2.0b7pre
first release with
nightly mac
d2efed071e64 / 4.0b7pre / 20101006185358 / files
nightly linux32
nightly linux64
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly mac
Merge backout from fx-sync. a=mconnor
services/crypto/WeaveCrypto.js
--- a/services/crypto/WeaveCrypto.js
+++ b/services/crypto/WeaveCrypto.js
@@ -102,22 +102,44 @@ WeaveCrypto.prototype = {
     initNSS : function() {
         // We use NSS for the crypto ops, which needs to be initialized before
         // use. By convention, PSM is required to be the module that
         // initializes NSS. So, make sure PSM is initialized in order to
         // implicitly initialize NSS.
         Cc["@mozilla.org/psm;1"].getService(Ci.nsISupports);
 
         // Open the NSS library.
-        let path = ctypes.libraryName("nss3");
-
-        this.log("Using NSS library " + path);
+        let nssfile = Services.dirsvc.get("GreD", Ci.nsILocalFile);
+        let os = Services.appinfo.OS;
+        switch (os) {
+          case "WINNT":
+          case "WINMO":
+          case "WINCE":
+            nssfile.append("nss3.dll");
+            break;
+          case "Darwin":
+            nssfile.append("libnss3.dylib");
+            break;
+          case "Linux":
+          case "SunOS":
+          case "WebOS": // Palm Pre
+            nssfile.append("libnss3.so");
+            break;
+          case "Android":
+            // Android uses a $GREDIR/lib/ subdir.
+            nssfile.append("lib");
+            nssfile.append("libnss3.so");
+            break;
+          default:
+            throw Components.Exception("unsupported platform: " + os, Cr.NS_ERROR_UNEXPECTED);
+        }
+        this.log("Using NSS library " + nssfile.path);
 
         // XXX really want to be able to pass specific dlopen flags here.
-        let nsslib = ctypes.open(path);
+        let nsslib = ctypes.open(nssfile.path);
 
         this.log("Initializing NSS types and function declarations...");
 
         this.nss = {};
         this.nss_t = {};
 
         // nsprpub/pr/include/prtypes.h#435
         // typedef PRIntn PRBool; --> int