dom/src/jsurl/nsJSProtocolHandler.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsJSProtocolHandler_h___
michael@0 7 #define nsJSProtocolHandler_h___
michael@0 8
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10 #include "nsIProtocolHandler.h"
michael@0 11 #include "nsITextToSubURI.h"
michael@0 12 #include "nsIURI.h"
michael@0 13 #include "nsIMutable.h"
michael@0 14 #include "nsISerializable.h"
michael@0 15 #include "nsIClassInfo.h"
michael@0 16 #include "nsSimpleURI.h"
michael@0 17
michael@0 18 #define NS_JSPROTOCOLHANDLER_CID \
michael@0 19 { /* bfc310d2-38a0-11d3-8cd3-0060b0fc14a3 */ \
michael@0 20 0xbfc310d2, \
michael@0 21 0x38a0, \
michael@0 22 0x11d3, \
michael@0 23 {0x8c, 0xd3, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
michael@0 24 }
michael@0 25
michael@0 26 #define NS_JSURI_CID \
michael@0 27 { /* 58f089ee-512a-42d2-a935-d0c874128930 */ \
michael@0 28 0x58f089ee, \
michael@0 29 0x512a, \
michael@0 30 0x42d2, \
michael@0 31 {0xa9, 0x35, 0xd0, 0xc8, 0x74, 0x12, 0x89, 0x30} \
michael@0 32 }
michael@0 33
michael@0 34 #define NS_JSPROTOCOLHANDLER_CONTRACTID \
michael@0 35 NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "javascript"
michael@0 36
michael@0 37
michael@0 38 class nsJSProtocolHandler : public nsIProtocolHandler
michael@0 39 {
michael@0 40 public:
michael@0 41 NS_DECL_ISUPPORTS
michael@0 42
michael@0 43 // nsIProtocolHandler methods:
michael@0 44 NS_DECL_NSIPROTOCOLHANDLER
michael@0 45
michael@0 46 // nsJSProtocolHandler methods:
michael@0 47 nsJSProtocolHandler();
michael@0 48 virtual ~nsJSProtocolHandler();
michael@0 49
michael@0 50 static nsresult
michael@0 51 Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
michael@0 52
michael@0 53 nsresult Init();
michael@0 54
michael@0 55 protected:
michael@0 56
michael@0 57 nsresult EnsureUTF8Spec(const nsAFlatCString &aSpec, const char *aCharset,
michael@0 58 nsACString &aUTF8Spec);
michael@0 59
michael@0 60 nsCOMPtr<nsITextToSubURI> mTextToSubURI;
michael@0 61 };
michael@0 62
michael@0 63
michael@0 64 class nsJSURI : public nsSimpleURI
michael@0 65 {
michael@0 66 public:
michael@0 67 using nsSimpleURI::Read;
michael@0 68 using nsSimpleURI::Write;
michael@0 69
michael@0 70 nsJSURI() {}
michael@0 71
michael@0 72 nsJSURI(nsIURI* aBaseURI) : mBaseURI(aBaseURI) {}
michael@0 73
michael@0 74 nsIURI* GetBaseURI() const
michael@0 75 {
michael@0 76 return mBaseURI;
michael@0 77 }
michael@0 78
michael@0 79 NS_DECL_ISUPPORTS_INHERITED
michael@0 80
michael@0 81 // nsIURI overrides
michael@0 82 virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode) MOZ_OVERRIDE;
michael@0 83
michael@0 84 // nsISerializable overrides
michael@0 85 NS_IMETHOD Read(nsIObjectInputStream* aStream) MOZ_OVERRIDE;
michael@0 86 NS_IMETHOD Write(nsIObjectOutputStream* aStream) MOZ_OVERRIDE;
michael@0 87
michael@0 88 // Override the nsIClassInfo method GetClassIDNoAlloc to make sure our
michael@0 89 // nsISerializable impl works right.
michael@0 90 NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) MOZ_OVERRIDE;
michael@0 91 //NS_IMETHOD QueryInterface( const nsIID& aIID, void** aInstancePtr );
michael@0 92
michael@0 93 protected:
michael@0 94 virtual nsresult EqualsInternal(nsIURI* other,
michael@0 95 RefHandlingEnum refHandlingMode,
michael@0 96 bool* result) MOZ_OVERRIDE;
michael@0 97 private:
michael@0 98 nsCOMPtr<nsIURI> mBaseURI;
michael@0 99 };
michael@0 100
michael@0 101 #endif /* nsJSProtocolHandler_h___ */

mercurial