зеркало из https://github.com/mozilla/pjs.git
Make nsResURL work correctly with fastload and make nsResURL::Clone work correctly. b=252703 r=darin sr=bzbarsky
This commit is contained in:
Родитель
8335dab53b
Коммит
32cee2f7a7
|
@ -1511,11 +1511,18 @@ nsStandardURL::SchemeIs(const char *scheme, PRBool *result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::Clone(nsIURI **result)
|
||||
/* virtual */ nsStandardURL*
|
||||
nsStandardURL::StartClone()
|
||||
{
|
||||
nsStandardURL *clone;
|
||||
NS_NEWXPCOM(clone, nsStandardURL);
|
||||
return clone;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::Clone(nsIURI **result)
|
||||
{
|
||||
nsStandardURL *clone = StartClone();
|
||||
if (!clone)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
|
|
@ -140,6 +140,9 @@ public: /* internal -- HPUX compiler can't handle this being private */
|
|||
};
|
||||
friend class nsSegmentEncoder;
|
||||
|
||||
protected:
|
||||
virtual nsStandardURL* StartClone();
|
||||
|
||||
private:
|
||||
PRInt32 Port() { return mPort == -1 ? mDefaultPort : mPort; }
|
||||
|
||||
|
|
|
@ -537,6 +537,17 @@
|
|||
{0x8c, 0xda, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
#define NS_RESURL_CLASSNAME \
|
||||
"nsResURL"
|
||||
#define NS_RESURL_CID \
|
||||
{ /* ff8fe7ec-2f74-4408-b742-6b7a546029a8 */ \
|
||||
0xff8fe7ec, \
|
||||
0x2f74, \
|
||||
0x4408, \
|
||||
{0xb7, 0x42, 0x6b, 0x7a, 0x54, 0x60, 0x29, 0xa8} \
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* netwerk/protocol/file/ classes
|
||||
*/
|
||||
|
|
|
@ -195,6 +195,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpDigestAuth)
|
|||
// resource
|
||||
#include "nsResProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsResProtocolHandler, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsResURL)
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -927,6 +928,11 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
|
|||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "resource",
|
||||
nsResProtocolHandlerConstructor
|
||||
},
|
||||
{ NS_RESURL_CLASSNAME, // needed only for fastload
|
||||
NS_RESURL_CID,
|
||||
nsnull,
|
||||
nsResURLConstructor
|
||||
},
|
||||
#endif
|
||||
|
||||
// from netwerk/protocol/about (about:blank is mandatory):
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsURLHelper.h"
|
||||
|
||||
static NS_DEFINE_CID(kResURLCID, NS_RESURL_CID);
|
||||
|
||||
static nsResProtocolHandler *gResHandler = nsnull;
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
|
@ -74,15 +76,6 @@ static PRLogModuleInfo *gResLog;
|
|||
// nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "nsStandardURL.h"
|
||||
|
||||
class nsResURL : public nsStandardURL
|
||||
{
|
||||
public:
|
||||
nsResURL() : nsStandardURL(PR_TRUE) {}
|
||||
NS_IMETHOD GetFile(nsIFile **);
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsResURL::GetFile(nsIFile **result)
|
||||
{
|
||||
|
@ -108,6 +101,21 @@ nsResURL::GetFile(nsIFile **result)
|
|||
return rv;
|
||||
}
|
||||
|
||||
/* virtual */ nsStandardURL*
|
||||
nsResURL::StartClone()
|
||||
{
|
||||
nsResURL *clone;
|
||||
NS_NEWXPCOM(clone, nsResURL);
|
||||
return clone;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsResURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
|
||||
{
|
||||
*aClassIDNoAlloc = kResURLCID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// nsResProtocolHandler <public>
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -45,6 +45,17 @@
|
|||
#include "nsISupportsArray.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsStandardURL.h"
|
||||
|
||||
// nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution
|
||||
class nsResURL : public nsStandardURL
|
||||
{
|
||||
public:
|
||||
nsResURL() : nsStandardURL(PR_TRUE) {}
|
||||
NS_IMETHOD GetFile(nsIFile **);
|
||||
virtual nsStandardURL* StartClone();
|
||||
NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID);
|
||||
};
|
||||
|
||||
class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче