M webshell/public/nsIDocumentLoader.h

nsIDocumentLoader interface method change to LoadURL() we now accept a local ip address.


M webshell/public/nsIWebShell.h
1. Extended the nsIWebShell LoadURL() method to take an additional PRUint32 parameter which represents an ip address. If specified, this address will be bound to the socket prior to connection as the local/client ip address to be used. The caller is guarantees the validity of this address.
2. Extended the nsReloadType enumeration to allow both proxy and cache bypass.


M webshell/src/nsDocLoader.cpp
1. Extended nsDocumentBindInfo::Bind() to take an additional nsILoadAttribs pointer. (class definitaion change and implementation).

2. Extended nsDocLoaderImpl::LoadURL() to take an additional PRUint32 param which represents an optional local ip address to bind the connecting socket to, prior to connection. (class definitaion change and implementation) The docloader object maintains a pointer to an nsILoadAttribs interface.


M webshell/src/nsWebShell.cpp
Implemented new LoadURL() routine. Simple pass down to doc loader of PRUint32.


M webshell/tests/ComFactory/makefile.win
Added netlib to the list of prerequisites.


git-svn-id: svn://10.0.0.236/trunk@10104 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
valeski%netscape.com
1998-09-16 00:40:20 +00:00
parent 04aa3caab1
commit 893604c431
7 changed files with 97 additions and 22 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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