Bug 662242: Swap out the old nsIURL IID for the new one, in nsBinaryInputStream::ReadObject. r=bz

This commit is contained in:
Daniel Holbert
2011-06-09 12:10:42 -07:00
parent e95321effa
commit e7249a57da
2 changed files with 21 additions and 0 deletions

View File

@@ -60,6 +60,7 @@
#include "nsISerializable.h"
#include "nsIClassInfo.h"
#include "nsComponentManagerUtils.h"
#include "nsIURI.h" // for NS_IURI_IID
NS_IMPL_ISUPPORTS3(nsBinaryOutputStream, nsIObjectOutputStream, nsIBinaryOutputStream, nsIOutputStream)
@@ -759,6 +760,20 @@ nsBinaryInputStream::ReadObject(PRBool aIsStrongRef, nsISupports* *aObject)
rv = ReadID(&iid);
NS_ENSURE_SUCCESS(rv, rv);
// HACK: Intercept old (pre-gecko6) nsIURI IID, and replace with
// the updated IID, so that we're QI'ing to an actual interface.
// (As soon as we drop support for upgrading from pre-gecko6, we can
// remove this chunk.)
static const nsIID oldURIiid =
{ 0x7a22cc0, 0xce5, 0x11d3,
{ 0x93, 0x31, 0x0, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }};
if (iid.Equals(oldURIiid)) {
const nsIID newURIiid = NS_IURI_IID;
iid = newURIiid;
}
// END HACK
nsCOMPtr<nsISupports> object = do_CreateInstance(cid, &rv);
NS_ENSURE_SUCCESS(rv, rv);