/work/obj-fuzz/dist/include/mozilla/dom/ChromeUtils.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_ChromeUtils__ |
8 | | #define mozilla_dom_ChromeUtils__ |
9 | | |
10 | | #include "mozilla/AlreadyAddRefed.h" |
11 | | #include "mozilla/dom/BindingDeclarations.h" |
12 | | #include "mozilla/dom/ChromeUtilsBinding.h" |
13 | | #include "mozilla/ErrorResult.h" |
14 | | |
15 | | namespace mozilla { |
16 | | |
17 | | namespace devtools { |
18 | | class HeapSnapshot; |
19 | | } // namespace devtools |
20 | | |
21 | | namespace dom { |
22 | | |
23 | | class ArrayBufferViewOrArrayBuffer; |
24 | | class BrowsingContext; |
25 | | class IdleRequestCallback; |
26 | | struct IdleRequestOptions; |
27 | | class MozQueryInterface; |
28 | | class PrecompiledScript; |
29 | | class Promise; |
30 | | |
31 | | class ChromeUtils |
32 | | { |
33 | | private: |
34 | | // Implemented in devtools/shared/heapsnapshot/HeapSnapshot.cpp |
35 | | static void SaveHeapSnapshotShared(GlobalObject& global, |
36 | | const HeapSnapshotBoundaries& boundaries, |
37 | | nsAString& filePath, |
38 | | nsAString& snapshotId, |
39 | | ErrorResult& rv); |
40 | | |
41 | | public: |
42 | | // Implemented in devtools/shared/heapsnapshot/HeapSnapshot.cpp |
43 | | static void SaveHeapSnapshot(GlobalObject& global, |
44 | | const HeapSnapshotBoundaries& boundaries, |
45 | | nsAString& filePath, |
46 | | ErrorResult& rv); |
47 | | |
48 | | // Implemented in devtools/shared/heapsnapshot/HeapSnapshot.cpp |
49 | | static void SaveHeapSnapshotGetId(GlobalObject& global, |
50 | | const HeapSnapshotBoundaries& boundaries, |
51 | | nsAString& snapshotId, |
52 | | ErrorResult& rv); |
53 | | |
54 | | // Implemented in devtools/shared/heapsnapshot/HeapSnapshot.cpp |
55 | | static already_AddRefed<devtools::HeapSnapshot> ReadHeapSnapshot(GlobalObject& global, |
56 | | const nsAString& filePath, |
57 | | ErrorResult& rv); |
58 | | |
59 | | static void NondeterministicGetWeakMapKeys(GlobalObject& aGlobal, |
60 | | JS::Handle<JS::Value> aMap, |
61 | | JS::MutableHandle<JS::Value> aRetval, |
62 | | ErrorResult& aRv); |
63 | | |
64 | | static void NondeterministicGetWeakSetKeys(GlobalObject& aGlobal, |
65 | | JS::Handle<JS::Value> aSet, |
66 | | JS::MutableHandle<JS::Value> aRetval, |
67 | | ErrorResult& aRv); |
68 | | |
69 | | static void Base64URLEncode(GlobalObject& aGlobal, |
70 | | const ArrayBufferViewOrArrayBuffer& aSource, |
71 | | const Base64URLEncodeOptions& aOptions, |
72 | | nsACString& aResult, |
73 | | ErrorResult& aRv); |
74 | | |
75 | | static void Base64URLDecode(GlobalObject& aGlobal, |
76 | | const nsACString& aString, |
77 | | const Base64URLDecodeOptions& aOptions, |
78 | | JS::MutableHandle<JSObject*> aRetval, |
79 | | ErrorResult& aRv); |
80 | | |
81 | | static void |
82 | | OriginAttributesToSuffix(GlobalObject& aGlobal, |
83 | | const dom::OriginAttributesDictionary& aAttrs, |
84 | | nsCString& aSuffix); |
85 | | |
86 | | static bool |
87 | | OriginAttributesMatchPattern(dom::GlobalObject& aGlobal, |
88 | | const dom::OriginAttributesDictionary& aAttrs, |
89 | | const dom::OriginAttributesPatternDictionary& aPattern); |
90 | | |
91 | | static void |
92 | | CreateOriginAttributesFromOrigin(dom::GlobalObject& aGlobal, |
93 | | const nsAString& aOrigin, |
94 | | dom::OriginAttributesDictionary& aAttrs, |
95 | | ErrorResult& aRv); |
96 | | |
97 | | static void |
98 | | FillNonDefaultOriginAttributes(dom::GlobalObject& aGlobal, |
99 | | const dom::OriginAttributesDictionary& aAttrs, |
100 | | dom::OriginAttributesDictionary& aNewAttrs); |
101 | | |
102 | | static bool |
103 | | IsOriginAttributesEqual(dom::GlobalObject& aGlobal, |
104 | | const dom::OriginAttributesDictionary& aA, |
105 | | const dom::OriginAttributesDictionary& aB); |
106 | | |
107 | | static bool |
108 | | IsOriginAttributesEqual(const dom::OriginAttributesDictionary& aA, |
109 | | const dom::OriginAttributesDictionary& aB); |
110 | | |
111 | | static bool |
112 | | IsOriginAttributesEqualIgnoringFPD(const dom::OriginAttributesDictionary& aA, |
113 | | const dom::OriginAttributesDictionary& aB) |
114 | 0 | { |
115 | 0 | return aA.mAppId == aB.mAppId && |
116 | 0 | aA.mInIsolatedMozBrowser == aB.mInIsolatedMozBrowser && |
117 | 0 | aA.mUserContextId == aB.mUserContextId && |
118 | 0 | aA.mPrivateBrowsingId == aB.mPrivateBrowsingId; |
119 | 0 | } |
120 | | |
121 | | // Implemented in js/xpconnect/loader/ChromeScriptLoader.cpp |
122 | | static already_AddRefed<Promise> |
123 | | CompileScript(GlobalObject& aGlobal, |
124 | | const nsAString& aUrl, |
125 | | const dom::CompileScriptOptionsDictionary& aOptions, |
126 | | ErrorResult& aRv); |
127 | | |
128 | | static MozQueryInterface* |
129 | | GenerateQI(const GlobalObject& global, const Sequence<OwningStringOrIID>& interfaces, |
130 | | ErrorResult& aRv); |
131 | | |
132 | | static void WaiveXrays(GlobalObject& aGlobal, |
133 | | JS::HandleValue aVal, |
134 | | JS::MutableHandleValue aRetval, |
135 | | ErrorResult& aRv); |
136 | | |
137 | | static void UnwaiveXrays(GlobalObject& aGlobal, |
138 | | JS::HandleValue aVal, |
139 | | JS::MutableHandleValue aRetval, |
140 | | ErrorResult& aRv); |
141 | | |
142 | | static void GetClassName(GlobalObject& aGlobal, |
143 | | JS::HandleObject aObj, |
144 | | bool aUnwrap, |
145 | | nsAString& aRetval); |
146 | | |
147 | | static void ShallowClone(GlobalObject& aGlobal, |
148 | | JS::HandleObject aObj, |
149 | | JS::HandleObject aTarget, |
150 | | JS::MutableHandleObject aRetval, |
151 | | ErrorResult& aRv); |
152 | | |
153 | | static void IdleDispatch(const GlobalObject& global, |
154 | | IdleRequestCallback& callback, |
155 | | const IdleRequestOptions& options, |
156 | | ErrorResult& aRv); |
157 | | |
158 | | static void GetRecentJSDevError(GlobalObject& aGlobal, |
159 | | JS::MutableHandleValue aRetval, |
160 | | ErrorResult& aRv); |
161 | | |
162 | | static void ClearRecentJSDevError(GlobalObject& aGlobal); |
163 | | |
164 | | static already_AddRefed<Promise> |
165 | | RequestPerformanceMetrics(GlobalObject& aGlobal, |
166 | | ErrorResult& aRv); |
167 | | |
168 | | static void Import(const GlobalObject& aGlobal, |
169 | | const nsAString& aResourceURI, |
170 | | const Optional<JS::Handle<JSObject*>>& aTargetObj, |
171 | | JS::MutableHandle<JSObject*> aRetval, |
172 | | ErrorResult& aRv); |
173 | | |
174 | | static void DefineModuleGetter(const GlobalObject& global, |
175 | | JS::Handle<JSObject*> target, |
176 | | const nsAString& id, |
177 | | const nsAString& resourceURI, |
178 | | ErrorResult& aRv); |
179 | | |
180 | | static void |
181 | | GetCallerLocation(const GlobalObject& global, nsIPrincipal* principal, |
182 | | JS::MutableHandle<JSObject*> aRetval); |
183 | | |
184 | | static void |
185 | | CreateError(const GlobalObject& global, const nsAString& message, |
186 | | JS::Handle<JSObject*> stack, |
187 | | JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv); |
188 | | |
189 | | static already_AddRefed<Promise> |
190 | | RequestIOActivity(GlobalObject& aGlobal, ErrorResult& aRv); |
191 | | |
192 | | static void |
193 | | GetRootBrowsingContexts(GlobalObject& aGlobal, |
194 | | nsTArray<RefPtr<BrowsingContext>>& aBrowsingContexts); |
195 | | }; |
196 | | |
197 | | } // namespace dom |
198 | | } // namespace mozilla |
199 | | |
200 | | #endif // mozilla_dom_ChromeUtils__ |