зеркало из https://github.com/mozilla/pjs.git
Fixed some leaked references in nsLivemarkService by changing leaky pointers
to member nsCOMPtrs, updated usage in nsBookmarksFeedHandler. (Note that Annie copied this code from the non-Places livemark code, so this problem likely still exists there.) bug=333764 r=darin@meer.net sr=bryner@brianryner.com
This commit is contained in:
Родитель
d8b7579589
Коммит
4a6f1de624
|
@ -83,22 +83,6 @@
|
|||
#include "nsNavBookmarks.h"
|
||||
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
|
||||
// These are defined in nsLivemarkService.cpp
|
||||
extern nsIRDFResource *kLMRDF_type;
|
||||
|
||||
extern nsIRDFResource *kLMRSS09_channel;
|
||||
extern nsIRDFResource *kLMRSS09_item;
|
||||
extern nsIRDFResource *kLMRSS09_title;
|
||||
extern nsIRDFResource *kLMRSS09_link;
|
||||
|
||||
extern nsIRDFResource *kLMRSS10_channel;
|
||||
extern nsIRDFResource *kLMRSS10_items;
|
||||
extern nsIRDFResource *kLMRSS10_title;
|
||||
extern nsIRDFResource *kLMRSS10_link;
|
||||
|
||||
extern nsIRDFResource *kLMDC_date;
|
||||
|
||||
static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID);
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
|
||||
|
@ -360,20 +344,20 @@ nsLivemarkLoadListener::TryParseAsRDF ()
|
|||
|
||||
nsCOMPtr<nsIRDFResource> channelResource = nsnull;
|
||||
|
||||
rv = ds->GetSource(kLMRDF_type, kLMRSS10_channel, PR_TRUE, getter_AddRefs(channelResource));
|
||||
rv = ds->GetSource(mLivemarkService->mLMRDF_type, mLivemarkService->mLMRSS10_channel, PR_TRUE, getter_AddRefs(channelResource));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
if (rv == NS_OK) {
|
||||
RSS_items = kLMRSS10_items;
|
||||
RSS_title = kLMRSS10_title;
|
||||
RSS_link = kLMRSS10_link;
|
||||
RSS_items = mLivemarkService->mLMRSS10_items;
|
||||
RSS_title = mLivemarkService->mLMRSS10_title;
|
||||
RSS_link = mLivemarkService->mLMRSS10_link;
|
||||
} else {
|
||||
// try RSS 0.9
|
||||
rv = ds->GetSource(kLMRDF_type, kLMRSS09_channel, PR_TRUE, getter_AddRefs(channelResource));
|
||||
rv = ds->GetSource(mLivemarkService->mLMRDF_type, mLivemarkService->mLMRSS09_channel, PR_TRUE, getter_AddRefs(channelResource));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
if (rv == NS_OK) {
|
||||
RSS_items = nsnull;
|
||||
RSS_title = kLMRSS09_title;
|
||||
RSS_link = kLMRSS09_link;
|
||||
RSS_title = mLivemarkService->mLMRSS09_title;
|
||||
RSS_link = mLivemarkService->mLMRSS09_link;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,7 +389,7 @@ nsLivemarkLoadListener::TryParseAsRDF ()
|
|||
// and found a channel, then it's possibly RSS 0.9. For RSS 0.9,
|
||||
// we know that each item will be an <item ...>, so we get everything
|
||||
// that has a type of item.
|
||||
rv = ds->GetSources(kLMRDF_type, kLMRSS09_item, PR_TRUE, getter_AddRefs(itemsEnumerator));
|
||||
rv = ds->GetSources(mLivemarkService->mLMRDF_type, mLivemarkService->mLMRSS09_item, PR_TRUE, getter_AddRefs(itemsEnumerator));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -524,7 +508,7 @@ nsLivemarkLoadListener::HandleRDFItem (nsIRDFDataSource *aDS, nsIRDFResource *aI
|
|||
nsCOMPtr<nsIRDFNode> titleNode;
|
||||
rv = aDS->GetTarget (aItem, aTitleResource, PR_TRUE, getter_AddRefs(titleNode));
|
||||
if (rv == NS_RDF_NO_VALUE) {
|
||||
rv = aDS->GetTarget (aItem, kLMDC_date, PR_TRUE, getter_AddRefs(titleNode));
|
||||
rv = aDS->GetTarget (aItem, mLivemarkService->mLMDC_date, PR_TRUE, getter_AddRefs(titleNode));
|
||||
}
|
||||
if (NS_FAILED(rv) || rv == NS_RDF_NO_VALUE) return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsLivemarkService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsNavBookmarks.h"
|
||||
|
@ -45,7 +46,6 @@
|
|||
#include "nsFaviconService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "rdf.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsCRT.h"
|
||||
|
@ -70,16 +70,6 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
|||
#define DC_NAMESPACE_URI "http://purl.org/dc/elements/1.1/"
|
||||
#endif
|
||||
|
||||
nsIRDFResource *kLMRDF_type;
|
||||
nsIRDFResource *kLMRSS09_channel;
|
||||
nsIRDFResource *kLMRSS09_item;
|
||||
nsIRDFResource *kLMRSS09_title;
|
||||
nsIRDFResource *kLMRSS09_link;
|
||||
nsIRDFResource *kLMRSS10_channel;
|
||||
nsIRDFResource *kLMRSS10_items;
|
||||
nsIRDFResource *kLMRSS10_title;
|
||||
nsIRDFResource *kLMRSS10_link;
|
||||
nsIRDFResource *kLMDC_date;
|
||||
|
||||
nsLivemarkService* nsLivemarkService::sInstance = nsnull;
|
||||
|
||||
|
@ -159,27 +149,27 @@ nsLivemarkService::Init()
|
|||
pRDF = do_GetService(kRDFServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kLMRDF_type);
|
||||
getter_AddRefs(mLMRDF_type));
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RSS09_NAMESPACE_URI "channel"),
|
||||
&kLMRSS09_channel);
|
||||
getter_AddRefs(mLMRSS09_channel));
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RSS09_NAMESPACE_URI "item"),
|
||||
&kLMRSS09_item);
|
||||
getter_AddRefs(mLMRSS09_item));
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RSS09_NAMESPACE_URI "title"),
|
||||
&kLMRSS09_title);
|
||||
getter_AddRefs(mLMRSS09_title));
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RSS09_NAMESPACE_URI "link"),
|
||||
&kLMRSS09_link);
|
||||
getter_AddRefs(mLMRSS09_link));
|
||||
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RSS10_NAMESPACE_URI "channel"),
|
||||
&kLMRSS10_channel);
|
||||
getter_AddRefs(mLMRSS10_channel));
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RSS10_NAMESPACE_URI "items"),
|
||||
&kLMRSS10_items);
|
||||
getter_AddRefs(mLMRSS10_items));
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RSS10_NAMESPACE_URI "title"),
|
||||
&kLMRSS10_title);
|
||||
getter_AddRefs(mLMRSS10_title));
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(RSS10_NAMESPACE_URI "link"),
|
||||
&kLMRSS10_link);
|
||||
getter_AddRefs(mLMRSS10_link));
|
||||
|
||||
pRDF->GetResource(NS_LITERAL_CSTRING(DC_NAMESPACE_URI "date"),
|
||||
&kLMDC_date);
|
||||
getter_AddRefs(mLMDC_date));
|
||||
|
||||
// Initialize the list of livemarks from the list of URIs
|
||||
// that have a feed uri annotation.
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
*/
|
||||
#define LMANNO_BMANNO "livemark/bookmarkFeedURI"
|
||||
|
||||
class nsIRDFResource;
|
||||
|
||||
class nsLivemarkService : public nsILivemarkService, public nsIObserver
|
||||
{
|
||||
public:
|
||||
|
@ -118,6 +120,16 @@ public:
|
|||
nsAutoRefCnt mRefCnt;
|
||||
};
|
||||
|
||||
nsCOMPtr<nsIRDFResource> mLMRDF_type;
|
||||
nsCOMPtr<nsIRDFResource> mLMRSS09_channel;
|
||||
nsCOMPtr<nsIRDFResource> mLMRSS09_item;
|
||||
nsCOMPtr<nsIRDFResource> mLMRSS09_title;
|
||||
nsCOMPtr<nsIRDFResource> mLMRSS09_link;
|
||||
nsCOMPtr<nsIRDFResource> mLMRSS10_channel;
|
||||
nsCOMPtr<nsIRDFResource> mLMRSS10_items;
|
||||
nsCOMPtr<nsIRDFResource> mLMRSS10_title;
|
||||
nsCOMPtr<nsIRDFResource> mLMRSS10_link;
|
||||
nsCOMPtr<nsIRDFResource> mLMDC_date;
|
||||
private:
|
||||
static nsLivemarkService *sInstance;
|
||||
|
||||
|
@ -144,4 +156,5 @@ private:
|
|||
static void FireTimer(nsITimer* aTimer, void* aClosure);
|
||||
nsresult UpdateLivemarkChildren(PRInt32 aLivemarkIndex, PRBool aForceUpdate);
|
||||
PRInt32 GetLivemarkIndex(PRInt64 folderID);
|
||||
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче