From 354245fef7eab898ba39e4e09e3ce6c1c42653ae Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Fri, 21 May 1999 22:18:29 +0000 Subject: [PATCH] Bug 4629. Use PR_Now() to get a 'more unique' starting point for anonymous resources. git-svn-id: svn://10.0.0.236/trunk@32481 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/rdf/base/src/rdfutil.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mozilla/rdf/base/src/rdfutil.cpp b/mozilla/rdf/base/src/rdfutil.cpp index bb5743a8d65..cb586373c3a 100644 --- a/mozilla/rdf/base/src/rdfutil.cpp +++ b/mozilla/rdf/base/src/rdfutil.cpp @@ -43,6 +43,7 @@ #include "nsXPIDLString.h" #include "plstr.h" #include "prprf.h" +#include "prtime.h" #include "rdfutil.h" #include "rdf.h" @@ -117,10 +118,22 @@ static PRUint32 gCounter = 0; rv = rdf_EnsureRDFService(); if (NS_FAILED(rv)) return rv; + if (! gCounter) { + // Start it at a semi-unique value, just to minimize the + // chance that we get into a situation where + // + // 1. An anonymous resource gets serialized out in a graph + // 2. Reboot + // 3. The same anonymous resource gets requested, and refers + // to something completely different. + // 4. The serialization is read back in. + LL_L2UI(gCounter, PR_Now()); + } + do { nsAutoString s(aContextURI); s.Append("#$"); - s.Append(++gCounter, 10); + s.Append(++gCounter, 16); nsIRDFResource* resource; if (NS_FAILED(rv = gRDFService->GetUnicodeResource(s.GetUnicode(), &resource)))