зеркало из https://github.com/mozilla/gecko-dev.git
Added a load type and reload type to the nsILoadAttribs interface and underlying implementation...
This commit is contained in:
Родитель
55209f7385
Коммит
a8689af8b1
|
@ -29,19 +29,52 @@
|
||||||
#define NS_ILOAD_ATTRIBS_IID \
|
#define NS_ILOAD_ATTRIBS_IID \
|
||||||
{ 0x8942d321, 0x48d3, 0x11d2,{0x9e, 0x7a, 0x00, 0x60, 0x08, 0xbf, 0x09, 0x2e}}
|
{ 0x8942d321, 0x48d3, 0x11d2,{0x9e, 0x7a, 0x00, 0x60, 0x08, 0xbf, 0x09, 0x2e}}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The nsReloadType represents the following:
|
||||||
|
* nsURLReload - normal reload (uses cache)
|
||||||
|
* nsURLReloadBypassCache - bypass the cache
|
||||||
|
* nsURLReloadBypassCacheAndProxy - bypass the proxy (not yet implemented)
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
nsURLReload = 0,
|
||||||
|
nsURLReloadBypassCache,
|
||||||
|
nsURLReloadBypassProxy,
|
||||||
|
nsURLReloadBypassCacheAndProxy,
|
||||||
|
nsURLReloadMax
|
||||||
|
} nsURLReloadType;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The nsLoadType represents the following:
|
||||||
|
* nsURLLoadNormal - Load the URL normally.
|
||||||
|
* nsURLLoadBackground - Supress all notifications when loading the URL.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
nsURLLoadNormal = 0,
|
||||||
|
nsURLLoadBackground,
|
||||||
|
nsURLLoadMax
|
||||||
|
} nsURLLoadType;
|
||||||
|
|
||||||
// Defining attributes of a url's load behavior.
|
// Defining attributes of a url's load behavior.
|
||||||
class nsILoadAttribs : public nsISupports {
|
class nsILoadAttribs : public nsISupports {
|
||||||
public:
|
public:
|
||||||
// Copy the state of another nsILoadAttribs instance.
|
// Copy the state of another nsILoadAttribs instance.
|
||||||
NS_IMETHOD Clone(nsILoadAttribs* aLoadAttribs) = 0;
|
NS_IMETHOD Clone(nsILoadAttribs* aLoadAttribs) = 0;
|
||||||
|
|
||||||
// Bypass Proxy.
|
// Bypass Proxy.
|
||||||
NS_IMETHOD SetBypassProxy(PRBool aBypass) = 0;
|
NS_IMETHOD SetBypassProxy(PRBool aBypass) = 0;
|
||||||
NS_IMETHOD GetBypassProxy(PRBool *aBypass) = 0;
|
NS_IMETHOD GetBypassProxy(PRBool *aBypass) = 0;
|
||||||
|
|
||||||
// Local IP address.
|
// Local IP address.
|
||||||
NS_IMETHOD SetLocalIP(const PRUint32 aLocalIP) = 0;
|
NS_IMETHOD SetLocalIP(const PRUint32 aLocalIP) = 0;
|
||||||
NS_IMETHOD GetLocalIP(PRUint32 *aLocalIP) = 0;
|
NS_IMETHOD GetLocalIP(PRUint32 *aLocalIP) = 0;
|
||||||
|
|
||||||
|
// Reload method.
|
||||||
|
NS_IMETHOD SetReloadType(nsURLReloadType aType) = 0;
|
||||||
|
NS_IMETHOD GetReloadType(nsURLReloadType* aResult) = 0;
|
||||||
|
|
||||||
|
// Load method
|
||||||
|
NS_IMETHOD SetLoadType(nsURLLoadType aType) = 0;
|
||||||
|
NS_IMETHOD GetLoadType(nsURLLoadType* aResult) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Creation routines. */
|
/* Creation routines. */
|
||||||
|
|
|
@ -49,8 +49,6 @@ public:
|
||||||
|
|
||||||
virtual nsresult Set(const char *aNewSpec) = 0;
|
virtual nsresult Set(const char *aNewSpec) = 0;
|
||||||
|
|
||||||
virtual nsresult SetReloadType(const PRInt32 type) = 0;
|
|
||||||
|
|
||||||
virtual nsresult SetLoadAttribs(nsILoadAttribs *aLoadAttrib) = 0;
|
virtual nsresult SetLoadAttribs(nsILoadAttribs *aLoadAttrib) = 0;
|
||||||
|
|
||||||
/** Accessors */
|
/** Accessors */
|
||||||
|
@ -80,9 +78,6 @@ public:
|
||||||
/** @return the nsISupports pointer to a container */
|
/** @return the nsISupports pointer to a container */
|
||||||
virtual nsISupports* GetContainer() const = 0;
|
virtual nsISupports* GetContainer() const = 0;
|
||||||
|
|
||||||
/** @return the reload type for this url */
|
|
||||||
virtual PRInt32 GetReloadType() const = 0;
|
|
||||||
|
|
||||||
/** @return the loadAttributes pointer */
|
/** @return the loadAttributes pointer */
|
||||||
virtual nsILoadAttribs* GetLoadAttribs() const = 0;
|
virtual nsILoadAttribs* GetLoadAttribs() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -29,24 +29,34 @@
|
||||||
// nsLoadAttribs definition.
|
// nsLoadAttribs definition.
|
||||||
class nsLoadAttribs : public nsILoadAttribs {
|
class nsLoadAttribs : public nsILoadAttribs {
|
||||||
public:
|
public:
|
||||||
nsLoadAttribs();
|
nsLoadAttribs();
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
// nsILoadAttribs
|
// nsILoadAttribs
|
||||||
NS_IMETHOD Clone(nsILoadAttribs* aLoadAttribs);
|
NS_IMETHOD Clone(nsILoadAttribs* aLoadAttribs);
|
||||||
NS_IMETHOD SetBypassProxy(PRBool aBypass);
|
|
||||||
NS_IMETHOD GetBypassProxy(PRBool *aBypass);
|
NS_IMETHOD SetBypassProxy(PRBool aBypass);
|
||||||
NS_IMETHOD SetLocalIP(const PRUint32 aIP);
|
NS_IMETHOD GetBypassProxy(PRBool *aBypass);
|
||||||
NS_IMETHOD GetLocalIP(PRUint32 *aIP);
|
|
||||||
|
NS_IMETHOD SetLocalIP(const PRUint32 aIP);
|
||||||
|
NS_IMETHOD GetLocalIP(PRUint32 *aIP);
|
||||||
|
|
||||||
|
NS_IMETHOD SetReloadType(nsURLReloadType aType);
|
||||||
|
NS_IMETHOD GetReloadType(nsURLReloadType* aResult);
|
||||||
|
|
||||||
|
NS_IMETHOD SetLoadType(nsURLLoadType aType);
|
||||||
|
NS_IMETHOD GetLoadType(nsURLLoadType* aResult);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsLoadAttribs();
|
virtual ~nsLoadAttribs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PRBool mBypass;
|
PRBool mBypass;
|
||||||
PRUint32 mLocalIP;
|
PRUint32 mLocalIP;
|
||||||
|
nsURLLoadType mLoadType;
|
||||||
|
nsURLReloadType mReloadType;
|
||||||
};
|
};
|
||||||
|
|
||||||
// nsLoadAttribs Implementation
|
// nsLoadAttribs Implementation
|
||||||
|
@ -54,80 +64,146 @@ private:
|
||||||
static NS_DEFINE_IID(kILoadAttribsIID, NS_ILOAD_ATTRIBS_IID);
|
static NS_DEFINE_IID(kILoadAttribsIID, NS_ILOAD_ATTRIBS_IID);
|
||||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsLoadAttribs, kILoadAttribsIID);
|
NS_IMPL_THREADSAFE_ISUPPORTS(nsLoadAttribs, kILoadAttribsIID);
|
||||||
|
|
||||||
nsLoadAttribs::nsLoadAttribs() {
|
nsLoadAttribs::nsLoadAttribs()
|
||||||
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mBypass = PR_FALSE;
|
|
||||||
mLocalIP = 0;
|
mBypass = PR_FALSE;
|
||||||
|
mLocalIP = 0;
|
||||||
|
mLoadType = nsURLLoadNormal;
|
||||||
|
mReloadType = nsURLReload;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsLoadAttribs::~nsLoadAttribs() {
|
nsLoadAttribs::~nsLoadAttribs()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsLoadAttribs::Clone(nsILoadAttribs* aLoadAttribs)
|
nsLoadAttribs::Clone(nsILoadAttribs* aLoadAttribs)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (nsnull == aLoadAttribs) {
|
if (nsnull == aLoadAttribs) {
|
||||||
rv = NS_ERROR_NULL_POINTER;
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
} else {
|
} else {
|
||||||
PRBool bypass;
|
|
||||||
PRUint32 ip;
|
|
||||||
|
|
||||||
NS_LOCK_INSTANCE();
|
|
||||||
aLoadAttribs->GetBypassProxy(&bypass);
|
|
||||||
SetBypassProxy(bypass);
|
|
||||||
|
|
||||||
aLoadAttribs->GetLocalIP(&ip);
|
|
||||||
SetLocalIP(ip);
|
|
||||||
NS_UNLOCK_INSTANCE();
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsLoadAttribs::SetBypassProxy(PRBool aBypass) {
|
|
||||||
NS_LOCK_INSTANCE();
|
NS_LOCK_INSTANCE();
|
||||||
mBypass = aBypass;
|
|
||||||
|
aLoadAttribs->GetBypassProxy(&mBypass);
|
||||||
|
aLoadAttribs->GetLocalIP(&mLocalIP);
|
||||||
|
aLoadAttribs->GetReloadType(&mReloadType);
|
||||||
|
|
||||||
NS_UNLOCK_INSTANCE();
|
NS_UNLOCK_INSTANCE();
|
||||||
return NS_OK;
|
}
|
||||||
|
return rv;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsLoadAttribs::GetBypassProxy(PRBool *aBypass) {
|
nsLoadAttribs::SetBypassProxy(PRBool aBypass)
|
||||||
nsresult rv = NS_OK;
|
{
|
||||||
|
NS_LOCK_INSTANCE();
|
||||||
if (nsnull == aBypass) {
|
mBypass = aBypass;
|
||||||
rv = NS_ERROR_NULL_POINTER;
|
NS_UNLOCK_INSTANCE();
|
||||||
} else {
|
return NS_OK;
|
||||||
NS_LOCK_INSTANCE();
|
|
||||||
*aBypass = mBypass;
|
|
||||||
NS_UNLOCK_INSTANCE();
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsLoadAttribs::SetLocalIP(const PRUint32 aLocalIP) {
|
nsLoadAttribs::GetBypassProxy(PRBool *aBypass)
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
if (nsnull == aBypass) {
|
||||||
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
|
} else {
|
||||||
NS_LOCK_INSTANCE();
|
NS_LOCK_INSTANCE();
|
||||||
mLocalIP = aLocalIP;
|
*aBypass = mBypass;
|
||||||
NS_UNLOCK_INSTANCE();
|
NS_UNLOCK_INSTANCE();
|
||||||
return NS_OK;
|
}
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsLoadAttribs::GetLocalIP(PRUint32 *aLocalIP) {
|
nsLoadAttribs::SetLocalIP(const PRUint32 aLocalIP)
|
||||||
nsresult rv = NS_OK;
|
{
|
||||||
|
NS_LOCK_INSTANCE();
|
||||||
|
mLocalIP = aLocalIP;
|
||||||
|
NS_UNLOCK_INSTANCE();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (nsnull == aLocalIP) {
|
NS_IMETHODIMP
|
||||||
rv = NS_ERROR_NULL_POINTER;
|
nsLoadAttribs::GetLocalIP(PRUint32 *aLocalIP)
|
||||||
} else {
|
{
|
||||||
NS_LOCK_INSTANCE();
|
nsresult rv = NS_OK;
|
||||||
*aLocalIP = mLocalIP;
|
|
||||||
NS_UNLOCK_INSTANCE();
|
if (nsnull == aLocalIP) {
|
||||||
}
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
return rv;
|
} else {
|
||||||
|
NS_LOCK_INSTANCE();
|
||||||
|
*aLocalIP = mLocalIP;
|
||||||
|
NS_UNLOCK_INSTANCE();
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsLoadAttribs::SetReloadType(nsURLReloadType aType)
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
if ((aType < nsURLReload) || (aType >= nsURLReloadMax)) {
|
||||||
|
rv = NS_ERROR_ILLEGAL_VALUE;
|
||||||
|
} else {
|
||||||
|
NS_LOCK_INSTANCE();
|
||||||
|
mReloadType = aType;
|
||||||
|
NS_UNLOCK_INSTANCE();
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsLoadAttribs::GetReloadType(nsURLReloadType* aResult)
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
if (nsnull == aResult) {
|
||||||
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
|
} else {
|
||||||
|
NS_LOCK_INSTANCE();
|
||||||
|
*aResult = mReloadType;
|
||||||
|
NS_UNLOCK_INSTANCE();
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsLoadAttribs::SetLoadType(nsURLLoadType aType)
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
if ((aType < nsURLLoadNormal) || (aType >= nsURLLoadMax)) {
|
||||||
|
rv = NS_ERROR_ILLEGAL_VALUE;
|
||||||
|
} else {
|
||||||
|
NS_LOCK_INSTANCE();
|
||||||
|
mLoadType = aType;
|
||||||
|
NS_UNLOCK_INSTANCE();
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsLoadAttribs::GetLoadType(nsURLLoadType* aResult)
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
if (nsnull == aResult) {
|
||||||
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
|
} else {
|
||||||
|
NS_LOCK_INSTANCE();
|
||||||
|
*aResult = mLoadType;
|
||||||
|
NS_UNLOCK_INSTANCE();
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creation routines
|
// Creation routines
|
||||||
|
|
|
@ -189,45 +189,68 @@ nsNetlibService::~nsNetlibService()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void nsNetlibService::SetupURLStruct(nsIURL *aUrl, URL_Struct *aURL_s) {
|
void nsNetlibService::SetupURLStruct(nsIURL *aUrl, URL_Struct *aURL_s)
|
||||||
nsresult result;
|
{
|
||||||
NET_ReloadMethod reloadType;
|
nsresult rv;
|
||||||
nsILoadAttribs* loadAttribs = aUrl->GetLoadAttribs();
|
nsILoadAttribs* loadAttribs = aUrl->GetLoadAttribs();
|
||||||
PRInt32 type = aUrl->GetReloadType();
|
|
||||||
|
|
||||||
|
|
||||||
|
/* If this url has load attributes, setup the underlying url struct
|
||||||
|
* accordingly. */
|
||||||
|
if (loadAttribs) {
|
||||||
|
nsURLLoadType loadType;
|
||||||
|
nsURLReloadType reloadType;
|
||||||
|
PRUint32 localIP;
|
||||||
|
|
||||||
|
NS_VERIFY_THREADSAFE_INTERFACE(loadAttribs);
|
||||||
|
|
||||||
|
rv = loadAttribs->GetReloadType(&reloadType);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
reloadType = nsURLReload;
|
||||||
|
}
|
||||||
|
if ((reloadType == nsURLReloadBypassProxy) ||
|
||||||
|
(reloadType == nsURLReloadBypassCacheAndProxy)) {
|
||||||
|
PRBool bBypassProxy;
|
||||||
|
|
||||||
|
rv = loadAttribs->GetBypassProxy(&bBypassProxy);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
bBypassProxy = PR_FALSE;
|
||||||
|
}
|
||||||
|
aURL_s->bypassProxy = bBypassProxy;
|
||||||
|
}
|
||||||
/* Set the NET_ReloadMethod to correspond with what we've
|
/* Set the NET_ReloadMethod to correspond with what we've
|
||||||
* been asked to do.
|
* been asked to do.
|
||||||
*
|
*
|
||||||
* 0 = nsReload (normal)
|
* 0 = nsURLReload (normal)
|
||||||
* 1 = nsReloadBypassCache
|
* 1 = nsURLReloadBypassCache
|
||||||
* 2 = nsReloadBypassProxy
|
* 2 = nsURLReloadBypassProxy
|
||||||
* 3 = nsReloadBypassCacheAndProxy
|
* 3 = nsURLReloadBypassCacheAndProxy
|
||||||
*/
|
*/
|
||||||
if (type == 1 || type == 3) {
|
if ((reloadType == nsURLReloadBypassCache) ||
|
||||||
reloadType = NET_SUPER_RELOAD;
|
(reloadType == nsURLReloadBypassCacheAndProxy)) {
|
||||||
|
aURL_s->force_reload = NET_SUPER_RELOAD;
|
||||||
} else {
|
} else {
|
||||||
reloadType = NET_NORMAL_RELOAD;
|
aURL_s->force_reload = NET_NORMAL_RELOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rv = loadAttribs->GetLoadType(&loadType);
|
||||||
/* If this url has load attributes, setup the underlying url struct
|
if (NS_FAILED(rv)) {
|
||||||
* accordingly. */
|
loadType = nsURLLoadNormal;
|
||||||
if (loadAttribs) {
|
|
||||||
PRUint32 localIP = 0;
|
|
||||||
|
|
||||||
NS_VERIFY_THREADSAFE_INTERFACE(loadAttribs);
|
|
||||||
if (type == 2 || type == 3) {
|
|
||||||
result = loadAttribs->GetBypassProxy((int *)&(aURL_s->bypassProxy));
|
|
||||||
if (result != NS_OK)
|
|
||||||
aURL_s->bypassProxy = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = loadAttribs->GetLocalIP(&localIP);
|
|
||||||
if (result != NS_OK)
|
|
||||||
localIP = 0;
|
|
||||||
aURL_s->localIP = localIP;
|
|
||||||
NS_RELEASE(loadAttribs);
|
|
||||||
}
|
}
|
||||||
|
if (loadType == nsURLLoadBackground) {
|
||||||
|
aURL_s->load_background = PR_TRUE;
|
||||||
|
} else {
|
||||||
|
aURL_s->load_background = PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
rv = loadAttribs->GetLocalIP(&localIP);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
localIP = 0;
|
||||||
|
}
|
||||||
|
aURL_s->localIP = localIP;
|
||||||
|
|
||||||
|
NS_RELEASE(loadAttribs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsNetlibService::OpenStream(nsIURL *aUrl,
|
nsresult nsNetlibService::OpenStream(nsIURL *aUrl,
|
||||||
|
@ -237,7 +260,6 @@ nsresult nsNetlibService::OpenStream(nsIURL *aUrl,
|
||||||
nsConnectionInfo *pConn;
|
nsConnectionInfo *pConn;
|
||||||
nsIProtocolConnection *pProtocol;
|
nsIProtocolConnection *pProtocol;
|
||||||
nsresult result;
|
nsresult result;
|
||||||
NET_ReloadMethod reloadType;
|
|
||||||
nsIStreamListener* consumer;
|
nsIStreamListener* consumer;
|
||||||
|
|
||||||
if ((NULL == aConsumer) || (NULL == aUrl)) {
|
if ((NULL == aConsumer) || (NULL == aUrl)) {
|
||||||
|
@ -280,7 +302,7 @@ nsresult nsNetlibService::OpenStream(nsIURL *aUrl,
|
||||||
|
|
||||||
/* Create the URLStruct... */
|
/* Create the URLStruct... */
|
||||||
|
|
||||||
URL_s = NET_CreateURLStruct(aUrl->GetSpec(), reloadType);
|
URL_s = NET_CreateURLStruct(aUrl->GetSpec(), NET_NORMAL_RELOAD);
|
||||||
if (NULL == URL_s) {
|
if (NULL == URL_s) {
|
||||||
NS_RELEASE(pConn);
|
NS_RELEASE(pConn);
|
||||||
return NS_FALSE;
|
return NS_FALSE;
|
||||||
|
@ -366,7 +388,6 @@ nsresult nsNetlibService::OpenBlockingStream(nsIURL *aUrl,
|
||||||
|
|
||||||
/* Create the blocking stream... */
|
/* Create the blocking stream... */
|
||||||
pBlockingStream = new nsBlockingStream();
|
pBlockingStream = new nsBlockingStream();
|
||||||
NET_ReloadMethod reloadType;
|
|
||||||
|
|
||||||
if (NULL == pBlockingStream) {
|
if (NULL == pBlockingStream) {
|
||||||
goto loser;
|
goto loser;
|
||||||
|
@ -404,7 +425,7 @@ nsresult nsNetlibService::OpenBlockingStream(nsIURL *aUrl,
|
||||||
|
|
||||||
/* Create the URLStruct... */
|
/* Create the URLStruct... */
|
||||||
|
|
||||||
URL_s = NET_CreateURLStruct(aUrl->GetSpec(), reloadType);
|
URL_s = NET_CreateURLStruct(aUrl->GetSpec(), NET_NORMAL_RELOAD);
|
||||||
if (NULL == URL_s) {
|
if (NULL == URL_s) {
|
||||||
NS_RELEASE(pBlockingStream);
|
NS_RELEASE(pBlockingStream);
|
||||||
NS_RELEASE(pConn);
|
NS_RELEASE(pConn);
|
||||||
|
|
|
@ -52,7 +52,6 @@ public:
|
||||||
|
|
||||||
virtual PRBool operator==(const nsIURL& aURL) const;
|
virtual PRBool operator==(const nsIURL& aURL) const;
|
||||||
virtual nsresult Set(const char *aNewSpec);
|
virtual nsresult Set(const char *aNewSpec);
|
||||||
virtual nsresult SetReloadType(const PRInt32 type);
|
|
||||||
virtual nsresult SetLoadAttribs(nsILoadAttribs *aLoadAttrib);
|
virtual nsresult SetLoadAttribs(nsILoadAttribs *aLoadAttrib);
|
||||||
|
|
||||||
virtual const char* GetProtocol() const;
|
virtual const char* GetProtocol() const;
|
||||||
|
@ -63,7 +62,6 @@ public:
|
||||||
virtual const char* GetSpec() const;
|
virtual const char* GetSpec() const;
|
||||||
virtual PRInt32 GetPort() const;
|
virtual PRInt32 GetPort() const;
|
||||||
virtual nsISupports* GetContainer() const;
|
virtual nsISupports* GetContainer() const;
|
||||||
virtual PRInt32 GetReloadType() const;
|
|
||||||
virtual nsILoadAttribs* GetLoadAttribs() const;
|
virtual nsILoadAttribs* GetLoadAttribs() const;
|
||||||
virtual nsIURLGroup* GetURLGroup() const;
|
virtual nsIURLGroup* GetURLGroup() const;
|
||||||
|
|
||||||
|
@ -79,11 +77,6 @@ public:
|
||||||
nsILoadAttribs* mLoadAttribs;
|
nsILoadAttribs* mLoadAttribs;
|
||||||
nsIURLGroup* mURLGroup;
|
nsIURLGroup* mURLGroup;
|
||||||
|
|
||||||
// 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;
|
PRInt32 mPort;
|
||||||
|
|
||||||
nsISupports* mProtocolUrl;
|
nsISupports* mProtocolUrl;
|
||||||
|
@ -114,7 +107,6 @@ void URLImpl::Init(nsISupports* aContainer, nsIURLGroup* aGroup)
|
||||||
mSearch = nsnull;
|
mSearch = nsnull;
|
||||||
mPort = -1;
|
mPort = -1;
|
||||||
mSpec = nsnull;
|
mSpec = nsnull;
|
||||||
mReloadType = 0;
|
|
||||||
mLoadAttribs = nsnull;
|
mLoadAttribs = nsnull;
|
||||||
|
|
||||||
mURLGroup = aGroup;
|
mURLGroup = aGroup;
|
||||||
|
@ -194,20 +186,6 @@ nsresult URLImpl::Set(const char *aNewSpec)
|
||||||
return ParseURL(nsnull, aNewSpec);
|
return ParseURL(nsnull, aNewSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult URLImpl::SetReloadType(const PRInt32 type)
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
|
|
||||||
if ( !((type >= 0) && (type <= 2)) ) {
|
|
||||||
rv = NS_ERROR_ILLEGAL_VALUE;
|
|
||||||
} else {
|
|
||||||
NS_LOCK_INSTANCE();
|
|
||||||
mReloadType = type;
|
|
||||||
NS_UNLOCK_INSTANCE();
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult URLImpl::SetLoadAttribs(nsILoadAttribs *aLoadAttrib)
|
nsresult URLImpl::SetLoadAttribs(nsILoadAttribs *aLoadAttrib)
|
||||||
{
|
{
|
||||||
NS_LOCK_INSTANCE();
|
NS_LOCK_INSTANCE();
|
||||||
|
@ -322,17 +300,6 @@ nsISupports* URLImpl::GetContainer() const
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 URLImpl::GetReloadType() const
|
|
||||||
{
|
|
||||||
PRInt32 reloadType;
|
|
||||||
|
|
||||||
NS_LOCK_INSTANCE();
|
|
||||||
reloadType = mReloadType;
|
|
||||||
NS_UNLOCK_INSTANCE();
|
|
||||||
|
|
||||||
return reloadType;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsILoadAttribs* URLImpl::GetLoadAttribs() const
|
nsILoadAttribs* URLImpl::GetLoadAttribs() const
|
||||||
{
|
{
|
||||||
nsILoadAttribs* loadAttribs;
|
nsILoadAttribs* loadAttribs;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче