Bug 401292 - application and addon updates fail when Danish Government browser extension is installed; Second patch v1; r=dveditz a1.9.1=beltzner
authorJesper Kristensen <bugzilla@jesperkristensen.dk>
Sun, 04 Jan 2009 09:40:41 +0100
changeset 22630 b884fd68ff498c972b81a7028057802d09034a0b
parent 22629 7816ad83f5aca207079f262e59764cc929dc10c1
child 22631 ac601c3cdcbd2c8b3e04427f6c851179be0dbcf2
push id320
push usersgautherie.bz@free.fr
push dateSun, 04 Jan 2009 08:42:19 +0000
reviewersdveditz
bugs401292
milestone1.9.1b3pre
Bug 401292 - application and addon updates fail when Danish Government browser extension is installed; Second patch v1; r=dveditz a1.9.1=beltzner
security/manager/ssl/public/nsIX509Cert3.idl
xpinstall/src/nsXPInstallManager.cpp
--- a/security/manager/ssl/public/nsIX509Cert3.idl
+++ b/security/manager/ssl/public/nsIX509Cert3.idl
@@ -75,17 +75,17 @@ interface nsIX509Cert3 : nsIX509Cert2 {
                    [retval, array, size_is(length)] out octet data);
 
   readonly attribute boolean isSelfSigned;
 
   /**
    * Human readable names identifying all hardware or
    * software tokens the certificate is stored on.
    *
-   * @param On success, the number of entries in the returned array.
+   * @param length On success, the number of entries in the returned array.
    * @return On success, an array containing the names of all tokens 
    *         the certificate is stored on (may be empty).
    *         On failure the function throws/returns an error.
    */
   void getAllTokenNames(out unsigned long length,
                        [retval, array, size_is(length)] out wstring
                        tokenNames);
 };
--- a/xpinstall/src/nsXPInstallManager.cpp
+++ b/xpinstall/src/nsXPInstallManager.cpp
@@ -79,16 +79,17 @@
 #include "nsIScriptGlobalObject.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIObserverService.h"
 
 #include "nsISSLStatusProvider.h"
 #include "nsISSLStatus.h"
 #include "nsIX509Cert.h"
+#include "nsIX509Cert3.h"
 
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
 #include "CertReader.h"
 
 #include "nsEmbedCID.h"
 
@@ -1096,21 +1097,26 @@ nsXPInstallManager::CheckCert(nsIChannel
     PRBool equal;
     while (issuer && NS_SUCCEEDED(cert->Equals(issuer, &equal)) && !equal) {
         cert = issuer;
         rv = cert->GetIssuer(getter_AddRefs(issuer));
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
     if (issuer) {
-        nsAutoString tokenName;
-        rv = issuer->GetTokenName(tokenName);
+        PRUint32 length;
+        PRUnichar** tokenNames;
+        nsCOMPtr<nsIX509Cert3> issuer2(do_QueryInterface(issuer));
+        NS_ENSURE_TRUE(status, NS_ERROR_FAILURE);
+        rv = issuer2->GetAllTokenNames(&length, &tokenNames);
         NS_ENSURE_SUCCESS(rv ,rv);
-        if (tokenName.Equals(NS_LITERAL_STRING("Builtin Object Token")))
-            return NS_OK;
+        for (PRUint32 i = 0; i < length; i++) {
+            if (nsDependentString(tokenNames[i]).Equals(NS_LITERAL_STRING("Builtin Object Token")))
+                return NS_OK;
+        }
     }
     return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsXPInstallManager::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
 {
     nsresult rv = NS_ERROR_FAILURE;