diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index b1e02558a6e..3d0c4835ff2 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -163,7 +163,8 @@ public: NS_IMETHOD LoadURL(const PRUnichar *aURLSpec, nsIPostData* aPostData=nsnull, PRBool aModifyHistory=PR_TRUE, - nsReloadType type = nsReload); + nsReloadType aType = nsReload, + const PRUint32 localIP = 0); NS_IMETHOD Stop(void); NS_IMETHOD Reload(nsReloadType aType); @@ -1033,7 +1034,8 @@ NS_IMETHODIMP nsWebShell::LoadURL(const PRUnichar *aURLSpec, nsIPostData* aPostData, PRBool aModifyHistory, - nsReloadType type) + nsReloadType aType, + const PRUint32 aLocalIP) { nsresult rv; PRInt32 colon, fSlash; @@ -1106,7 +1108,8 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec, aPostData, // Post Data nsnull, // Extra Info... this, // Observer - (PRInt32)type); // reload type + (PRInt32)aType, // reload type + aLocalIP); // load attributes. return rv; diff --git a/mozilla/uriloader/base/nsDocLoader.cpp b/mozilla/uriloader/base/nsDocLoader.cpp index b7608543836..c2b31f52458 100644 --- a/mozilla/uriloader/base/nsDocLoader.cpp +++ b/mozilla/uriloader/base/nsDocLoader.cpp @@ -39,6 +39,7 @@ #include "nsIDocumentLoadInfo.h" #include "nsVoidArray.h" #include "nsIHttpUrl.h" +#include "nsILoadAttribs.h" // XXX: Only needed for dummy factory... #include "nsIDocument.h" @@ -100,7 +101,8 @@ public: nsresult Bind(const nsString& aURLSpec, nsIPostData* aPostData, nsIStreamListener* aListener, - PRInt32 type = 0); + PRInt32 type = 0, + nsILoadAttribs* aLoadAttrib = nsnull); nsresult Stop(void); @@ -451,7 +453,8 @@ public: nsIPostData* aPostData = nsnull, nsISupports* aExtraInfo = nsnull, nsIStreamObserver* anObserver = nsnull, - PRInt32 type = 0); + PRInt32 type = 0, + const PRUint32 aLocalIP = 0); NS_IMETHOD LoadURL(const nsString& aURLSpec, nsIStreamListener* aListener); @@ -490,6 +493,8 @@ protected: nsDocLoaderImpl* mParent; nsISupportsArray* mChildDocLoaderList; nsVoidArray mObservers; + nsILoadAttribs* m_LoadAttrib; + }; @@ -501,7 +506,7 @@ nsDocLoaderImpl::nsDocLoaderImpl() NS_NewISupportsArray(&mChildDocLoaderList); mParent = nsnull; - + m_LoadAttrib = nsnull; m_DocFactory = new nsDocFactoryImpl(); NS_ADDREF(m_DocFactory); } @@ -515,6 +520,7 @@ nsDocLoaderImpl::~nsDocLoaderImpl() NS_IF_RELEASE(mChildDocLoaderList); NS_IF_RELEASE(m_LoadingDocsList); NS_IF_RELEASE(m_DocFactory); + NS_IF_RELEASE(m_LoadAttrib); } @@ -590,7 +596,8 @@ nsDocLoaderImpl::LoadURL(const nsString& aURLSpec, nsIPostData* aPostData, nsISupports* aExtraInfo, nsIStreamObserver* anObserver, - PRInt32 type) + PRInt32 type, + const PRUint32 aLocalIP) { nsresult rv; nsDocumentBindInfo* loader = nsnull; @@ -615,7 +622,27 @@ nsDocLoaderImpl::LoadURL(const nsString& aURLSpec, /* The DocumentBindInfo reference is only held by the Array... */ m_LoadingDocsList->AppendElement((nsIStreamListener *)loader); - rv = loader->Bind(aURLSpec, aPostData, nsnull, type); + // If we've got special loading instructions, mind them. + if ( (type == 2) || (type == 3) ) { + if (!m_LoadAttrib) { + rv = NS_NewLoadAttribs(&m_LoadAttrib); + if (rv != NS_OK) + return rv; + } + // type 2 and 3 correspond to proxy bypas + m_LoadAttrib->SetBypassProxy(PR_TRUE); + } + if ( aLocalIP ) { + if (!m_LoadAttrib) { + rv = NS_NewLoadAttribs(&m_LoadAttrib); + if (rv != NS_OK) + return rv; + } + + m_LoadAttrib->SetLocalIP(aLocalIP); + } + + rv = loader->Bind(aURLSpec, aPostData, nsnull, type, m_LoadAttrib); done: return rv; @@ -883,7 +910,8 @@ nsDocumentBindInfo::QueryInterface(const nsIID& aIID, nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec, nsIPostData* aPostData, nsIStreamListener* aListener, - PRInt32 type) + PRInt32 type, + nsILoadAttribs* aLoadAttrib) { nsresult rv; @@ -904,11 +932,15 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec, } } + if (aLoadAttrib) + m_Url->SetLoadAttribs(aLoadAttrib); + rv = m_Url->SetReloadType(type); if (rv != NS_OK) { return rv; } + /* Store any POST data into the URL */ if (nsnull != aPostData) { static NS_DEFINE_IID(kPostToServerIID, NS_IPOSTTOSERVER_IID); diff --git a/mozilla/webshell/public/nsIDocumentLoader.h b/mozilla/webshell/public/nsIDocumentLoader.h index 889ded632b2..49778731958 100644 --- a/mozilla/webshell/public/nsIDocumentLoader.h +++ b/mozilla/webshell/public/nsIDocumentLoader.h @@ -22,6 +22,7 @@ #include "nsweb.h" #include "prtypes.h" #include "nsISupports.h" +#include "nsILoadAttribs.h" /* Forward declarations... */ class nsString; @@ -72,7 +73,8 @@ public: nsIPostData* aPostData = nsnull, nsISupports* aExtraInfo = nsnull, nsIStreamObserver* anObserver = nsnull, - PRInt32 type = 0) = 0; + PRInt32 type = 0, + const PRUint32 aLocalIP = 0) = 0; NS_IMETHOD LoadURL(const nsString& aURLSpec, nsIStreamListener* aListener) = 0; diff --git a/mozilla/webshell/public/nsIWebShell.h b/mozilla/webshell/public/nsIWebShell.h index 27917f79ee0..25ec000dd60 100644 --- a/mozilla/webshell/public/nsIWebShell.h +++ b/mozilla/webshell/public/nsIWebShell.h @@ -78,7 +78,8 @@ public: typedef enum { nsReload, nsReloadBypassCache, - nsReloadBypassProxy + nsReloadBypassProxy, + nsReloadBypassCacheAndProxy } nsReloadType; // Return value from WillLoadURL @@ -149,7 +150,8 @@ public: NS_IMETHOD LoadURL(const PRUnichar *aURLSpec, nsIPostData* aPostData=nsnull, PRBool aModifyHistory=PR_TRUE, - nsReloadType type=nsReload) = 0; + nsReloadType aType=nsReload, + const PRUint32 aLocalIP=0) = 0; NS_IMETHOD Stop(void) = 0; NS_IMETHOD Reload(nsReloadType aType) = 0; diff --git a/mozilla/webshell/src/nsDocLoader.cpp b/mozilla/webshell/src/nsDocLoader.cpp index b7608543836..c2b31f52458 100644 --- a/mozilla/webshell/src/nsDocLoader.cpp +++ b/mozilla/webshell/src/nsDocLoader.cpp @@ -39,6 +39,7 @@ #include "nsIDocumentLoadInfo.h" #include "nsVoidArray.h" #include "nsIHttpUrl.h" +#include "nsILoadAttribs.h" // XXX: Only needed for dummy factory... #include "nsIDocument.h" @@ -100,7 +101,8 @@ public: nsresult Bind(const nsString& aURLSpec, nsIPostData* aPostData, nsIStreamListener* aListener, - PRInt32 type = 0); + PRInt32 type = 0, + nsILoadAttribs* aLoadAttrib = nsnull); nsresult Stop(void); @@ -451,7 +453,8 @@ public: nsIPostData* aPostData = nsnull, nsISupports* aExtraInfo = nsnull, nsIStreamObserver* anObserver = nsnull, - PRInt32 type = 0); + PRInt32 type = 0, + const PRUint32 aLocalIP = 0); NS_IMETHOD LoadURL(const nsString& aURLSpec, nsIStreamListener* aListener); @@ -490,6 +493,8 @@ protected: nsDocLoaderImpl* mParent; nsISupportsArray* mChildDocLoaderList; nsVoidArray mObservers; + nsILoadAttribs* m_LoadAttrib; + }; @@ -501,7 +506,7 @@ nsDocLoaderImpl::nsDocLoaderImpl() NS_NewISupportsArray(&mChildDocLoaderList); mParent = nsnull; - + m_LoadAttrib = nsnull; m_DocFactory = new nsDocFactoryImpl(); NS_ADDREF(m_DocFactory); } @@ -515,6 +520,7 @@ nsDocLoaderImpl::~nsDocLoaderImpl() NS_IF_RELEASE(mChildDocLoaderList); NS_IF_RELEASE(m_LoadingDocsList); NS_IF_RELEASE(m_DocFactory); + NS_IF_RELEASE(m_LoadAttrib); } @@ -590,7 +596,8 @@ nsDocLoaderImpl::LoadURL(const nsString& aURLSpec, nsIPostData* aPostData, nsISupports* aExtraInfo, nsIStreamObserver* anObserver, - PRInt32 type) + PRInt32 type, + const PRUint32 aLocalIP) { nsresult rv; nsDocumentBindInfo* loader = nsnull; @@ -615,7 +622,27 @@ nsDocLoaderImpl::LoadURL(const nsString& aURLSpec, /* The DocumentBindInfo reference is only held by the Array... */ m_LoadingDocsList->AppendElement((nsIStreamListener *)loader); - rv = loader->Bind(aURLSpec, aPostData, nsnull, type); + // If we've got special loading instructions, mind them. + if ( (type == 2) || (type == 3) ) { + if (!m_LoadAttrib) { + rv = NS_NewLoadAttribs(&m_LoadAttrib); + if (rv != NS_OK) + return rv; + } + // type 2 and 3 correspond to proxy bypas + m_LoadAttrib->SetBypassProxy(PR_TRUE); + } + if ( aLocalIP ) { + if (!m_LoadAttrib) { + rv = NS_NewLoadAttribs(&m_LoadAttrib); + if (rv != NS_OK) + return rv; + } + + m_LoadAttrib->SetLocalIP(aLocalIP); + } + + rv = loader->Bind(aURLSpec, aPostData, nsnull, type, m_LoadAttrib); done: return rv; @@ -883,7 +910,8 @@ nsDocumentBindInfo::QueryInterface(const nsIID& aIID, nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec, nsIPostData* aPostData, nsIStreamListener* aListener, - PRInt32 type) + PRInt32 type, + nsILoadAttribs* aLoadAttrib) { nsresult rv; @@ -904,11 +932,15 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec, } } + if (aLoadAttrib) + m_Url->SetLoadAttribs(aLoadAttrib); + rv = m_Url->SetReloadType(type); if (rv != NS_OK) { return rv; } + /* Store any POST data into the URL */ if (nsnull != aPostData) { static NS_DEFINE_IID(kPostToServerIID, NS_IPOSTTOSERVER_IID); diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index b1e02558a6e..3d0c4835ff2 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -163,7 +163,8 @@ public: NS_IMETHOD LoadURL(const PRUnichar *aURLSpec, nsIPostData* aPostData=nsnull, PRBool aModifyHistory=PR_TRUE, - nsReloadType type = nsReload); + nsReloadType aType = nsReload, + const PRUint32 localIP = 0); NS_IMETHOD Stop(void); NS_IMETHOD Reload(nsReloadType aType); @@ -1033,7 +1034,8 @@ NS_IMETHODIMP nsWebShell::LoadURL(const PRUnichar *aURLSpec, nsIPostData* aPostData, PRBool aModifyHistory, - nsReloadType type) + nsReloadType aType, + const PRUint32 aLocalIP) { nsresult rv; PRInt32 colon, fSlash; @@ -1106,7 +1108,8 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec, aPostData, // Post Data nsnull, // Extra Info... this, // Observer - (PRInt32)type); // reload type + (PRInt32)aType, // reload type + aLocalIP); // load attributes. return rv; diff --git a/mozilla/webshell/tests/ComFactory/makefile.win b/mozilla/webshell/tests/ComFactory/makefile.win index de480d79e22..697473cec0f 100644 --- a/mozilla/webshell/tests/ComFactory/makefile.win +++ b/mozilla/webshell/tests/ComFactory/makefile.win @@ -73,7 +73,8 @@ LLIBS=$(LLIBS) ole32.lib LINCS=$(LINCS) -I. \ -I$(PUBLIC)\raptor \ - -I$(PUBLIC)\xpcom + -I$(PUBLIC)\xpcom \ + -I$(PUBLIC)\netlib # clobber and clobber_all will remove the following garbage: GARBAGE = $(GARBAGE) _gen