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_ChromeMessageBroadcaster_h
8 #define mozilla_dom_ChromeMessageBroadcaster_h
10 #include "mozilla/dom/MessageBroadcaster.h"
12 namespace mozilla::dom
{
15 * Implementation for the WebIDL ChromeMessageBroadcaster interface. Used for
16 * window and group message managers.
18 class ChromeMessageBroadcaster final
: public MessageBroadcaster
{
20 explicit ChromeMessageBroadcaster(MessageManagerFlags aFlags
)
21 : ChromeMessageBroadcaster(nullptr, aFlags
) {
22 MOZ_ASSERT(!(aFlags
& ~(MessageManagerFlags::MM_GLOBAL
|
23 MessageManagerFlags::MM_OWNSCALLBACK
)));
25 explicit ChromeMessageBroadcaster(MessageBroadcaster
* aParentManager
)
26 : ChromeMessageBroadcaster(aParentManager
, MessageManagerFlags::MM_NONE
) {
29 virtual JSObject
* WrapObject(JSContext
* aCx
,
30 JS::Handle
<JSObject
*> aGivenProto
) override
;
33 void LoadFrameScript(const nsAString
& aUrl
, bool aAllowDelayedLoad
,
34 bool aRunInGlobalScope
, mozilla::ErrorResult
& aError
) {
35 LoadScript(aUrl
, aAllowDelayedLoad
, aRunInGlobalScope
, aError
);
37 void RemoveDelayedFrameScript(const nsAString
& aURL
) {
38 RemoveDelayedScript(aURL
);
40 void GetDelayedFrameScripts(JSContext
* aCx
,
41 nsTArray
<nsTArray
<JS::Value
>>& aScripts
,
42 mozilla::ErrorResult
& aError
) {
43 GetDelayedScripts(aCx
, aScripts
, aError
);
47 ChromeMessageBroadcaster(MessageBroadcaster
* aParentManager
,
48 MessageManagerFlags aFlags
)
49 : MessageBroadcaster(aParentManager
,
50 aFlags
| MessageManagerFlags::MM_CHROME
) {}
53 } // namespace mozilla::dom
55 #endif // mozilla_dom_ChromeMessageBroadcaster_h