Bug 1247580 P1 Allow old nsIX509Cert serialized objects to be read off disk. r=bz

This commit is contained in:
Ben Kelly 2016-02-17 07:18:00 -08:00
parent 670e497609
commit 1eb56118ec
2 changed files with 23 additions and 0 deletions

View File

@ -19,6 +19,11 @@ interface nsICertVerificationListener;
/**
* This represents a X.509 certificate.
*
* NOTE: Service workers persist x.509 certs in object form on disk. If you
* change this uuid you probably need a hack in nsBinaryInputStream to
* read the old uuid. If you change the format of the object
* serialization then more complex changes will be needed.
*/
[scriptable, uuid(bdc3979a-5422-4cd5-8589-696b6e96ea83)]
interface nsIX509Cert : nsISupports {

View File

@ -33,6 +33,7 @@
#include "nsIClassInfo.h"
#include "nsComponentManagerUtils.h"
#include "nsIURI.h" // for NS_IURI_IID
#include "nsIX509Cert.h" // for NS_IX509CERT_IID
#include "jsfriendapi.h"
@ -934,6 +935,23 @@ nsBinaryInputStream::ReadObject(bool aIsStrongRef, nsISupports** aObject)
}
// END HACK
// HACK: Service workers store resource security info on disk in the dom
// Cache API. When the uuid of the nsIX509Cert interface changes
// these serialized objects cannot be loaded any more. This hack
// works around this issue.
// hackaround for bug 1247580 (FF45 to FF46 transition)
static const nsIID oldCertIID = {
0xf8ed8364, 0xced9, 0x4c6e,
{ 0x86, 0xba, 0x48, 0xaf, 0x53, 0xc3, 0x93, 0xe6 }
};
if (iid.Equals(oldCertIID)) {
const nsIID newCertIID = NS_IX509CERT_IID;
iid = newCertIID;
}
// END HACK
nsCOMPtr<nsISupports> object = do_CreateInstance(cid, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;