139
|
1 |
# HG changeset patch
|
|
2 |
# Parent 1e4f0a7028202f758195452878b0299a587a4b4e
|
|
3 |
Bug 583209 - Weave fails to load if system libnss3.so is in use (OpenSolaris, Linux dists)
|
|
4 |
https://bugzilla.mozilla.org/show_bug.cgi?id=583209
|
|
5 |
|
|
6 |
diff --git a/services/crypto/WeaveCrypto.js b/services/crypto/WeaveCrypto.js
|
|
7 |
--- a/services/crypto/WeaveCrypto.js
|
|
8 |
+++ b/services/crypto/WeaveCrypto.js
|
|
9 |
@@ -102,44 +102,23 @@ WeaveCrypto.prototype = {
|
|
10 |
initNSS : function() {
|
|
11 |
// We use NSS for the crypto ops, which needs to be initialized before
|
|
12 |
// use. By convention, PSM is required to be the module that
|
|
13 |
// initializes NSS. So, make sure PSM is initialized in order to
|
|
14 |
// implicitly initialize NSS.
|
|
15 |
Cc["@mozilla.org/psm;1"].getService(Ci.nsISupports);
|
|
16 |
|
|
17 |
// Open the NSS library.
|
|
18 |
- let nssfile = Services.dirsvc.get("GreD", Ci.nsILocalFile);
|
|
19 |
let os = Services.appinfo.OS;
|
|
20 |
- switch (os) {
|
|
21 |
- case "WINNT":
|
|
22 |
- case "WINMO":
|
|
23 |
- case "WINCE":
|
|
24 |
- nssfile.append("nss3.dll");
|
|
25 |
- break;
|
|
26 |
- case "Darwin":
|
|
27 |
- nssfile.append("libnss3.dylib");
|
|
28 |
- break;
|
|
29 |
- case "Linux":
|
|
30 |
- case "SunOS":
|
|
31 |
- case "WebOS": // Palm Pre
|
|
32 |
- nssfile.append("libnss3.so");
|
|
33 |
- break;
|
|
34 |
- case "Android":
|
|
35 |
- // Android uses a $GREDIR/lib/ subdir.
|
|
36 |
- nssfile.append("lib");
|
|
37 |
- nssfile.append("libnss3.so");
|
|
38 |
- break;
|
|
39 |
- default:
|
|
40 |
- throw Components.Exception("unsupported platform: " + os, Cr.NS_ERROR_UNEXPECTED);
|
|
41 |
- }
|
|
42 |
- this.log("Using NSS library " + nssfile.path);
|
|
43 |
+ let path = ctypes.libraryName("nss3");
|
|
44 |
+
|
|
45 |
+ this.log("Using NSS library " + path);
|
|
46 |
|
|
47 |
// XXX really want to be able to pass specific dlopen flags here.
|
|
48 |
- let nsslib = ctypes.open(nssfile.path);
|
|
49 |
+ let nsslib = ctypes.open(path);
|
|
50 |
|
|
51 |
this.log("Initializing NSS types and function declarations...");
|
|
52 |
|
|
53 |
this.nss = {};
|
|
54 |
this.nss_t = {};
|
|
55 |
|
|
56 |
// nsprpub/pr/include/prtypes.h#435
|
|
57 |
// typedef PRIntn PRBool; --> int
|