diff --git a/camino/src/browser/SiteIconProvider.mm b/camino/src/browser/SiteIconProvider.mm index 9748fee0a9c1..e7a2a62cb8d6 100644 --- a/camino/src/browser/SiteIconProvider.mm +++ b/camino/src/browser/SiteIconProvider.mm @@ -116,7 +116,7 @@ nsresult NeckoCacheHelper::ExistsInCache(const nsACString& inURI, PRBool* outExi NS_ASSERTION(mCacheSession, "No cache session"); nsCOMPtr entryDesc; - nsresult rv = mCacheSession->OpenCacheEntry(PromiseFlatCString(inURI).get(), nsICache::ACCESS_READ, nsICache::NON_BLOCKING, getter_AddRefs(entryDesc)); + nsresult rv = mCacheSession->OpenCacheEntry(inURI, nsICache::ACCESS_READ, nsICache::NON_BLOCKING, getter_AddRefs(entryDesc)); *outExists = NS_SUCCEEDED(rv) && (entryDesc != NULL); return NS_OK; @@ -127,7 +127,7 @@ nsresult NeckoCacheHelper::PutInCache(const nsACString& inURI, PRUint32 inExpira NS_ASSERTION(mCacheSession, "No cache session"); nsCOMPtr entryDesc; - nsresult rv = mCacheSession->OpenCacheEntry(PromiseFlatCString(inURI).get(), nsICache::ACCESS_WRITE, nsICache::NON_BLOCKING, getter_AddRefs(entryDesc)); + nsresult rv = mCacheSession->OpenCacheEntry(inURI, nsICache::ACCESS_WRITE, nsICache::NON_BLOCKING, getter_AddRefs(entryDesc)); if (NS_FAILED(rv) || !entryDesc) return rv; nsCacheAccessMode accessMode; diff --git a/content/html/document/src/nsWyciwygChannel.cpp b/content/html/document/src/nsWyciwygChannel.cpp index 39add3dd2faf..7dd3702cc6ed 100644 --- a/content/html/document/src/nsWyciwygChannel.cpp +++ b/content/html/document/src/nsWyciwygChannel.cpp @@ -309,7 +309,7 @@ nsWyciwygChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctx) // open a cache entry for this channel... PRBool delayed = PR_FALSE; - nsresult rv = OpenCacheEntry(spec.get(), nsICache::ACCESS_READ, &delayed); + nsresult rv = OpenCacheEntry(spec, nsICache::ACCESS_READ, &delayed); if (NS_FAILED(rv)) { LOG(("nsWyciwygChannel::OpenCacheEntry failed [rv=%x]\n", rv)); return rv; @@ -346,7 +346,7 @@ nsWyciwygChannel::WriteToCacheEntry(const nsAString &aData) nsCAutoString spec; rv = mURI->GetAsciiSpec(spec); if (NS_FAILED(rv)) return rv; - rv = OpenCacheEntry(spec.get(), nsICache::ACCESS_WRITE); + rv = OpenCacheEntry(spec, nsICache::ACCESS_WRITE); if (NS_FAILED(rv)) return rv; } @@ -511,7 +511,7 @@ nsWyciwygChannel::OnStopRequest(nsIRequest *request, nsISupports *ctx, nsresult ////////////////////////////////////////////////////////////////////////////// nsresult -nsWyciwygChannel::OpenCacheEntry(const char * aCacheKey, +nsWyciwygChannel::OpenCacheEntry(const nsACString & aCacheKey, nsCacheAccessMode aAccessMode, PRBool * aDelayFlag) { diff --git a/content/html/document/src/nsWyciwygChannel.h b/content/html/document/src/nsWyciwygChannel.h index 65ad9dc00fee..ff348865f4d2 100644 --- a/content/html/document/src/nsWyciwygChannel.h +++ b/content/html/document/src/nsWyciwygChannel.h @@ -82,7 +82,7 @@ public: protected: nsresult ReadFromCache(); - nsresult OpenCacheEntry(const char * aCacheKey, nsCacheAccessMode aWriteAccess, PRBool * aDelayFlag = nsnull); + nsresult OpenCacheEntry(const nsACString & aCacheKey, nsCacheAccessMode aWriteAccess, PRBool * aDelayFlag = nsnull); nsresult mStatus; PRBool mIsPending; diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index c1205ec9129d..e6764f29093c 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -7934,7 +7934,7 @@ nsresult nsImapMockChannel::OpenCacheEntry() nsCAutoString cacheKey; cacheKey.AppendInt(uidValidity, 16); cacheKey.Append(urlSpec); - return cacheSession->AsyncOpenCacheEntry(cacheKey.get(), nsICache::ACCESS_READ_WRITE, this); + return cacheSession->AsyncOpenCacheEntry(cacheKey, nsICache::ACCESS_READ_WRITE, this); } nsresult nsImapMockChannel::ReadFromMemCache(nsICacheEntryDescriptor *entry) diff --git a/mailnews/mime/src/mimemoz2.cpp b/mailnews/mime/src/mimemoz2.cpp index 358949bb2071..a434bb2dc9b4 100644 --- a/mailnews/mime/src/mimemoz2.cpp +++ b/mailnews/mime/src/mimemoz2.cpp @@ -1154,7 +1154,7 @@ mime_image_begin(const char *image_url, const char *content_type, // we may need to convert the image_url into just a part url - in any case, // it has to be the same as what imglib will be asking imap for later // on so that we'll find this in the memory cache. - rv = memCacheSession->OpenCacheEntry(image_url, nsICache::ACCESS_READ_WRITE, nsICache::BLOCKING, getter_AddRefs(entry)); + rv = memCacheSession->OpenCacheEntry(nsDependentCString(image_url), nsICache::ACCESS_READ_WRITE, nsICache::BLOCKING, getter_AddRefs(entry)); nsCacheAccessMode access; if (entry) { diff --git a/mailnews/news/src/nsNNTPProtocol.cpp b/mailnews/news/src/nsNNTPProtocol.cpp index 561026a6a981..1cd3fd00aebf 100644 --- a/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mailnews/news/src/nsNNTPProtocol.cpp @@ -920,7 +920,7 @@ nsresult nsNNTPProtocol::OpenCacheEntry() char * anchor = (char *)strrchr(urlSpec.BeginWriting(), '?'); if (anchor) *anchor = '\0'; - return cacheSession->AsyncOpenCacheEntry(urlSpec.get(), nsICache::ACCESS_READ_WRITE, this); + return cacheSession->AsyncOpenCacheEntry(urlSpec, nsICache::ACCESS_READ_WRITE, this); } NS_IMETHODIMP nsNNTPProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) diff --git a/modules/libpr0n/src/imgCache.cpp b/modules/libpr0n/src/imgCache.cpp index 2df4d394b634..04bca68b5ba9 100644 --- a/modules/libpr0n/src/imgCache.cpp +++ b/modules/libpr0n/src/imgCache.cpp @@ -194,7 +194,7 @@ PRBool imgCache::Put(nsIURI *aKey, imgRequest *request, nsICacheEntryDescriptor nsCOMPtr entry; - rv = ses->OpenCacheEntry(spec.get(), nsICache::ACCESS_WRITE, nsICache::BLOCKING, getter_AddRefs(entry)); + rv = ses->OpenCacheEntry(spec, nsICache::ACCESS_WRITE, nsICache::BLOCKING, getter_AddRefs(entry)); if (NS_FAILED(rv) || !entry) return PR_FALSE; @@ -244,7 +244,7 @@ PRBool imgCache::Get(nsIURI *aKey, PRBool *aHasExpired, imgRequest **aRequest, n nsCOMPtr entry; - rv = ses->OpenCacheEntry(spec.get(), nsICache::ACCESS_READ, nsICache::BLOCKING, getter_AddRefs(entry)); + rv = ses->OpenCacheEntry(spec, nsICache::ACCESS_READ, nsICache::BLOCKING, getter_AddRefs(entry)); if (NS_FAILED(rv) || !entry) return PR_FALSE; @@ -306,7 +306,7 @@ PRBool imgCache::Remove(nsIURI *aKey) nsCOMPtr entry; - rv = ses->OpenCacheEntry(spec.get(), nsICache::ACCESS_READ, nsICache::BLOCKING, getter_AddRefs(entry)); + rv = ses->OpenCacheEntry(spec, nsICache::ACCESS_READ, nsICache::BLOCKING, getter_AddRefs(entry)); if (NS_FAILED(rv) || !entry) return PR_FALSE; diff --git a/netwerk/cache/public/nsICacheSession.idl b/netwerk/cache/public/nsICacheSession.idl index 6f181d7c51aa..c1ab8b8beee9 100644 --- a/netwerk/cache/public/nsICacheSession.idl +++ b/netwerk/cache/public/nsICacheSession.idl @@ -46,7 +46,7 @@ interface nsICacheEntryDescriptor; interface nsICacheListener; -[scriptable, uuid(b4b419ad-28b7-4d25-9988-20fa98505a19)] +[scriptable, uuid(ae9e84b5-3e2d-457e-8fcd-5bbd2a8b832e)] interface nsICacheSession : nsISupports { /** @@ -71,7 +71,7 @@ interface nsICacheSession : nsISupports * return NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than block when another * descriptor has been given WRITE access but hasn't validated the entry yet. */ - nsICacheEntryDescriptor openCacheEntry(in string key, + nsICacheEntryDescriptor openCacheEntry(in ACString key, in nsCacheAccessMode accessRequested, in boolean blockingMode); @@ -80,7 +80,7 @@ interface nsICacheSession : nsISupports * Instead, the listener will be notified when the descriptor is * available. */ - void asyncOpenCacheEntry(in string key, + void asyncOpenCacheEntry(in ACString key, in nsCacheAccessMode accessRequested, in nsICacheListener listener); diff --git a/netwerk/cache/public/nsICacheVisitor.idl b/netwerk/cache/public/nsICacheVisitor.idl index 8046aea86934..4c589f6daac6 100644 --- a/netwerk/cache/public/nsICacheVisitor.idl +++ b/netwerk/cache/public/nsICacheVisitor.idl @@ -109,7 +109,7 @@ interface nsICacheDeviceInfo : nsISupports }; -[scriptable, uuid(72c64022-1dd2-11b2-b3a5-b8b859e0a1b2)] +[scriptable, uuid(fab51c92-95c3-4468-b317-7de4d7588254)] interface nsICacheEntryInfo : nsISupports { /** @@ -125,7 +125,7 @@ interface nsICacheEntryInfo : nsISupports /** * Get the key identifying the cache entry. */ - readonly attribute string key; + readonly attribute ACString key; /** * Get the number of times the cache entry has been opened. diff --git a/netwerk/cache/src/nsCache.cpp b/netwerk/cache/src/nsCache.cpp index 5cf29ac9c48e..e2dd6e3ca092 100644 --- a/netwerk/cache/src/nsCache.cpp +++ b/netwerk/cache/src/nsCache.cpp @@ -131,10 +131,9 @@ ClientIDFromCacheKey(const nsACString& key, char ** result) nsresult -ClientKeyFromCacheKey(const nsACString& key, char ** result) +ClientKeyFromCacheKey(const nsCString& key, nsACString &result) { nsresult rv = NS_OK; - *result = nsnull; nsReadingIterator start; key.BeginReading(start); @@ -144,11 +143,11 @@ ClientKeyFromCacheKey(const nsACString& key, char ** result) if (FindCharInReadable(':', start, end)) { ++start; // advance past clientID ':' delimiter - *result = ToNewCString( Substring(start, end)); - if (!*result) rv = NS_ERROR_OUT_OF_MEMORY; + result.Assign(Substring(start, end)); } else { NS_ASSERTION(PR_FALSE, "FindCharInRead failed to find ':'"); rv = NS_ERROR_UNEXPECTED; + result.Truncate(0); } return rv; } diff --git a/netwerk/cache/src/nsCache.h b/netwerk/cache/src/nsCache.h index e19806e18b2d..0c08d3346823 100644 --- a/netwerk/cache/src/nsCache.h +++ b/netwerk/cache/src/nsCache.h @@ -83,7 +83,7 @@ extern PRTime PRTimeFromSeconds(PRUint32 seconds); extern nsresult ClientIDFromCacheKey(const nsACString& key, char ** result); -extern nsresult ClientKeyFromCacheKey(const nsACString& key, char ** result); +extern nsresult ClientKeyFromCacheKey(const nsCString& key, nsACString &result); #endif // _nsCache_h diff --git a/netwerk/cache/src/nsCacheEntry.cpp b/netwerk/cache/src/nsCacheEntry.cpp index 4182ec48908b..95c423fbb5c8 100644 --- a/netwerk/cache/src/nsCacheEntry.cpp +++ b/netwerk/cache/src/nsCacheEntry.cpp @@ -305,9 +305,8 @@ nsCacheEntryInfo::GetDeviceID(char ** deviceID) NS_IMETHODIMP -nsCacheEntryInfo::GetKey(char ** key) +nsCacheEntryInfo::GetKey(nsACString &key) { - NS_ENSURE_ARG_POINTER(key); if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE; return ClientKeyFromCacheKey(*mCacheEntry->Key(), key); diff --git a/netwerk/cache/src/nsCacheEntryDescriptor.cpp b/netwerk/cache/src/nsCacheEntryDescriptor.cpp index d4735fa66302..9c479fb9f8e8 100644 --- a/netwerk/cache/src/nsCacheEntryDescriptor.cpp +++ b/netwerk/cache/src/nsCacheEntryDescriptor.cpp @@ -94,9 +94,8 @@ nsCacheEntryDescriptor::GetDeviceID(char ** result) NS_IMETHODIMP -nsCacheEntryDescriptor::GetKey(char ** result) +nsCacheEntryDescriptor::GetKey(nsACString &result) { - NS_ENSURE_ARG_POINTER(result); nsAutoLock lock(nsCacheService::ServiceLock()); if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE; diff --git a/netwerk/cache/src/nsCacheService.cpp b/netwerk/cache/src/nsCacheService.cpp index 113a56f3272b..15b2a45a352c 100644 --- a/netwerk/cache/src/nsCacheService.cpp +++ b/netwerk/cache/src/nsCacheService.cpp @@ -726,7 +726,7 @@ nsCacheService::CreateMemoryDevice() nsresult nsCacheService::CreateRequest(nsCacheSession * session, - const char * clientKey, + const nsACString & clientKey, nsCacheAccessMode accessRequested, PRBool blockingMode, nsICacheListener * listener, @@ -849,7 +849,7 @@ nsCacheService::ProcessRequest(nsCacheRequest * request, nsresult nsCacheService::OpenCacheEntry(nsCacheSession * session, - const char * key, + const nsACString & key, nsCacheAccessMode accessRequested, PRBool blockingMode, nsICacheListener * listener, diff --git a/netwerk/cache/src/nsCacheService.h b/netwerk/cache/src/nsCacheService.h index 2d62295ec218..648968abba14 100644 --- a/netwerk/cache/src/nsCacheService.h +++ b/netwerk/cache/src/nsCacheService.h @@ -83,7 +83,7 @@ public: * Methods called by nsCacheSession */ static nsresult OpenCacheEntry(nsCacheSession * session, - const char * key, + const nsACString & key, nsCacheAccessMode accessRequested, PRBool blockingMode, nsICacheListener * listener, @@ -159,7 +159,7 @@ private: nsresult CreateMemoryDevice(); nsresult CreateRequest(nsCacheSession * session, - const char * clientKey, + const nsACString & clientKey, nsCacheAccessMode accessRequested, PRBool blockingMode, nsICacheListener * listener, diff --git a/netwerk/cache/src/nsCacheSession.cpp b/netwerk/cache/src/nsCacheSession.cpp index fb688ab98ccb..a8452f9524e2 100644 --- a/netwerk/cache/src/nsCacheSession.cpp +++ b/netwerk/cache/src/nsCacheSession.cpp @@ -84,7 +84,7 @@ NS_IMETHODIMP nsCacheSession::SetDoomEntriesIfExpired(PRBool doomEntriesIfExpire NS_IMETHODIMP -nsCacheSession::OpenCacheEntry(const char * key, +nsCacheSession::OpenCacheEntry(const nsACString & key, nsCacheAccessMode accessRequested, PRBool blockingMode, nsICacheEntryDescriptor ** result) @@ -100,7 +100,7 @@ nsCacheSession::OpenCacheEntry(const char * key, } -NS_IMETHODIMP nsCacheSession::AsyncOpenCacheEntry(const char *key, +NS_IMETHODIMP nsCacheSession::AsyncOpenCacheEntry(const nsACString & key, nsCacheAccessMode accessRequested, nsICacheListener *listener) { diff --git a/netwerk/cache/src/nsDiskCacheDeviceSQL.cpp b/netwerk/cache/src/nsDiskCacheDeviceSQL.cpp index 4acd0e2cd523..45f0ab9eeaee 100644 --- a/netwerk/cache/src/nsDiskCacheDeviceSQL.cpp +++ b/netwerk/cache/src/nsDiskCacheDeviceSQL.cpp @@ -465,10 +465,10 @@ nsDiskCacheEntryInfo::GetDeviceID(char ** deviceID) } NS_IMETHODIMP -nsDiskCacheEntryInfo::GetKey(char ** clientKey) +nsDiskCacheEntryInfo::GetKey(nsACString &clientKey) { - *clientKey = nsCRT::strdup(mRec->key); - return *clientKey ? NS_OK : NS_ERROR_OUT_OF_MEMORY; + clientKey.Assign(mRec->key); + return NS_OK; } NS_IMETHODIMP diff --git a/netwerk/cache/src/nsDiskCacheEntry.cpp b/netwerk/cache/src/nsDiskCacheEntry.cpp index 89b3f05372c2..4e4d35e857b9 100644 --- a/netwerk/cache/src/nsDiskCacheEntry.cpp +++ b/netwerk/cache/src/nsDiskCacheEntry.cpp @@ -177,9 +177,8 @@ NS_IMETHODIMP nsDiskCacheEntryInfo::GetDeviceID(char ** deviceID) } -NS_IMETHODIMP nsDiskCacheEntryInfo::GetKey(char ** clientKey) +NS_IMETHODIMP nsDiskCacheEntryInfo::GetKey(nsACString &clientKey) { - NS_ENSURE_ARG_POINTER(clientKey); return ClientKeyFromCacheKey(nsDependentCString(mDiskEntry->mKeyStart), clientKey); } diff --git a/netwerk/protocol/about/src/nsAboutCache.cpp b/netwerk/protocol/about/src/nsAboutCache.cpp index d1de6a4cc88d..06735b31f59f 100644 --- a/netwerk/protocol/about/src/nsAboutCache.cpp +++ b/netwerk/protocol/about/src/nsAboutCache.cpp @@ -224,11 +224,11 @@ nsAboutCache::VisitEntry(const char *deviceID, { nsresult rv; PRUint32 bytesWritten; - nsXPIDLCString key; + nsCAutoString key; nsXPIDLCString clientID; PRBool streamBased; - rv = entryInfo->GetKey(getter_Copies(key)); + rv = entryInfo->GetKey(key); if (NS_FAILED(rv)) return rv; rv = entryInfo->GetClientID(getter_Copies(clientID)); @@ -244,7 +244,7 @@ nsAboutCache::VisitEntry(const char *deviceID, url.AppendLiteral("&sb="); url += streamBased ? '1' : '0'; url.AppendLiteral("&key="); - char* escapedKey = nsEscapeHTML(key); + char* escapedKey = nsEscapeHTML(key.get()); url += escapedKey; // key // Entry start... diff --git a/netwerk/protocol/about/src/nsAboutCacheEntry.cpp b/netwerk/protocol/about/src/nsAboutCacheEntry.cpp index a1451bce6267..cb5a70ab2b56 100644 --- a/netwerk/protocol/about/src/nsAboutCacheEntry.cpp +++ b/netwerk/protocol/about/src/nsAboutCacheEntry.cpp @@ -343,7 +343,7 @@ nsAboutCacheEntry::AsyncOpen(nsIStreamListener *listener, nsISupports *context) mListener = listener; mListenerContext = context; - return mCacheSession->AsyncOpenCacheEntry(key.get(), nsICache::ACCESS_READ, this); + return mCacheSession->AsyncOpenCacheEntry(key, nsICache::ACCESS_READ, this); } @@ -384,9 +384,9 @@ nsAboutCacheEntry::WriteCacheEntryDescription(nsIOutputStream *outputStream, nsCString buffer; PRUint32 n; - nsXPIDLCString str; + nsCAutoString str; - rv = descriptor->GetKey(getter_Copies(str)); + rv = descriptor->GetKey(str); if (NS_FAILED(rv)) return rv; buffer.SetCapacity(4096); @@ -405,7 +405,7 @@ nsAboutCacheEntry::WriteCacheEntryDescription(nsIOutputStream *outputStream, uri->SchemeIs("javascript", &isJS); uri->SchemeIs("data", &isData); } - char* escapedStr = nsEscapeHTML(str); + char* escapedStr = nsEscapeHTML(str.get()); if (NS_SUCCEEDED(rv) && !(isJS || isData)) { buffer.AppendLiteral("GetClientID(getter_Copies(str)); - if (!str.IsEmpty()) APPEND_ROW("Client", str); + nsXPIDLCString str2; + descriptor->GetClientID(getter_Copies(str2)); + if (!str2.IsEmpty()) APPEND_ROW("Client", str2); mBuffer = &buffer; // make it available for VisitMetaDataElement() diff --git a/netwerk/protocol/ftp/src/nsFTPChannel.cpp b/netwerk/protocol/ftp/src/nsFTPChannel.cpp index 740206a3a528..37f2f25828f1 100644 --- a/netwerk/protocol/ftp/src/nsFTPChannel.cpp +++ b/netwerk/protocol/ftp/src/nsFTPChannel.cpp @@ -360,7 +360,7 @@ nsFTPChannel::AsyncOpenAt(nsIStreamListener *listener, nsISupports *ctxt, nsCAutoString cacheKey; GenerateCacheKey(cacheKey); - rv = mCacheSession->AsyncOpenCacheEntry(cacheKey.get(), + rv = mCacheSession->AsyncOpenCacheEntry(cacheKey, accessRequested, this); if (NS_SUCCEEDED(rv)) diff --git a/netwerk/protocol/http/src/nsHttpChannel.cpp b/netwerk/protocol/http/src/nsHttpChannel.cpp index d76545eaaaa4..0517890bf03e 100644 --- a/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -1206,11 +1206,11 @@ nsHttpChannel::OpenCacheEntry(PRBool offline, PRBool *delayed) // we'll try to synchronously open the cache entry... however, it may be // in use and not yet validated, in which case we'll try asynchronously // opening the cache entry. - rv = session->OpenCacheEntry(cacheKey.get(), accessRequested, PR_FALSE, + rv = session->OpenCacheEntry(cacheKey, accessRequested, PR_FALSE, getter_AddRefs(mCacheEntry)); if (rv == NS_ERROR_CACHE_WAIT_FOR_VALIDATION) { // access to the cache entry has been denied - rv = session->AsyncOpenCacheEntry(cacheKey.get(), accessRequested, this); + rv = session->AsyncOpenCacheEntry(cacheKey, accessRequested, this); if (NS_FAILED(rv)) return rv; // we'll have to wait for the cache entry *delayed = PR_TRUE; diff --git a/netwerk/test/TestCacheService.cpp b/netwerk/test/TestCacheService.cpp index d17854df9718..b645fb39bd24 100644 --- a/netwerk/test/TestCacheService.cpp +++ b/netwerk/test/TestCacheService.cpp @@ -112,16 +112,18 @@ TestMemoryObjectCache() // Test ACCESS_READ for non-existent entry printf("\nTest ACCESS_READ:\n"); - rv = session->OpenCacheEntry("non-existent entry", + rv = session->OpenCacheEntry(NS_LITERAL_CSTRING("non-existent entry"), nsICache::ACCESS_READ, nsICache::BLOCKING, getter_AddRefs(descriptor)); if (rv != NS_ERROR_CACHE_KEY_NOT_FOUND) printf("OpenCacheEntry(ACCESS_READ) returned: %x for non-existent entry\n", rv); + NS_NAMED_LITERAL_CSTRING(cacheKey, "http://www.mozilla.org/somekey"); + // Test creating new entry printf("\nTest ACCESS_READ_WRITE:\n"); - rv = session->OpenCacheEntry("http://www.mozilla.org/somekey", + rv = session->OpenCacheEntry(cacheKey, nsICache::ACCESS_READ_WRITE, nsICache::BLOCKING, getter_AddRefs(descriptor)); @@ -142,7 +144,7 @@ TestMemoryObjectCache() // Test refetching entry - rv = session->OpenCacheEntry("http://www.mozilla.org/somekey", + rv = session->OpenCacheEntry(cacheKey, nsICache::ACCESS_READ_WRITE, nsICache::BLOCKING, getter_AddRefs(descriptor)); @@ -167,7 +169,7 @@ TestMemoryObjectCache() // Test ACCESS_WRITE entry printf("\nTest ACCESS_WRITE:\n"); - rv = session->OpenCacheEntry("http://www.mozilla.org/somekey", + rv = session->OpenCacheEntry(cacheKey, nsICache::ACCESS_WRITE, nsICache::BLOCKING, getter_AddRefs(descriptor)); diff --git a/netwerk/test/TestMCTransport.cpp b/netwerk/test/TestMCTransport.cpp index 8178048e5ead..93d1a4c2f0f3 100644 --- a/netwerk/test/TestMCTransport.cpp +++ b/netwerk/test/TestMCTransport.cpp @@ -167,7 +167,7 @@ nsresult TestMCTransport(const char *filename) &session); if (NS_FAILED(rv)) return rv; - rv = session->OpenCacheEntry(filename, + rv = session->OpenCacheEntry(nsDependentCString(filename), nsICache::ACCESS_READ_WRITE, nsICache::BLOCKING, &desc); diff --git a/widget/src/mac/nsSound.cpp b/widget/src/mac/nsSound.cpp index 200320d574bc..d971f3eb2379 100644 --- a/widget/src/mac/nsSound.cpp +++ b/widget/src/mac/nsSound.cpp @@ -353,7 +353,7 @@ nsSound::GetSoundFromCache(nsIURI* inURI, nsISupports** outSound) if (NS_FAILED(rv)) return rv; nsCOMPtr entry; - rv = cacheSession->OpenCacheEntry(uriSpec.get(), nsICache::ACCESS_READ, nsICache::BLOCKING, getter_AddRefs(entry)); + rv = cacheSession->OpenCacheEntry(uriSpec, nsICache::ACCESS_READ, nsICache::BLOCKING, getter_AddRefs(entry)); #ifdef SOUND_DEBUG printf("Got sound from cache with rv %ld\n", rv); @@ -385,7 +385,7 @@ nsSound::PutSoundInCache(nsIChannel* inChannel, PRUint32 inDataSize, nsISupports if (NS_FAILED(rv)) return rv; nsCOMPtr entry; - rv = cacheSession->OpenCacheEntry(uriSpec.get(), nsICache::ACCESS_WRITE, nsICache::BLOCKING, getter_AddRefs(entry)); + rv = cacheSession->OpenCacheEntry(uriSpec, nsICache::ACCESS_WRITE, nsICache::BLOCKING, getter_AddRefs(entry)); #ifdef SOUND_DEBUG printf("Put sound in cache with rv %ld\n", rv); #endif diff --git a/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/xpfe/components/bookmarks/src/nsBookmarksService.cpp index dac25549bcb9..ec6004116f56 100644 --- a/xpfe/components/bookmarks/src/nsBookmarksService.cpp +++ b/xpfe/components/bookmarks/src/nsBookmarksService.cpp @@ -4136,7 +4136,7 @@ nsBookmarksService::ProcessCachedBookmarkIcon(nsIRDFResource* aSource, return NS_RDF_NO_VALUE; } nsCOMPtr entry; - rv = mCacheSession->OpenCacheEntry(path.get(), nsICache::ACCESS_READ, + rv = mCacheSession->OpenCacheEntry(path, nsICache::ACCESS_READ, nsICache::NON_BLOCKING, getter_AddRefs(entry)); if (NS_FAILED(rv) || (!entry)) {