/work/obj-fuzz/dist/include/mozilla/dom/BlobURL.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_dom_BlobURL_h |
8 | | #define mozilla_dom_BlobURL_h |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "nsCOMPtr.h" |
12 | | #include "nsISerializable.h" |
13 | | #include "nsSimpleURI.h" |
14 | | #include "nsIIPCSerializableURI.h" |
15 | | #include "prtime.h" |
16 | | |
17 | | namespace mozilla { |
18 | | namespace dom { |
19 | | |
20 | | /** |
21 | | * These URIs refer to host objects with "blob" scheme. |
22 | | */ |
23 | | class BlobURL final : public mozilla::net::nsSimpleURI |
24 | | { |
25 | | private: |
26 | | BlobURL(); |
27 | | |
28 | | public: |
29 | | NS_DECL_ISUPPORTS_INHERITED |
30 | | NS_DECL_NSISERIALIZABLE |
31 | | NS_DECL_NSICLASSINFO |
32 | | NS_DECL_NSIIPCSERIALIZABLEURI |
33 | | |
34 | | // Override CloneInternal() and EqualsInternal() |
35 | | virtual nsresult CloneInternal(RefHandlingEnum aRefHandlingMode, |
36 | | const nsACString& newRef, |
37 | | nsIURI** aClone) override; |
38 | | virtual nsresult EqualsInternal(nsIURI* aOther, |
39 | | RefHandlingEnum aRefHandlingMode, |
40 | | bool* aResult) override; |
41 | | |
42 | | // Override StartClone to hand back a BlobURL |
43 | | virtual mozilla::net::nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode, |
44 | | const nsACString& newRef) override |
45 | 0 | { |
46 | 0 | BlobURL* url = new BlobURL(); |
47 | 0 | SetRefOnClone(url, refHandlingMode, newRef); |
48 | 0 | return url; |
49 | 0 | } |
50 | | |
51 | | bool |
52 | | Revoked() const |
53 | 0 | { |
54 | 0 | return mRevoked; |
55 | 0 | } |
56 | | |
57 | | NS_IMETHOD Mutate(nsIURIMutator * *_retval) override; |
58 | | |
59 | | private: |
60 | | virtual ~BlobURL() = default; |
61 | | |
62 | | nsresult SetScheme(const nsACString &aProtocol) override; |
63 | | bool Deserialize(const mozilla::ipc::URIParams&); |
64 | | nsresult ReadPrivate(nsIObjectInputStream *stream); |
65 | | |
66 | | public: |
67 | | class Mutator final |
68 | | : public nsIURIMutator |
69 | | , public BaseURIMutator<BlobURL> |
70 | | , public nsISerializable |
71 | | { |
72 | | NS_DECL_ISUPPORTS |
73 | | NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI) |
74 | | NS_DEFINE_NSIMUTATOR_COMMON |
75 | | |
76 | | NS_IMETHOD |
77 | | Write(nsIObjectOutputStream *aOutputStream) override |
78 | 0 | { |
79 | 0 | return NS_ERROR_NOT_IMPLEMENTED; |
80 | 0 | } |
81 | | |
82 | | MOZ_MUST_USE NS_IMETHOD |
83 | | Read(nsIObjectInputStream* aStream) override |
84 | 0 | { |
85 | 0 | return InitFromInputStream(aStream); |
86 | 0 | } |
87 | | |
88 | 1.77k | Mutator() = default; |
89 | | |
90 | | private: |
91 | 1.77k | ~Mutator() = default; |
92 | | |
93 | | friend class BlobURL; |
94 | | }; |
95 | | |
96 | | friend BaseURIMutator<BlobURL>; |
97 | | |
98 | | bool mRevoked; |
99 | | }; |
100 | | |
101 | | #define NS_HOSTOBJECTURI_CID \ |
102 | | { 0xf5475c51, 0x59a7, 0x4757, \ |
103 | | { 0xb3, 0xd9, 0xe2, 0x11, 0xa9, 0x41, 0x08, 0x72 } } |
104 | | |
105 | | #define NS_HOSTOBJECTURIMUTATOR_CID \ |
106 | | { 0xbbe50ef2, 0x80eb, 0x469d, \ |
107 | | { 0xb7, 0x0d, 0x02, 0x85, 0x82, 0x75, 0x38, 0x9f } } |
108 | | |
109 | | } // dom namespace |
110 | | } // mozilla namespace |
111 | | |
112 | | #endif /* mozilla_dom_BlobURL_h */ |