mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
The document LoadGroup is now a nsWeakPtr...
This commit is contained in:
parent
fbe8b246a9
commit
452584594d
@ -631,7 +631,6 @@ nsDocument::nsDocument()
|
||||
mArena = nsnull;
|
||||
mDocumentTitle = nsnull;
|
||||
mDocumentURL = nsnull;
|
||||
mDocumentLoadGroup = nsnull;
|
||||
mCharacterSet = "ISO-8859-1";
|
||||
mParentDocument = nsnull;
|
||||
mRootContent = nsnull;
|
||||
@ -676,7 +675,7 @@ nsDocument::~nsDocument()
|
||||
mDocumentTitle = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(mDocumentURL);
|
||||
NS_IF_RELEASE(mDocumentLoadGroup);
|
||||
mDocumentLoadGroup = null_nsCOMPtr();
|
||||
|
||||
mParentDocument = nsnull;
|
||||
|
||||
@ -849,7 +848,7 @@ nsDocument::Reset(nsIURI *aURL)
|
||||
mDocumentTitle = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(mDocumentURL);
|
||||
NS_IF_RELEASE(mDocumentLoadGroup);
|
||||
mDocumentLoadGroup = null_nsCOMPtr();
|
||||
|
||||
// Delete references to sub-documents
|
||||
PRInt32 index = mSubDocuments.Count();
|
||||
@ -894,23 +893,14 @@ nsDocument::Reset(nsIURI *aURL)
|
||||
|
||||
NS_IF_RELEASE(mNameSpaceManager);
|
||||
|
||||
#ifdef NECKO
|
||||
(void)aChannel->GetURI(&mDocumentURL);
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
aChannel->GetOwner(getter_AddRefs(owner));
|
||||
if (owner)
|
||||
owner->QueryInterface(nsIPrincipal::GetIID(), (void**)&mPrincipal);
|
||||
// (void)aChannel->GetLoadGroup(&mDocumentLoadGroup);
|
||||
mDocumentLoadGroup = aLoadGroup;
|
||||
NS_ADDREF(mDocumentLoadGroup);
|
||||
NS_ASSERTION(mDocumentLoadGroup, "Should have a load group now on construction.");
|
||||
#else
|
||||
mDocumentURL = aURL;
|
||||
if (nsnull != aURL) {
|
||||
NS_ADDREF(aURL);
|
||||
rv = aURL->GetLoadGroup(&mDocumentLoadGroup);
|
||||
}
|
||||
#endif
|
||||
|
||||
mDocumentLoadGroup = getter_AddRefs(NS_GetWeakReference(aLoadGroup));
|
||||
NS_ASSERTION(aLoadGroup, "Should have a load group now on construction.");
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = NS_NewNameSpaceManager(&mNameSpaceManager);
|
||||
@ -964,8 +954,10 @@ nsDocument::GetContentType(nsString& aContentType) const
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetDocumentLoadGroup(nsILoadGroup **aGroup) const
|
||||
{
|
||||
*aGroup = mDocumentLoadGroup;
|
||||
NS_IF_ADDREF(mDocumentLoadGroup);
|
||||
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
|
||||
|
||||
*aGroup = group;
|
||||
NS_IF_ADDREF(*aGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
@ -456,7 +457,7 @@ protected:
|
||||
nsString* mDocumentTitle;
|
||||
nsIURI* mDocumentURL;
|
||||
nsIPrincipal* mPrincipal;
|
||||
nsILoadGroup* mDocumentLoadGroup;
|
||||
nsWeakPtr mDocumentLoadGroup;
|
||||
nsString mCharacterSet;
|
||||
nsIDocument* mParentDocument;
|
||||
nsVoidArray mSubDocuments;
|
||||
|
@ -1607,10 +1607,11 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL)
|
||||
if (nsnull == mParser) {
|
||||
#ifdef NECKO
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
result = NS_OpenURI(getter_AddRefs(channel), aSourceURL,
|
||||
mDocumentLoadGroup);
|
||||
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
|
||||
|
||||
result = NS_OpenURI(getter_AddRefs(channel), aSourceURL, group);
|
||||
if (NS_FAILED(result)) return result;
|
||||
result = Reset(channel, mDocumentLoadGroup);
|
||||
result = Reset(channel, group);
|
||||
if (NS_FAILED(result)) return result;
|
||||
#else
|
||||
result = Reset(aSourceURL);
|
||||
|
@ -117,6 +117,7 @@
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIXULContentUtils.h"
|
||||
#include "nsRDFDOMNodeList.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsXPIDLString.h" // XXX should go away
|
||||
#include "plhash.h"
|
||||
@ -893,7 +894,7 @@ protected:
|
||||
nsVoidArray mObservers;
|
||||
nsAutoString mDocumentTitle;
|
||||
nsCOMPtr<nsIURI> mDocumentURL; // [OWNER] ??? compare with loader
|
||||
nsCOMPtr<nsILoadGroup> mDocumentLoadGroup; // [OWNER] leads to loader
|
||||
nsWeakPtr mDocumentLoadGroup; // [WEAK] leads to loader
|
||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal; // [OWNER]
|
||||
nsCOMPtr<nsIRDFResource> mRootResource; // [OWNER]
|
||||
nsCOMPtr<nsIContent> mRootContent; // [OWNER]
|
||||
@ -1303,7 +1304,7 @@ XULDocumentImpl::PrepareToLoad( nsCOMPtr<nsIParser>* created_parser,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef NECKO
|
||||
mDocumentLoadGroup = aLoadGroup;
|
||||
mDocumentLoadGroup = getter_AddRefs(NS_GetWeakReference(aLoadGroup));
|
||||
#else
|
||||
syntheticURL->GetLoadGroup(getter_AddRefs(mDocumentLoadGroup));
|
||||
#endif
|
||||
@ -1528,7 +1529,9 @@ XULDocumentImpl::GetDocumentPrincipal() const
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::GetDocumentLoadGroup(nsILoadGroup **aGroup) const
|
||||
{
|
||||
*aGroup = mDocumentLoadGroup;
|
||||
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
|
||||
|
||||
*aGroup = group;
|
||||
NS_IF_ADDREF(*aGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -631,7 +631,6 @@ nsDocument::nsDocument()
|
||||
mArena = nsnull;
|
||||
mDocumentTitle = nsnull;
|
||||
mDocumentURL = nsnull;
|
||||
mDocumentLoadGroup = nsnull;
|
||||
mCharacterSet = "ISO-8859-1";
|
||||
mParentDocument = nsnull;
|
||||
mRootContent = nsnull;
|
||||
@ -676,7 +675,7 @@ nsDocument::~nsDocument()
|
||||
mDocumentTitle = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(mDocumentURL);
|
||||
NS_IF_RELEASE(mDocumentLoadGroup);
|
||||
mDocumentLoadGroup = null_nsCOMPtr();
|
||||
|
||||
mParentDocument = nsnull;
|
||||
|
||||
@ -849,7 +848,7 @@ nsDocument::Reset(nsIURI *aURL)
|
||||
mDocumentTitle = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(mDocumentURL);
|
||||
NS_IF_RELEASE(mDocumentLoadGroup);
|
||||
mDocumentLoadGroup = null_nsCOMPtr();
|
||||
|
||||
// Delete references to sub-documents
|
||||
PRInt32 index = mSubDocuments.Count();
|
||||
@ -894,23 +893,14 @@ nsDocument::Reset(nsIURI *aURL)
|
||||
|
||||
NS_IF_RELEASE(mNameSpaceManager);
|
||||
|
||||
#ifdef NECKO
|
||||
(void)aChannel->GetURI(&mDocumentURL);
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
aChannel->GetOwner(getter_AddRefs(owner));
|
||||
if (owner)
|
||||
owner->QueryInterface(nsIPrincipal::GetIID(), (void**)&mPrincipal);
|
||||
// (void)aChannel->GetLoadGroup(&mDocumentLoadGroup);
|
||||
mDocumentLoadGroup = aLoadGroup;
|
||||
NS_ADDREF(mDocumentLoadGroup);
|
||||
NS_ASSERTION(mDocumentLoadGroup, "Should have a load group now on construction.");
|
||||
#else
|
||||
mDocumentURL = aURL;
|
||||
if (nsnull != aURL) {
|
||||
NS_ADDREF(aURL);
|
||||
rv = aURL->GetLoadGroup(&mDocumentLoadGroup);
|
||||
}
|
||||
#endif
|
||||
|
||||
mDocumentLoadGroup = getter_AddRefs(NS_GetWeakReference(aLoadGroup));
|
||||
NS_ASSERTION(aLoadGroup, "Should have a load group now on construction.");
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = NS_NewNameSpaceManager(&mNameSpaceManager);
|
||||
@ -964,8 +954,10 @@ nsDocument::GetContentType(nsString& aContentType) const
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetDocumentLoadGroup(nsILoadGroup **aGroup) const
|
||||
{
|
||||
*aGroup = mDocumentLoadGroup;
|
||||
NS_IF_ADDREF(mDocumentLoadGroup);
|
||||
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
|
||||
|
||||
*aGroup = group;
|
||||
NS_IF_ADDREF(*aGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
@ -456,7 +457,7 @@ protected:
|
||||
nsString* mDocumentTitle;
|
||||
nsIURI* mDocumentURL;
|
||||
nsIPrincipal* mPrincipal;
|
||||
nsILoadGroup* mDocumentLoadGroup;
|
||||
nsWeakPtr mDocumentLoadGroup;
|
||||
nsString mCharacterSet;
|
||||
nsIDocument* mParentDocument;
|
||||
nsVoidArray mSubDocuments;
|
||||
|
@ -1607,10 +1607,11 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL)
|
||||
if (nsnull == mParser) {
|
||||
#ifdef NECKO
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
result = NS_OpenURI(getter_AddRefs(channel), aSourceURL,
|
||||
mDocumentLoadGroup);
|
||||
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
|
||||
|
||||
result = NS_OpenURI(getter_AddRefs(channel), aSourceURL, group);
|
||||
if (NS_FAILED(result)) return result;
|
||||
result = Reset(channel, mDocumentLoadGroup);
|
||||
result = Reset(channel, group);
|
||||
if (NS_FAILED(result)) return result;
|
||||
#else
|
||||
result = Reset(aSourceURL);
|
||||
|
@ -117,6 +117,7 @@
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIXULContentUtils.h"
|
||||
#include "nsRDFDOMNodeList.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsXPIDLString.h" // XXX should go away
|
||||
#include "plhash.h"
|
||||
@ -893,7 +894,7 @@ protected:
|
||||
nsVoidArray mObservers;
|
||||
nsAutoString mDocumentTitle;
|
||||
nsCOMPtr<nsIURI> mDocumentURL; // [OWNER] ??? compare with loader
|
||||
nsCOMPtr<nsILoadGroup> mDocumentLoadGroup; // [OWNER] leads to loader
|
||||
nsWeakPtr mDocumentLoadGroup; // [WEAK] leads to loader
|
||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal; // [OWNER]
|
||||
nsCOMPtr<nsIRDFResource> mRootResource; // [OWNER]
|
||||
nsCOMPtr<nsIContent> mRootContent; // [OWNER]
|
||||
@ -1303,7 +1304,7 @@ XULDocumentImpl::PrepareToLoad( nsCOMPtr<nsIParser>* created_parser,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef NECKO
|
||||
mDocumentLoadGroup = aLoadGroup;
|
||||
mDocumentLoadGroup = getter_AddRefs(NS_GetWeakReference(aLoadGroup));
|
||||
#else
|
||||
syntheticURL->GetLoadGroup(getter_AddRefs(mDocumentLoadGroup));
|
||||
#endif
|
||||
@ -1528,7 +1529,9 @@ XULDocumentImpl::GetDocumentPrincipal() const
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::GetDocumentLoadGroup(nsILoadGroup **aGroup) const
|
||||
{
|
||||
*aGroup = mDocumentLoadGroup;
|
||||
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
|
||||
|
||||
*aGroup = group;
|
||||
NS_IF_ADDREF(*aGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user