2001-09-26 02:43:09 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-07-13 03:46:40 +04:00
|
|
|
|
|
|
|
#ifndef nsJSProtocolHandler_h___
|
|
|
|
#define nsJSProtocolHandler_h___
|
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
1999-07-13 03:46:40 +04:00
|
|
|
#include "nsIProtocolHandler.h"
|
2002-09-08 19:08:45 +04:00
|
|
|
#include "nsITextToSubURI.h"
|
2008-11-19 01:54:36 +03:00
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "nsIMutable.h"
|
|
|
|
#include "nsISerializable.h"
|
|
|
|
#include "nsIClassInfo.h"
|
2011-05-26 00:23:07 +04:00
|
|
|
#include "nsSimpleURI.h"
|
1999-07-13 03:46:40 +04:00
|
|
|
|
|
|
|
#define NS_JSPROTOCOLHANDLER_CID \
|
|
|
|
{ /* bfc310d2-38a0-11d3-8cd3-0060b0fc14a3 */ \
|
|
|
|
0xbfc310d2, \
|
|
|
|
0x38a0, \
|
|
|
|
0x11d3, \
|
|
|
|
{0x8c, 0xd3, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
|
|
|
}
|
|
|
|
|
2008-11-19 01:54:36 +03:00
|
|
|
#define NS_JSURI_CID \
|
|
|
|
{ /* 58f089ee-512a-42d2-a935-d0c874128930 */ \
|
|
|
|
0x58f089ee, \
|
|
|
|
0x512a, \
|
|
|
|
0x42d2, \
|
|
|
|
{0xa9, 0x35, 0xd0, 0xc8, 0x74, 0x12, 0x89, 0x30} \
|
|
|
|
}
|
|
|
|
|
2003-03-15 04:04:32 +03:00
|
|
|
#define NS_JSPROTOCOLHANDLER_CONTRACTID \
|
|
|
|
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "javascript"
|
|
|
|
|
|
|
|
|
1999-07-13 03:46:40 +04:00
|
|
|
class nsJSProtocolHandler : public nsIProtocolHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIProtocolHandler methods:
|
1999-08-23 03:52:07 +04:00
|
|
|
NS_DECL_NSIPROTOCOLHANDLER
|
1999-07-13 03:46:40 +04:00
|
|
|
|
|
|
|
// nsJSProtocolHandler methods:
|
|
|
|
nsJSProtocolHandler();
|
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
static nsresult
|
1999-07-13 03:46:40 +04:00
|
|
|
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsJSProtocolHandler();
|
2002-07-24 03:28:28 +04:00
|
|
|
|
|
|
|
nsresult EnsureUTF8Spec(const nsAFlatCString &aSpec, const char *aCharset,
|
|
|
|
nsACString &aUTF8Spec);
|
|
|
|
|
2002-09-08 19:08:45 +04:00
|
|
|
nsCOMPtr<nsITextToSubURI> mTextToSubURI;
|
1999-07-13 03:46:40 +04:00
|
|
|
};
|
|
|
|
|
2011-05-26 00:23:07 +04:00
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
class nsJSURI : public mozilla::net::nsSimpleURI
|
2008-11-19 01:54:36 +03:00
|
|
|
{
|
|
|
|
public:
|
2016-05-19 05:02:57 +03:00
|
|
|
using mozilla::net::nsSimpleURI::Read;
|
|
|
|
using mozilla::net::nsSimpleURI::Write;
|
2008-11-19 01:54:36 +03:00
|
|
|
|
2011-05-26 00:23:07 +04:00
|
|
|
nsJSURI() {}
|
2008-11-19 01:54:36 +03:00
|
|
|
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit nsJSURI(nsIURI* aBaseURI) : mBaseURI(aBaseURI) {}
|
2008-11-19 01:54:36 +03:00
|
|
|
|
2011-05-26 00:23:07 +04:00
|
|
|
nsIURI* GetBaseURI() const
|
|
|
|
{
|
|
|
|
return mBaseURI;
|
|
|
|
}
|
2008-11-19 01:54:36 +03:00
|
|
|
|
2011-05-26 00:23:07 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2008-11-19 01:54:36 +03:00
|
|
|
|
2011-05-26 00:23:07 +04:00
|
|
|
// nsIURI overrides
|
2016-07-27 01:38:46 +03:00
|
|
|
virtual mozilla::net::nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode,
|
|
|
|
const nsACString& newRef) override;
|
2008-11-19 01:54:36 +03:00
|
|
|
|
2011-05-26 00:23:07 +04:00
|
|
|
// nsISerializable overrides
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Read(nsIObjectInputStream* aStream) override;
|
|
|
|
NS_IMETHOD Write(nsIObjectOutputStream* aStream) override;
|
2008-11-19 01:54:36 +03:00
|
|
|
|
2015-03-07 00:33:00 +03:00
|
|
|
// nsIIPCSerializableURI overrides
|
|
|
|
NS_DECL_NSIIPCSERIALIZABLEURI
|
|
|
|
|
2011-05-26 00:23:07 +04:00
|
|
|
// Override the nsIClassInfo method GetClassIDNoAlloc to make sure our
|
|
|
|
// nsISerializable impl works right.
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) override;
|
2011-05-26 00:23:07 +04:00
|
|
|
//NS_IMETHOD QueryInterface( const nsIID& aIID, void** aInstancePtr );
|
2008-11-19 01:54:36 +03:00
|
|
|
|
2011-05-26 12:20:06 +04:00
|
|
|
protected:
|
2014-07-09 01:23:17 +04:00
|
|
|
virtual ~nsJSURI() {}
|
|
|
|
|
2011-05-26 12:20:06 +04:00
|
|
|
virtual nsresult EqualsInternal(nsIURI* other,
|
|
|
|
RefHandlingEnum refHandlingMode,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool* result) override;
|
2008-11-19 01:54:36 +03:00
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIURI> mBaseURI;
|
|
|
|
};
|
2011-05-26 00:23:07 +04:00
|
|
|
|
1999-07-13 03:46:40 +04:00
|
|
|
#endif /* nsJSProtocolHandler_h___ */
|