/work/obj-fuzz/dist/include/mozilla/dom/ContentChild.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_ContentChild_h |
8 | | #define mozilla_dom_ContentChild_h |
9 | | |
10 | | #include "mozilla/Atomics.h" |
11 | | #include "mozilla/Attributes.h" |
12 | | #include "mozilla/dom/ContentBridgeParent.h" |
13 | | #include "mozilla/dom/nsIContentChild.h" |
14 | | #include "mozilla/dom/PBrowserOrId.h" |
15 | | #include "mozilla/dom/PContentChild.h" |
16 | | #include "mozilla/StaticPtr.h" |
17 | | #include "nsAutoPtr.h" |
18 | | #include "nsHashKeys.h" |
19 | | #include "nsIObserver.h" |
20 | | #include "nsTHashtable.h" |
21 | | #include "nsRefPtrHashtable.h" |
22 | | |
23 | | #include "nsWeakPtr.h" |
24 | | #include "nsIWindowProvider.h" |
25 | | |
26 | | #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) |
27 | | #include "nsIFile.h" |
28 | | #endif |
29 | | |
30 | | struct ChromePackage; |
31 | | class nsIObserver; |
32 | | struct SubstitutionMapping; |
33 | | struct OverrideMapping; |
34 | | class nsIDomainPolicy; |
35 | | class nsIURIClassifierCallback; |
36 | | struct LookAndFeelInt; |
37 | | class nsDocShellLoadInfo; |
38 | | |
39 | | namespace mozilla { |
40 | | class RemoteSpellcheckEngineChild; |
41 | | class ChildProfilerController; |
42 | | |
43 | | using mozilla::loader::PScriptCacheChild; |
44 | | |
45 | | #if !defined(XP_WIN) |
46 | | // Returns whether or not the currently running build is an unpackaged |
47 | | // developer build. This check is implemented by looking for omni.ja in the |
48 | | // the obj/dist dir. We use this routine to detect when the build dir will |
49 | | // use symlinks to the repo and object dir. On Windows, dev builds don't |
50 | | // use symlinks. |
51 | | bool IsDevelopmentBuild(); |
52 | | #endif /* !XP_WIN */ |
53 | | |
54 | | #if defined(XP_MACOSX) |
55 | | // Return the repo directory and the repo object directory respectively. These |
56 | | // should only be used on Mac developer builds to determine the path to the |
57 | | // repo or object directory. |
58 | | nsresult GetRepoDir(nsIFile **aRepoDir); |
59 | | nsresult GetObjDir(nsIFile **aObjDir); |
60 | | #endif /* XP_MACOSX */ |
61 | | |
62 | | namespace ipc { |
63 | | class OptionalURIParams; |
64 | | class URIParams; |
65 | | }// namespace ipc |
66 | | |
67 | | namespace dom { |
68 | | |
69 | | namespace ipc { |
70 | | class SharedMap; |
71 | | } |
72 | | |
73 | | class AlertObserver; |
74 | | class ConsoleListener; |
75 | | class ClonedMessageData; |
76 | | class TabChild; |
77 | | class GetFilesHelperChild; |
78 | | class FileCreatorHelper; |
79 | | |
80 | | class ContentChild final : public PContentChild |
81 | | , public nsIWindowProvider |
82 | | , public nsIContentChild |
83 | | { |
84 | | typedef mozilla::dom::ClonedMessageData ClonedMessageData; |
85 | | typedef mozilla::ipc::FileDescriptor FileDescriptor; |
86 | | typedef mozilla::ipc::OptionalURIParams OptionalURIParams; |
87 | | typedef mozilla::ipc::PFileDescriptorSetChild PFileDescriptorSetChild; |
88 | | typedef mozilla::ipc::URIParams URIParams; |
89 | | |
90 | | public: |
91 | | NS_DECL_NSIWINDOWPROVIDER |
92 | | |
93 | | ContentChild(); |
94 | | virtual ~ContentChild(); |
95 | | NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override; |
96 | 0 | NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override { return 1; } |
97 | 0 | NS_IMETHOD_(MozExternalRefCountType) Release(void) override { return 1; } |
98 | | |
99 | | struct AppInfo |
100 | | { |
101 | | nsCString version; |
102 | | nsCString buildID; |
103 | | nsCString name; |
104 | | nsCString UAName; |
105 | | nsCString ID; |
106 | | nsCString vendor; |
107 | | nsCString sourceURL; |
108 | | }; |
109 | | |
110 | | nsresult |
111 | | ProvideWindowCommon(TabChild* aTabOpener, |
112 | | mozIDOMWindowProxy* aOpener, |
113 | | bool aIframeMoz, |
114 | | uint32_t aChromeFlags, |
115 | | bool aCalledFromJS, |
116 | | bool aPositionSpecified, |
117 | | bool aSizeSpecified, |
118 | | nsIURI* aURI, |
119 | | const nsAString& aName, |
120 | | const nsACString& aFeatures, |
121 | | bool aForceNoOpener, |
122 | | nsDocShellLoadInfo* aLoadInfo, |
123 | | bool* aWindowIsNew, |
124 | | mozIDOMWindowProxy** aReturn); |
125 | | |
126 | | bool Init(MessageLoop* aIOLoop, |
127 | | base::ProcessId aParentPid, |
128 | | const char* aParentBuildID, |
129 | | IPC::Channel* aChannel, |
130 | | uint64_t aChildID, |
131 | | bool aIsForBrowser); |
132 | | |
133 | | void InitXPCOM(const XPCOMInitData& aXPCOMInit, |
134 | | const mozilla::dom::ipc::StructuredCloneData& aInitialData); |
135 | | |
136 | | void InitGraphicsDeviceData(const ContentDeviceData& aData); |
137 | | |
138 | | static ContentChild* GetSingleton() |
139 | 0 | { |
140 | 0 | return sSingleton; |
141 | 0 | } |
142 | | |
143 | | const AppInfo& GetAppInfo() |
144 | 0 | { |
145 | 0 | return mAppInfo; |
146 | 0 | } |
147 | | |
148 | | void SetProcessName(const nsAString& aName); |
149 | | |
150 | | void GetProcessName(nsAString& aName) const; |
151 | | |
152 | | void GetProcessName(nsACString& aName) const; |
153 | | |
154 | | #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) |
155 | | void GetProfileDir(nsIFile** aProfileDir) const |
156 | | { |
157 | | *aProfileDir = mProfileDir; |
158 | | NS_IF_ADDREF(*aProfileDir); |
159 | | } |
160 | | |
161 | | void SetProfileDir(nsIFile* aProfileDir) |
162 | | { |
163 | | mProfileDir = aProfileDir; |
164 | | } |
165 | | #endif |
166 | | |
167 | | bool IsAlive() const; |
168 | | |
169 | | bool IsShuttingDown() const; |
170 | | |
171 | 0 | ipc::SharedMap* SharedData() { return mSharedData; }; |
172 | | |
173 | | static void AppendProcessId(nsACString& aName); |
174 | | |
175 | | static void UpdateCookieStatus(nsIChannel *aChannel); |
176 | | |
177 | | mozilla::ipc::IPCResult |
178 | | RecvInitContentBridgeChild(Endpoint<PContentBridgeChild>&& aEndpoint) override; |
179 | | |
180 | | mozilla::ipc::IPCResult |
181 | | RecvInitGMPService(Endpoint<PGMPServiceChild>&& aGMPService) override; |
182 | | |
183 | | mozilla::ipc::IPCResult |
184 | | RecvInitProfiler(Endpoint<PProfilerChild>&& aEndpoint) override; |
185 | | |
186 | | mozilla::ipc::IPCResult |
187 | | RecvGMPsChanged(nsTArray<GMPCapabilityData>&& capabilities) override; |
188 | | |
189 | | mozilla::ipc::IPCResult |
190 | | RecvInitProcessHangMonitor(Endpoint<PProcessHangMonitorChild>&& aHangMonitor) override; |
191 | | |
192 | | mozilla::ipc::IPCResult |
193 | | RecvInitRendering( |
194 | | Endpoint<PCompositorManagerChild>&& aCompositor, |
195 | | Endpoint<PImageBridgeChild>&& aImageBridge, |
196 | | Endpoint<PVRManagerChild>&& aVRBridge, |
197 | | Endpoint<PVideoDecoderManagerChild>&& aVideoManager, |
198 | | nsTArray<uint32_t>&& namespaces) override; |
199 | | |
200 | | mozilla::ipc::IPCResult |
201 | | RecvRequestPerformanceMetrics(const nsID& aID) override; |
202 | | |
203 | | mozilla::ipc::IPCResult |
204 | | RecvReinitRendering( |
205 | | Endpoint<PCompositorManagerChild>&& aCompositor, |
206 | | Endpoint<PImageBridgeChild>&& aImageBridge, |
207 | | Endpoint<PVRManagerChild>&& aVRBridge, |
208 | | Endpoint<PVideoDecoderManagerChild>&& aVideoManager, |
209 | | nsTArray<uint32_t>&& namespaces) override; |
210 | | |
211 | | virtual mozilla::ipc::IPCResult RecvAudioDefaultDeviceChange() override; |
212 | | |
213 | | mozilla::ipc::IPCResult RecvReinitRenderingForDeviceReset() override; |
214 | | |
215 | | virtual mozilla::ipc::IPCResult RecvSetProcessSandbox(const MaybeFileDesc& aBroker) override; |
216 | | |
217 | | virtual PBrowserChild* AllocPBrowserChild(const TabId& aTabId, |
218 | | const TabId& aSameTabGroupAs, |
219 | | const IPCTabContext& aContext, |
220 | | const uint32_t& aChromeFlags, |
221 | | const ContentParentId& aCpID, |
222 | | const bool& aIsForBrowser) override; |
223 | | |
224 | | virtual bool DeallocPBrowserChild(PBrowserChild*) override; |
225 | | |
226 | | virtual PIPCBlobInputStreamChild* |
227 | | AllocPIPCBlobInputStreamChild(const nsID& aID, |
228 | | const uint64_t& aSize) override; |
229 | | |
230 | | virtual bool |
231 | | DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor) override; |
232 | | |
233 | | virtual PHalChild* AllocPHalChild() override; |
234 | | virtual bool DeallocPHalChild(PHalChild*) override; |
235 | | |
236 | | virtual PHeapSnapshotTempFileHelperChild* |
237 | | AllocPHeapSnapshotTempFileHelperChild() override; |
238 | | |
239 | | virtual bool |
240 | | DeallocPHeapSnapshotTempFileHelperChild(PHeapSnapshotTempFileHelperChild*) override; |
241 | | |
242 | | virtual PCycleCollectWithLogsChild* |
243 | | AllocPCycleCollectWithLogsChild(const bool& aDumpAllTraces, |
244 | | const FileDescriptor& aGCLog, |
245 | | const FileDescriptor& aCCLog) override; |
246 | | |
247 | | virtual bool |
248 | | DeallocPCycleCollectWithLogsChild(PCycleCollectWithLogsChild* aActor) override; |
249 | | |
250 | | virtual mozilla::ipc::IPCResult |
251 | | RecvPCycleCollectWithLogsConstructor(PCycleCollectWithLogsChild* aChild, |
252 | | const bool& aDumpAllTraces, |
253 | | const FileDescriptor& aGCLog, |
254 | | const FileDescriptor& aCCLog) override; |
255 | | |
256 | | virtual PWebBrowserPersistDocumentChild* |
257 | | AllocPWebBrowserPersistDocumentChild(PBrowserChild* aBrowser, |
258 | | const uint64_t& aOuterWindowID) override; |
259 | | |
260 | | virtual mozilla::ipc::IPCResult |
261 | | RecvPWebBrowserPersistDocumentConstructor(PWebBrowserPersistDocumentChild *aActor, |
262 | | PBrowserChild *aBrowser, |
263 | | const uint64_t& aOuterWindowID) override; |
264 | | |
265 | | virtual bool |
266 | | DeallocPWebBrowserPersistDocumentChild(PWebBrowserPersistDocumentChild* aActor) override; |
267 | | |
268 | | virtual PTestShellChild* AllocPTestShellChild() override; |
269 | | |
270 | | virtual bool DeallocPTestShellChild(PTestShellChild*) override; |
271 | | |
272 | | virtual mozilla::ipc::IPCResult RecvPTestShellConstructor(PTestShellChild*) override; |
273 | | |
274 | | virtual PScriptCacheChild* |
275 | | AllocPScriptCacheChild(const FileDescOrError& cacheFile, |
276 | | const bool& wantCacheData) override; |
277 | | |
278 | | virtual bool DeallocPScriptCacheChild(PScriptCacheChild*) override; |
279 | | |
280 | | virtual mozilla::ipc::IPCResult |
281 | | RecvPScriptCacheConstructor(PScriptCacheChild*, |
282 | | const FileDescOrError& cacheFile, |
283 | | const bool& wantCacheData) override; |
284 | | |
285 | | jsipc::CPOWManager* GetCPOWManager() override; |
286 | | |
287 | | virtual PNeckoChild* AllocPNeckoChild() override; |
288 | | |
289 | | virtual bool DeallocPNeckoChild(PNeckoChild*) override; |
290 | | |
291 | | virtual PPrintingChild* AllocPPrintingChild() override; |
292 | | |
293 | | virtual bool DeallocPPrintingChild(PPrintingChild*) override; |
294 | | |
295 | | virtual PChildToParentStreamChild* |
296 | | SendPChildToParentStreamConstructor(PChildToParentStreamChild*) override; |
297 | | |
298 | | virtual PChildToParentStreamChild* AllocPChildToParentStreamChild() override; |
299 | | virtual bool DeallocPChildToParentStreamChild(PChildToParentStreamChild*) override; |
300 | | |
301 | | virtual PParentToChildStreamChild* AllocPParentToChildStreamChild() override; |
302 | | virtual bool DeallocPParentToChildStreamChild(PParentToChildStreamChild*) override; |
303 | | |
304 | | virtual PPSMContentDownloaderChild* |
305 | | AllocPPSMContentDownloaderChild( const uint32_t& aCertType) override; |
306 | | |
307 | | virtual bool |
308 | | DeallocPPSMContentDownloaderChild(PPSMContentDownloaderChild* aDownloader) override; |
309 | | |
310 | | virtual PExternalHelperAppChild* |
311 | | AllocPExternalHelperAppChild(const OptionalURIParams& uri, |
312 | | const nsCString& aMimeContentType, |
313 | | const nsCString& aContentDisposition, |
314 | | const uint32_t& aContentDispositionHint, |
315 | | const nsString& aContentDispositionFilename, |
316 | | const bool& aForceSave, |
317 | | const int64_t& aContentLength, |
318 | | const bool& aWasFileChannel, |
319 | | const OptionalURIParams& aReferrer, |
320 | | PBrowserChild* aBrowser) override; |
321 | | |
322 | | virtual bool |
323 | | DeallocPExternalHelperAppChild(PExternalHelperAppChild *aService) override; |
324 | | |
325 | | virtual PHandlerServiceChild* AllocPHandlerServiceChild() override; |
326 | | |
327 | | virtual bool DeallocPHandlerServiceChild(PHandlerServiceChild*) override; |
328 | | |
329 | | virtual PMediaChild* AllocPMediaChild() override; |
330 | | |
331 | | virtual bool DeallocPMediaChild(PMediaChild* aActor) override; |
332 | | |
333 | | virtual PPresentationChild* AllocPPresentationChild() override; |
334 | | |
335 | | virtual bool DeallocPPresentationChild(PPresentationChild* aActor) override; |
336 | | |
337 | | virtual mozilla::ipc::IPCResult |
338 | | RecvNotifyPresentationReceiverLaunched(PBrowserChild* aIframe, |
339 | | const nsString& aSessionId) override; |
340 | | |
341 | | virtual mozilla::ipc::IPCResult |
342 | | RecvNotifyPresentationReceiverCleanUp(const nsString& aSessionId) override; |
343 | | |
344 | | virtual mozilla::ipc::IPCResult RecvNotifyEmptyHTTPCache() override; |
345 | | |
346 | | virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild() override; |
347 | | |
348 | | virtual bool DeallocPSpeechSynthesisChild(PSpeechSynthesisChild* aActor) override; |
349 | | |
350 | | virtual mozilla::ipc::IPCResult RecvRegisterChrome(InfallibleTArray<ChromePackage>&& packages, |
351 | | InfallibleTArray<SubstitutionMapping>&& resources, |
352 | | InfallibleTArray<OverrideMapping>&& overrides, |
353 | | const nsCString& locale, |
354 | | const bool& reset) override; |
355 | | virtual mozilla::ipc::IPCResult RecvRegisterChromeItem(const ChromeRegistryItem& item) override; |
356 | | |
357 | | virtual mozilla::ipc::IPCResult RecvClearImageCache(const bool& privateLoader, |
358 | | const bool& chrome) override; |
359 | | |
360 | | virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override; |
361 | | |
362 | | virtual bool DeallocPJavaScriptChild(mozilla::jsipc::PJavaScriptChild*) override; |
363 | | |
364 | | virtual PRemoteSpellcheckEngineChild* AllocPRemoteSpellcheckEngineChild() override; |
365 | | |
366 | | virtual bool DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild*) override; |
367 | | |
368 | | virtual mozilla::ipc::IPCResult RecvSetOffline(const bool& offline) override; |
369 | | |
370 | | virtual mozilla::ipc::IPCResult RecvSetConnectivity(const bool& connectivity) override; |
371 | | virtual mozilla::ipc::IPCResult RecvSetCaptivePortalState(const int32_t& state) override; |
372 | | |
373 | | virtual mozilla::ipc::IPCResult RecvBidiKeyboardNotify(const bool& isLangRTL, |
374 | | const bool& haveBidiKeyboards) override; |
375 | | |
376 | | virtual mozilla::ipc::IPCResult RecvNotifyVisited(nsTArray<URIParams>&& aURIs) override; |
377 | | |
378 | | // auto remove when alertfinished is received. |
379 | | nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver); |
380 | | |
381 | | virtual mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& aPref) override; |
382 | | virtual mozilla::ipc::IPCResult RecvVarUpdate(const GfxVarUpdate& pref) override; |
383 | | |
384 | | virtual mozilla::ipc::IPCResult RecvDataStoragePut(const nsString& aFilename, |
385 | | const DataStorageItem& aItem) override; |
386 | | |
387 | | virtual mozilla::ipc::IPCResult RecvDataStorageRemove(const nsString& aFilename, |
388 | | const nsCString& aKey, |
389 | | const DataStorageType& aType) override; |
390 | | |
391 | | virtual mozilla::ipc::IPCResult RecvDataStorageClear(const nsString& aFilename) override; |
392 | | |
393 | | virtual mozilla::ipc::IPCResult RecvNotifyAlertsObserver(const nsCString& aType, |
394 | | const nsString& aData) override; |
395 | | |
396 | | virtual mozilla::ipc::IPCResult RecvLoadProcessScript(const nsString& aURL) override; |
397 | | |
398 | | virtual mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMsg, |
399 | | InfallibleTArray<CpowEntry>&& aCpows, |
400 | | const IPC::Principal& aPrincipal, |
401 | | const ClonedMessageData& aData) override; |
402 | | |
403 | | mozilla::ipc::IPCResult RecvRegisterStringBundles(nsTArray<StringBundleDescriptor>&& stringBundles) override; |
404 | | |
405 | | mozilla::ipc::IPCResult RecvUpdateSharedData(const FileDescriptor& aMapFile, |
406 | | const uint32_t& aMapSize, |
407 | | nsTArray<IPCBlob>&& aBlobs, |
408 | | nsTArray<nsCString>&& aChangedKeys) override; |
409 | | |
410 | | virtual mozilla::ipc::IPCResult RecvGeolocationUpdate(nsIDOMGeoPosition* aPosition) override; |
411 | | |
412 | | virtual mozilla::ipc::IPCResult RecvGeolocationError(const uint16_t& errorCode) override; |
413 | | |
414 | | virtual mozilla::ipc::IPCResult RecvUpdateDictionaryList(InfallibleTArray<nsString>&& aDictionaries) override; |
415 | | |
416 | | virtual mozilla::ipc::IPCResult RecvUpdateFontList(InfallibleTArray<SystemFontListEntry>&& aFontList) override; |
417 | | |
418 | | virtual mozilla::ipc::IPCResult RecvUpdateAppLocales(nsTArray<nsCString>&& aAppLocales) override; |
419 | | virtual mozilla::ipc::IPCResult RecvUpdateRequestedLocales(nsTArray<nsCString>&& aRequestedLocales) override; |
420 | | |
421 | | virtual mozilla::ipc::IPCResult RecvClearSiteDataReloadNeeded(const nsString& aOrigin) override; |
422 | | |
423 | | virtual mozilla::ipc::IPCResult RecvAddPermission(const IPC::Permission& permission) override; |
424 | | |
425 | | virtual mozilla::ipc::IPCResult RecvRemoveAllPermissions() override; |
426 | | |
427 | | virtual mozilla::ipc::IPCResult RecvFlushMemory(const nsString& reason) override; |
428 | | |
429 | | virtual mozilla::ipc::IPCResult RecvActivateA11y(const uint32_t& aMainChromeTid, |
430 | | const uint32_t& aMsaaID) override; |
431 | | virtual mozilla::ipc::IPCResult RecvShutdownA11y() override; |
432 | | |
433 | | virtual mozilla::ipc::IPCResult RecvGarbageCollect() override; |
434 | | virtual mozilla::ipc::IPCResult RecvCycleCollect() override; |
435 | | virtual mozilla::ipc::IPCResult RecvUnlinkGhosts() override; |
436 | | |
437 | | virtual mozilla::ipc::IPCResult RecvAppInfo(const nsCString& version, const nsCString& buildID, |
438 | | const nsCString& name, const nsCString& UAName, |
439 | | const nsCString& ID, const nsCString& vendor, |
440 | | const nsCString& sourceURL) override; |
441 | | |
442 | | virtual mozilla::ipc::IPCResult RecvRemoteType(const nsString& aRemoteType) override; |
443 | | |
444 | | const nsAString& GetRemoteType() const; |
445 | | |
446 | | virtual mozilla::ipc::IPCResult |
447 | | RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig) override; |
448 | | |
449 | | virtual mozilla::ipc::IPCResult |
450 | | RecvInitBlobURLs(nsTArray<BlobURLRegistrationData>&& aRegistations) override; |
451 | | |
452 | | virtual mozilla::ipc::IPCResult RecvLastPrivateDocShellDestroyed() override; |
453 | | |
454 | | virtual mozilla::ipc::IPCResult |
455 | | RecvNotifyProcessPriorityChanged(const hal::ProcessPriority& aPriority) override; |
456 | | |
457 | | virtual mozilla::ipc::IPCResult RecvMinimizeMemoryUsage() override; |
458 | | |
459 | | virtual mozilla::ipc::IPCResult RecvLoadAndRegisterSheet(const URIParams& aURI, |
460 | | const uint32_t& aType) override; |
461 | | |
462 | | virtual mozilla::ipc::IPCResult RecvUnregisterSheet(const URIParams& aURI, |
463 | | const uint32_t& aType) override; |
464 | | |
465 | | void AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS); |
466 | | |
467 | | void RemoveIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS); |
468 | | |
469 | | virtual mozilla::ipc::IPCResult RecvNotifyIdleObserver(const uint64_t& aObserver, |
470 | | const nsCString& aTopic, |
471 | | const nsString& aData) override; |
472 | | |
473 | | virtual mozilla::ipc::IPCResult RecvUpdateWindow(const uintptr_t& aChildId) override; |
474 | | |
475 | | virtual mozilla::ipc::IPCResult RecvDomainSetChanged(const uint32_t& aSetType, |
476 | | const uint32_t& aChangeType, |
477 | | const OptionalURIParams& aDomain) override; |
478 | | |
479 | | virtual mozilla::ipc::IPCResult RecvShutdown() override; |
480 | | |
481 | | virtual mozilla::ipc::IPCResult |
482 | | RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers, |
483 | | const uint32_t& aAction) override; |
484 | | |
485 | | virtual mozilla::ipc::IPCResult RecvEndDragSession(const bool& aDoneDrag, |
486 | | const bool& aUserCancelled, |
487 | | const mozilla::LayoutDeviceIntPoint& aEndDragPoint, |
488 | | const uint32_t& aKeyModifiers) override; |
489 | | |
490 | | virtual mozilla::ipc::IPCResult |
491 | | RecvPush(const nsCString& aScope, |
492 | | const IPC::Principal& aPrincipal, |
493 | | const nsString& aMessageId) override; |
494 | | |
495 | | virtual mozilla::ipc::IPCResult |
496 | | RecvPushWithData(const nsCString& aScope, |
497 | | const IPC::Principal& aPrincipal, |
498 | | const nsString& aMessageId, |
499 | | InfallibleTArray<uint8_t>&& aData) override; |
500 | | |
501 | | virtual mozilla::ipc::IPCResult |
502 | | RecvPushSubscriptionChange(const nsCString& aScope, |
503 | | const IPC::Principal& aPrincipal) override; |
504 | | |
505 | | virtual mozilla::ipc::IPCResult |
506 | | RecvPushError(const nsCString& aScope, const IPC::Principal& aPrincipal, |
507 | | const nsString& aMessage, const uint32_t& aFlags) override; |
508 | | |
509 | | virtual mozilla::ipc::IPCResult |
510 | | RecvNotifyPushSubscriptionModifiedObservers(const nsCString& aScope, |
511 | | const IPC::Principal& aPrincipal) override; |
512 | | |
513 | | virtual mozilla::ipc::IPCResult RecvActivate(PBrowserChild* aTab) override; |
514 | | |
515 | | virtual mozilla::ipc::IPCResult RecvDeactivate(PBrowserChild* aTab) override; |
516 | | |
517 | | mozilla::ipc::IPCResult |
518 | | RecvRefreshScreens(nsTArray<ScreenDetails>&& aScreens) override; |
519 | | |
520 | | // Get the directory for IndexedDB files. We query the parent for this and |
521 | | // cache the value |
522 | | nsString &GetIndexedDBPath(); |
523 | | |
524 | 0 | ContentParentId GetID() const { return mID; } |
525 | | |
526 | | #if defined(XP_WIN) && defined(ACCESSIBILITY) |
527 | | uint32_t GetChromeMainThreadId() const { return mMainChromeTid; } |
528 | | |
529 | | uint32_t GetMsaaID() const { return mMsaaID; } |
530 | | #endif |
531 | | |
532 | 0 | bool IsForBrowser() const { return mIsForBrowser; } |
533 | | |
534 | | virtual PFileDescriptorSetChild* |
535 | | SendPFileDescriptorSetConstructor(const FileDescriptor&) override; |
536 | | |
537 | | virtual PFileDescriptorSetChild* |
538 | | AllocPFileDescriptorSetChild(const FileDescriptor&) override; |
539 | | |
540 | | virtual bool |
541 | | DeallocPFileDescriptorSetChild(PFileDescriptorSetChild*) override; |
542 | | |
543 | | virtual bool SendPBrowserConstructor(PBrowserChild* actor, |
544 | | const TabId& aTabId, |
545 | | const TabId& aSameTabGroupAs, |
546 | | const IPCTabContext& context, |
547 | | const uint32_t& chromeFlags, |
548 | | const ContentParentId& aCpID, |
549 | | const bool& aIsForBrowser) override; |
550 | | |
551 | | virtual mozilla::ipc::IPCResult RecvPBrowserConstructor(PBrowserChild* aCctor, |
552 | | const TabId& aTabId, |
553 | | const TabId& aSameTabGroupAs, |
554 | | const IPCTabContext& aContext, |
555 | | const uint32_t& aChromeFlags, |
556 | | const ContentParentId& aCpID, |
557 | | const bool& aIsForBrowser) override; |
558 | | |
559 | | FORWARD_SHMEM_ALLOCATOR_TO(PContentChild) |
560 | | |
561 | | void GetAvailableDictionaries(InfallibleTArray<nsString>& aDictionaries); |
562 | | |
563 | | PBrowserOrId |
564 | | GetBrowserOrId(TabChild* aTabChild); |
565 | | |
566 | | virtual POfflineCacheUpdateChild* |
567 | | AllocPOfflineCacheUpdateChild(const URIParams& manifestURI, |
568 | | const URIParams& documentURI, |
569 | | const PrincipalInfo& aLoadingPrincipalInfo, |
570 | | const bool& stickDocument) override; |
571 | | |
572 | | virtual bool |
573 | | DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* offlineCacheUpdate) override; |
574 | | |
575 | | virtual PWebrtcGlobalChild* AllocPWebrtcGlobalChild() override; |
576 | | |
577 | | virtual bool DeallocPWebrtcGlobalChild(PWebrtcGlobalChild *aActor) override; |
578 | | |
579 | | virtual PContentPermissionRequestChild* |
580 | | AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests, |
581 | | const IPC::Principal& aPrincipal, |
582 | | const bool& aIsHandlingUserInput, |
583 | | const TabId& aTabId) override; |
584 | | virtual bool |
585 | | DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor) override; |
586 | | |
587 | | // Windows specific - set up audio session |
588 | | virtual mozilla::ipc::IPCResult |
589 | | RecvSetAudioSessionData(const nsID& aId, |
590 | | const nsString& aDisplayName, |
591 | | const nsString& aIconPath) override; |
592 | | |
593 | | |
594 | | // GetFiles for WebKit/Blink FileSystem API and Directory API must run on the |
595 | | // parent process. |
596 | | void |
597 | | CreateGetFilesRequest(const nsAString& aDirectoryPath, bool aRecursiveFlag, |
598 | | nsID& aUUID, GetFilesHelperChild* aChild); |
599 | | |
600 | | void |
601 | | DeleteGetFilesRequest(nsID& aUUID, GetFilesHelperChild* aChild); |
602 | | |
603 | | virtual mozilla::ipc::IPCResult |
604 | | RecvGetFilesResponse(const nsID& aUUID, |
605 | | const GetFilesResponseResult& aResult) override; |
606 | | |
607 | | virtual mozilla::ipc::IPCResult |
608 | | RecvBlobURLRegistration(const nsCString& aURI, const IPCBlob& aBlob, |
609 | | const IPC::Principal& aPrincipal) override; |
610 | | |
611 | | virtual mozilla::ipc::IPCResult |
612 | | RecvBlobURLUnregistration(const nsCString& aURI) override; |
613 | | |
614 | | virtual mozilla::ipc::IPCResult |
615 | | RecvFileCreationResponse(const nsID& aUUID, |
616 | | const FileCreationResult& aResult) override; |
617 | | |
618 | | mozilla::ipc::IPCResult |
619 | | RecvRequestMemoryReport( |
620 | | const uint32_t& generation, |
621 | | const bool& anonymize, |
622 | | const bool& minimizeMemoryUsage, |
623 | | const MaybeFileDesc& DMDFile) override; |
624 | | |
625 | | virtual mozilla::ipc::IPCResult |
626 | | RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit, |
627 | | const StructuredCloneData& aInitialData, |
628 | | nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache, |
629 | | nsTArray<SystemFontListEntry>&& aFontList) override; |
630 | | |
631 | | virtual mozilla::ipc::IPCResult |
632 | | RecvProvideAnonymousTemporaryFile(const uint64_t& aID, const FileDescOrError& aFD) override; |
633 | | |
634 | | mozilla::ipc::IPCResult |
635 | | RecvSetPermissionsWithKey(const nsCString& aPermissionKey, |
636 | | nsTArray<IPC::Permission>&& aPerms) override; |
637 | | |
638 | | virtual mozilla::ipc::IPCResult |
639 | | RecvShareCodeCoverageMutex(const CrossProcessMutexHandle& aHandle) override; |
640 | | |
641 | | virtual mozilla::ipc::IPCResult |
642 | | RecvDumpCodeCoverageCounters(DumpCodeCoverageCountersResolver&& aResolver) override; |
643 | | |
644 | | virtual mozilla::ipc::IPCResult |
645 | | RecvResetCodeCoverageCounters(ResetCodeCoverageCountersResolver&& aResolver) override; |
646 | | |
647 | | virtual mozilla::ipc::IPCResult |
648 | | RecvSetInputEventQueueEnabled() override; |
649 | | |
650 | | virtual mozilla::ipc::IPCResult |
651 | | RecvFlushInputEventQueue() override; |
652 | | |
653 | | virtual mozilla::ipc::IPCResult |
654 | | RecvSuspendInputEventQueue() override; |
655 | | |
656 | | virtual mozilla::ipc::IPCResult |
657 | | RecvResumeInputEventQueue() override; |
658 | | |
659 | | virtual mozilla::ipc::IPCResult |
660 | | RecvAddDynamicScalars(nsTArray<DynamicScalarDefinition>&& aDefs) override; |
661 | | |
662 | | #if defined(XP_WIN) && defined(ACCESSIBILITY) |
663 | | bool |
664 | | SendGetA11yContentId(); |
665 | | #endif // defined(XP_WIN) && defined(ACCESSIBILITY) |
666 | | |
667 | | // Get a reference to the font list passed from the chrome process, |
668 | | // for use during gfx initialization. |
669 | | InfallibleTArray<mozilla::dom::SystemFontListEntry>& |
670 | 0 | SystemFontList() { |
671 | 0 | return mFontList; |
672 | 0 | } |
673 | | |
674 | | // PURLClassifierChild |
675 | | virtual PURLClassifierChild* |
676 | | AllocPURLClassifierChild(const Principal& aPrincipal, |
677 | | const bool& aUseTrackingProtection, |
678 | | bool* aSuccess) override; |
679 | | virtual bool |
680 | | DeallocPURLClassifierChild(PURLClassifierChild* aActor) override; |
681 | | |
682 | | // PURLClassifierLocalChild |
683 | | virtual PURLClassifierLocalChild* |
684 | | AllocPURLClassifierLocalChild(const URIParams& aUri, |
685 | | const nsCString& aTables) override; |
686 | | virtual bool |
687 | | DeallocPURLClassifierLocalChild(PURLClassifierLocalChild* aActor) override; |
688 | | |
689 | | virtual PLoginReputationChild* |
690 | | AllocPLoginReputationChild(const URIParams& aUri) override; |
691 | | |
692 | | virtual bool |
693 | | DeallocPLoginReputationChild(PLoginReputationChild* aActor) override; |
694 | | |
695 | | nsTArray<LookAndFeelInt>& |
696 | 0 | LookAndFeelCache() { |
697 | 0 | return mLookAndFeelCache; |
698 | 0 | } |
699 | | |
700 | | /** |
701 | | * Helper function for protocols that use the GPU process when available. |
702 | | * Overrides FatalError to just be a warning when communicating with the |
703 | | * GPU process since we don't want to crash the content process when the |
704 | | * GPU process crashes. |
705 | | */ |
706 | | static void FatalErrorIfNotUsingGPUProcess(const char* const aErrorMsg, |
707 | | base::ProcessId aOtherPid); |
708 | | |
709 | | // This method is used by FileCreatorHelper for the creation of a BlobImpl. |
710 | | void |
711 | | FileCreationRequest(nsID& aUUID, FileCreatorHelper* aHelper, |
712 | | const nsAString& aFullPath, const nsAString& aType, |
713 | | const nsAString& aName, |
714 | | const Optional<int64_t>& aLastModified, |
715 | | bool aExistenceCheck, bool aIsFromNsIFile); |
716 | | |
717 | | typedef std::function<void(PRFileDesc*)> AnonymousTemporaryFileCallback; |
718 | | nsresult AsyncOpenAnonymousTemporaryFile(const AnonymousTemporaryFileCallback& aCallback); |
719 | | |
720 | | virtual already_AddRefed<nsIEventTarget> GetEventTargetFor(TabChild* aTabChild) override; |
721 | | |
722 | | mozilla::ipc::IPCResult |
723 | | RecvSetPluginList(const uint32_t& aPluginEpoch, |
724 | | nsTArray<PluginTag>&& aPluginTags, |
725 | | nsTArray<FakePluginTag>&& aFakePluginTags) override; |
726 | | |
727 | | virtual PClientOpenWindowOpChild* |
728 | | AllocPClientOpenWindowOpChild(const ClientOpenWindowArgs& aArgs) override; |
729 | | |
730 | | virtual mozilla::ipc::IPCResult |
731 | | RecvPClientOpenWindowOpConstructor(PClientOpenWindowOpChild* aActor, |
732 | | const ClientOpenWindowArgs& aArgs) override; |
733 | | |
734 | | virtual bool |
735 | | DeallocPClientOpenWindowOpChild(PClientOpenWindowOpChild* aActor) override; |
736 | | |
737 | | mozilla::ipc::IPCResult |
738 | | RecvSaveRecording(const FileDescriptor& aFile) override; |
739 | | |
740 | | #ifdef NIGHTLY_BUILD |
741 | | // Fetch the current number of pending input events. |
742 | | // |
743 | | // NOTE: This method performs an atomic read, and is safe to call from all threads. |
744 | | uint32_t |
745 | | GetPendingInputEvents() |
746 | 0 | { |
747 | 0 | return mPendingInputEvents; |
748 | 0 | } |
749 | | #endif |
750 | | |
751 | | private: |
752 | | static void ForceKillTimerCallback(nsITimer* aTimer, void* aClosure); |
753 | | void StartForceKillTimer(); |
754 | | |
755 | | void ShutdownInternal(); |
756 | | |
757 | | mozilla::ipc::IPCResult |
758 | | GetResultForRenderingInitFailure(base::ProcessId aOtherPid); |
759 | | |
760 | | virtual void ActorDestroy(ActorDestroyReason why) override; |
761 | | |
762 | | virtual void ProcessingError(Result aCode, const char* aReason) override; |
763 | | |
764 | | virtual already_AddRefed<nsIEventTarget> |
765 | | GetConstructedEventTarget(const Message& aMsg) override; |
766 | | |
767 | | virtual already_AddRefed<nsIEventTarget> |
768 | | GetSpecificMessageEventTarget(const Message& aMsg) override; |
769 | | |
770 | | #ifdef NIGHTLY_BUILD |
771 | | virtual void |
772 | | OnChannelReceivedMessage(const Message& aMsg) override; |
773 | | |
774 | | virtual PContentChild::Result |
775 | | OnMessageReceived(const Message& aMsg) override; |
776 | | |
777 | | virtual PContentChild::Result |
778 | | OnMessageReceived(const Message& aMsg, Message*& aReply) override; |
779 | | #endif |
780 | | |
781 | | InfallibleTArray<nsAutoPtr<AlertObserver> > mAlertObservers; |
782 | | RefPtr<ConsoleListener> mConsoleListener; |
783 | | |
784 | | nsTHashtable<nsPtrHashKey<nsIObserver>> mIdleObservers; |
785 | | |
786 | | InfallibleTArray<nsString> mAvailableDictionaries; |
787 | | |
788 | | // Temporary storage for a list of available fonts, passed from the |
789 | | // parent process and used to initialize gfx in the child. Currently used |
790 | | // only on MacOSX and Linux. |
791 | | InfallibleTArray<mozilla::dom::SystemFontListEntry> mFontList; |
792 | | // Temporary storage for nsXPLookAndFeel flags. |
793 | | nsTArray<LookAndFeelInt> mLookAndFeelCache; |
794 | | |
795 | | /** |
796 | | * An ID unique to the process containing our corresponding |
797 | | * content parent. |
798 | | * |
799 | | * We expect our content parent to set this ID immediately after opening a |
800 | | * channel to us. |
801 | | */ |
802 | | ContentParentId mID; |
803 | | |
804 | | #if defined(XP_WIN) && defined(ACCESSIBILITY) |
805 | | /** |
806 | | * The thread ID of the main thread in the chrome process. |
807 | | */ |
808 | | uint32_t mMainChromeTid; |
809 | | |
810 | | /** |
811 | | * This is an a11y-specific unique id for the content process that is |
812 | | * generated by the chrome process. |
813 | | */ |
814 | | uint32_t mMsaaID; |
815 | | #endif |
816 | | |
817 | | AppInfo mAppInfo; |
818 | | |
819 | | bool mIsForBrowser; |
820 | | nsString mRemoteType = VoidString(); |
821 | | bool mIsAlive; |
822 | | nsString mProcessName; |
823 | | |
824 | | static ContentChild* sSingleton; |
825 | | |
826 | | class ShutdownCanary; |
827 | | static StaticAutoPtr<ShutdownCanary> sShutdownCanary; |
828 | | |
829 | | nsCOMPtr<nsIDomainPolicy> mPolicy; |
830 | | nsCOMPtr<nsITimer> mForceKillTimer; |
831 | | |
832 | | RefPtr<ipc::SharedMap> mSharedData; |
833 | | |
834 | | #ifdef MOZ_GECKO_PROFILER |
835 | | RefPtr<ChildProfilerController> mProfilerController; |
836 | | #endif |
837 | | |
838 | | #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) |
839 | | nsCOMPtr<nsIFile> mProfileDir; |
840 | | #endif |
841 | | |
842 | | // Hashtable to keep track of the pending GetFilesHelper objects. |
843 | | // This GetFilesHelperChild objects are removed when RecvGetFilesResponse is |
844 | | // received. |
845 | | nsRefPtrHashtable<nsIDHashKey, GetFilesHelperChild> mGetFilesPendingRequests; |
846 | | |
847 | | // Hashtable to keep track of the pending file creation. |
848 | | // These items are removed when RecvFileCreationResponse is received. |
849 | | nsRefPtrHashtable<nsIDHashKey, FileCreatorHelper> mFileCreationPending; |
850 | | |
851 | | |
852 | | nsClassHashtable<nsUint64HashKey, AnonymousTemporaryFileCallback> mPendingAnonymousTemporaryFiles; |
853 | | |
854 | | mozilla::Atomic<bool> mShuttingDown; |
855 | | |
856 | | #ifdef NIGHTLY_BUILD |
857 | | // NOTE: This member is atomic because it can be accessed from off-main-thread. |
858 | | mozilla::Atomic<uint32_t> mPendingInputEvents; |
859 | | #endif |
860 | | |
861 | | DISALLOW_EVIL_CONSTRUCTORS(ContentChild); |
862 | | }; |
863 | | |
864 | | uint64_t |
865 | | NextWindowID(); |
866 | | |
867 | | } // namespace dom |
868 | | } // namespace mozilla |
869 | | |
870 | | #endif // mozilla_dom_ContentChild_h |