mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Changed GetDocumentLoadGroup(...) to be XPCom complient. This helps prevent leaks when using nsCOMPtrs.
This commit is contained in:
parent
59b7aaac23
commit
69eebbead3
@ -117,7 +117,7 @@ public:
|
||||
/**
|
||||
* Return the LoadGroup for the document. May return null.
|
||||
*/
|
||||
virtual nsILoadGroup* GetDocumentLoadGroup() const = 0;
|
||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup** aGroup) const = 0;
|
||||
|
||||
/**
|
||||
* Return the base URL for realtive URLs in the document. May return null (or the document URL).
|
||||
|
@ -961,10 +961,12 @@ nsDocument::GetContentType(nsString& aContentType) const
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsILoadGroup* nsDocument::GetDocumentLoadGroup() const
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetDocumentLoadGroup(nsILoadGroup **aGroup) const
|
||||
{
|
||||
*aGroup = mDocumentLoadGroup;
|
||||
NS_IF_ADDREF(mDocumentLoadGroup);
|
||||
return mDocumentLoadGroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
/**
|
||||
* Return the LoadGroup for the document. May return null.
|
||||
*/
|
||||
virtual nsILoadGroup* GetDocumentLoadGroup() const;
|
||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup **aGroup) const;
|
||||
|
||||
/**
|
||||
* Return the base URL for realtive URLs in the document. May return null (or the document URL).
|
||||
|
@ -3351,10 +3351,13 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
|
||||
// onto it as opaque data.
|
||||
NS_ADDREF(this);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsIUnicharStreamLoader* loader;
|
||||
|
||||
mDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
||||
rv = NS_NewUnicharStreamLoader(&loader,
|
||||
url,
|
||||
nsCOMPtr<nsILoadGroup>(mDocument->GetDocumentLoadGroup()),
|
||||
loadGroup,
|
||||
(nsStreamCompleteFunc)nsDoneLoadingScript,
|
||||
(void *)this);
|
||||
NS_RELEASE(url);
|
||||
|
@ -1024,8 +1024,11 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData)
|
||||
#ifdef NS_DEBUG
|
||||
mSyncCallback = PR_TRUE;
|
||||
#endif
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
mDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
||||
|
||||
result = NS_NewUnicharStreamLoader(&loader, urlClone,
|
||||
nsCOMPtr<nsILoadGroup>(mDocument->GetDocumentLoadGroup()),
|
||||
loadGroup,
|
||||
DoneLoadingStyle, aData);
|
||||
#ifdef NS_DEBUG
|
||||
mSyncCallback = PR_FALSE;
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
/**
|
||||
* Return the LoadGroup for the document. May return null.
|
||||
*/
|
||||
virtual nsILoadGroup* GetDocumentLoadGroup() const = 0;
|
||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup** aGroup) const = 0;
|
||||
|
||||
/**
|
||||
* Return the base URL for realtive URLs in the document. May return null (or the document URL).
|
||||
|
@ -961,10 +961,12 @@ nsDocument::GetContentType(nsString& aContentType) const
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsILoadGroup* nsDocument::GetDocumentLoadGroup() const
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetDocumentLoadGroup(nsILoadGroup **aGroup) const
|
||||
{
|
||||
*aGroup = mDocumentLoadGroup;
|
||||
NS_IF_ADDREF(mDocumentLoadGroup);
|
||||
return mDocumentLoadGroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
/**
|
||||
* Return the LoadGroup for the document. May return null.
|
||||
*/
|
||||
virtual nsILoadGroup* GetDocumentLoadGroup() const;
|
||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup **aGroup) const;
|
||||
|
||||
/**
|
||||
* Return the base URL for realtive URLs in the document. May return null (or the document URL).
|
||||
|
@ -3351,10 +3351,13 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
|
||||
// onto it as opaque data.
|
||||
NS_ADDREF(this);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsIUnicharStreamLoader* loader;
|
||||
|
||||
mDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
||||
rv = NS_NewUnicharStreamLoader(&loader,
|
||||
url,
|
||||
nsCOMPtr<nsILoadGroup>(mDocument->GetDocumentLoadGroup()),
|
||||
loadGroup,
|
||||
(nsStreamCompleteFunc)nsDoneLoadingScript,
|
||||
(void *)this);
|
||||
NS_RELEASE(url);
|
||||
|
@ -1024,8 +1024,11 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData)
|
||||
#ifdef NS_DEBUG
|
||||
mSyncCallback = PR_TRUE;
|
||||
#endif
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
mDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
||||
|
||||
result = NS_NewUnicharStreamLoader(&loader, urlClone,
|
||||
nsCOMPtr<nsILoadGroup>(mDocument->GetDocumentLoadGroup()),
|
||||
loadGroup,
|
||||
DoneLoadingStyle, aData);
|
||||
#ifdef NS_DEBUG
|
||||
mSyncCallback = PR_FALSE;
|
||||
|
@ -1024,8 +1024,11 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData)
|
||||
#ifdef NS_DEBUG
|
||||
mSyncCallback = PR_TRUE;
|
||||
#endif
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
mDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
||||
|
||||
result = NS_NewUnicharStreamLoader(&loader, urlClone,
|
||||
nsCOMPtr<nsILoadGroup>(mDocument->GetDocumentLoadGroup()),
|
||||
loadGroup,
|
||||
DoneLoadingStyle, aData);
|
||||
#ifdef NS_DEBUG
|
||||
mSyncCallback = PR_FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user