RAPTOR ONLY CHECKIN
network/module/nsIURL.h Added Get/Set ReloadType methods so a user can query/set the reload type for the url. The default is normal reload. network/module/nsURL.cpp Added support for the new nsIURL interface methods (Get/Set ReloadType). network/module/nsNetService.cpp OpenStream and OpenBlockingStream now query the nsIURL for it's reload type before creating the url struct. This way we can control how the url is loaded. git-svn-id: svn://10.0.0.236/trunk@8210 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -47,6 +47,8 @@ public:
|
||||
|
||||
virtual nsresult Set(const char *aNewSpec) = 0;
|
||||
|
||||
virtual nsresult SetReloadType(const PRInt32 type) = 0;
|
||||
|
||||
/** Accessors */
|
||||
//@{
|
||||
/**
|
||||
@@ -71,7 +73,11 @@ public:
|
||||
/** @return ref part of the URL */
|
||||
virtual PRInt32 GetPort() const = 0;
|
||||
|
||||
/** @return the nsISupports pointer to a container */
|
||||
virtual nsISupports* GetContainer() const = 0;
|
||||
|
||||
/** @return the reload type for this url */
|
||||
virtual PRInt32 GetReloadType() const = 0;
|
||||
//@}
|
||||
|
||||
/** Write the URL to aString, overwriting previous contents. */
|
||||
|
||||
@@ -192,6 +192,7 @@ nsresult nsNetlibService::OpenStream(nsIURL *aUrl,
|
||||
nsConnectionInfo *pConn;
|
||||
nsIProtocolConnection *pProtocol;
|
||||
nsresult result;
|
||||
NET_ReloadMethod reloadType;
|
||||
|
||||
if ((NULL == aConsumer) || (NULL == aUrl)) {
|
||||
return NS_FALSE;
|
||||
@@ -213,7 +214,19 @@ nsresult nsNetlibService::OpenStream(nsIURL *aUrl,
|
||||
}
|
||||
|
||||
/* Create the URLStruct... */
|
||||
URL_s = NET_CreateURLStruct(aUrl->GetSpec(), NET_NORMAL_RELOAD);
|
||||
|
||||
/* Set the NET_ReloadMethod to correspond with what we've
|
||||
* been asked to do.
|
||||
*
|
||||
* 0 = nsReload (normal)
|
||||
* 1 = nsReloadBypassCache
|
||||
* 2 = nsReloadBypassProxy
|
||||
*/
|
||||
if (aUrl->GetReloadType() == 1)
|
||||
reloadType = NET_SUPER_RELOAD;
|
||||
else
|
||||
reloadType = NET_NORMAL_RELOAD;
|
||||
URL_s = NET_CreateURLStruct(aUrl->GetSpec(), reloadType);
|
||||
if (NULL == URL_s) {
|
||||
pConn->Release();
|
||||
return NS_FALSE;
|
||||
@@ -289,6 +302,8 @@ nsresult nsNetlibService::OpenBlockingStream(nsIURL *aUrl,
|
||||
if (NULL != aUrl) {
|
||||
/* Create the blocking stream... */
|
||||
pBlockingStream = new nsBlockingStream();
|
||||
NET_ReloadMethod reloadType;
|
||||
|
||||
if (NULL == pBlockingStream) {
|
||||
goto loser;
|
||||
}
|
||||
@@ -315,7 +330,20 @@ nsresult nsNetlibService::OpenBlockingStream(nsIURL *aUrl,
|
||||
}
|
||||
|
||||
/* Create the URLStruct... */
|
||||
URL_s = NET_CreateURLStruct(aUrl->GetSpec(), NET_NORMAL_RELOAD);
|
||||
|
||||
/* Set the NET_ReloadMethod to correspond with what we've
|
||||
* been asked to do.
|
||||
*
|
||||
* 0 = nsReload (normal)
|
||||
* 1 = nsReloadBypassCache
|
||||
* 2 = nsReloadBypassProxy
|
||||
*/
|
||||
if (aUrl->GetReloadType() == 1)
|
||||
reloadType = NET_SUPER_RELOAD;
|
||||
else
|
||||
reloadType = NET_NORMAL_RELOAD;
|
||||
|
||||
URL_s = NET_CreateURLStruct(aUrl->GetSpec(), reloadType);
|
||||
if (NULL == URL_s) {
|
||||
pBlockingStream->Release();
|
||||
pConn->Release();
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
|
||||
virtual PRBool operator==(const nsIURL& aURL) const;
|
||||
virtual nsresult Set(const char *aNewSpec);
|
||||
virtual nsresult SetReloadType(const PRInt32 type);
|
||||
|
||||
virtual const char* GetProtocol() const;
|
||||
virtual const char* GetHost() const;
|
||||
@@ -57,6 +58,7 @@ public:
|
||||
virtual const char* GetSpec() const;
|
||||
virtual PRInt32 GetPort() const;
|
||||
virtual nsISupports* GetContainer() const;
|
||||
virtual PRInt32 GetReloadType() const;
|
||||
|
||||
virtual void ToString(nsString& aString) const;
|
||||
|
||||
@@ -67,6 +69,12 @@ public:
|
||||
char* mRef;
|
||||
char* mSearch;
|
||||
nsISupports* mContainer;
|
||||
|
||||
// The reload type can be set to one of the following.
|
||||
// 0 - normal reload (uses cache) (defined as nsReload in nsIWebShell.h)
|
||||
// 1 - bypass the cache (defined as nsReloadBypassCache)
|
||||
// 2 - bypass the proxy (not yet implemented) (defined as nsReloadBypassProxy)
|
||||
PRInt32 mReloadType;
|
||||
PRInt32 mPort;
|
||||
PRBool mOK;
|
||||
|
||||
@@ -89,6 +97,7 @@ URLImpl::URLImpl(const nsString& aSpec)
|
||||
mPort = -1;
|
||||
mSpec = nsnull;
|
||||
mContainer = nsnull;
|
||||
mReloadType = 0;
|
||||
|
||||
ParseURL(nsnull, aSpec);
|
||||
}
|
||||
@@ -128,6 +137,7 @@ URLImpl::URLImpl(const nsIURL* aURL, const nsString& aSpec)
|
||||
mPort = -1;
|
||||
mSpec = nsnull;
|
||||
mContainer = nsnull;
|
||||
mReloadType = 0;
|
||||
|
||||
ParseURL(aURL, aSpec);
|
||||
}
|
||||
@@ -181,6 +191,14 @@ nsresult URLImpl::Set(const char *aNewSpec)
|
||||
return ParseURL(nsnull, aNewSpec);
|
||||
}
|
||||
|
||||
nsresult URLImpl::SetReloadType(const PRInt32 type)
|
||||
{
|
||||
if ( !((type >= 0) && (type <= 2)) )
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
mReloadType = type;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
PRBool URLImpl::operator==(const nsIURL& aURL) const
|
||||
{
|
||||
@@ -230,6 +248,11 @@ nsISupports* URLImpl::GetContainer() const
|
||||
return mContainer;
|
||||
}
|
||||
|
||||
PRInt32 URLImpl::GetReloadType() const
|
||||
{
|
||||
return mReloadType;
|
||||
}
|
||||
|
||||
void URLImpl::ToString(nsString& aString) const
|
||||
{
|
||||
aString.SetLength(0);
|
||||
|
||||
Reference in New Issue
Block a user