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/. */
7 #ifndef mozilla_dom_ChromeMessageSender_h
8 #define mozilla_dom_ChromeMessageSender_h
10 #include "mozilla/dom/MessageSender.h"
12 namespace mozilla::dom
{
14 class MessageBroadcaster
;
16 class ChromeMessageSender final
: public MessageSender
{
18 explicit ChromeMessageSender(MessageBroadcaster
* aParentManager
)
19 : MessageSender(nullptr, aParentManager
, MessageManagerFlags::MM_CHROME
) {
20 // This is a bit hackish, we wait until the child process is running before
21 // attaching to the parent manager (see MessageSender::InitWithCallback).
24 virtual JSObject
* WrapObject(JSContext
* aCx
,
25 JS::Handle
<JSObject
*> aGivenProto
) override
;
28 void LoadFrameScript(const nsAString
& aUrl
, bool aAllowDelayedLoad
,
29 bool aRunInGlobalScope
, mozilla::ErrorResult
& aError
) {
30 LoadScript(aUrl
, aAllowDelayedLoad
, aRunInGlobalScope
, aError
);
32 void RemoveDelayedFrameScript(const nsAString
& aURL
) {
33 RemoveDelayedScript(aURL
);
35 void GetDelayedFrameScripts(JSContext
* aCx
,
36 nsTArray
<nsTArray
<JS::Value
>>& aScripts
,
37 mozilla::ErrorResult
& aError
) {
38 GetDelayedScripts(aCx
, aScripts
, aError
);
42 } // namespace mozilla::dom
44 #endif // mozilla_dom_ChromeMessageSender_h