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_ConsoleInstance_h
8 #define mozilla_dom_ConsoleInstance_h
10 #include "mozilla/dom/Console.h"
12 namespace mozilla::dom
{
14 class ConsoleInstance final
: public nsISupports
, public nsWrapperCache
{
16 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
17 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(ConsoleInstance
)
19 explicit ConsoleInstance(JSContext
* aCx
,
20 const ConsoleInstanceOptions
& aOptions
);
23 JSObject
* WrapObject(JSContext
* aCx
,
24 JS::Handle
<JSObject
*> aGivenProto
) override
;
26 nsPIDOMWindowInner
* GetParentObject() const { return nullptr; }
29 void Log(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
32 void Info(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
35 void Warn(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
38 void Error(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
41 void Exception(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
44 void Debug(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
47 void Table(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
50 void Trace(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
53 void Dir(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
56 void Dirxml(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
59 void Group(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
62 void GroupCollapsed(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
65 void GroupEnd(JSContext
* aCx
);
68 void Time(JSContext
* aCx
, const nsAString
& aLabel
);
71 void TimeLog(JSContext
* aCx
, const nsAString
& aLabel
,
72 const Sequence
<JS::Value
>& aData
);
75 void TimeEnd(JSContext
* aCx
, const nsAString
& aLabel
);
78 void TimeStamp(JSContext
* aCx
, const JS::Handle
<JS::Value
> aData
);
81 void Profile(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
84 void ProfileEnd(JSContext
* aCx
, const Sequence
<JS::Value
>& aData
);
87 void Assert(JSContext
* aCx
, bool aCondition
,
88 const Sequence
<JS::Value
>& aData
);
91 void Count(JSContext
* aCx
, const nsAString
& aLabel
);
94 void CountReset(JSContext
* aCx
, const nsAString
& aLabel
);
97 void Clear(JSContext
* aCx
);
100 void ReportForServiceWorkerScope(const nsAString
& aScope
,
101 const nsAString
& aMessage
,
102 const nsAString
& aFilename
,
103 uint32_t aLineNumber
, uint32_t aColumnNumber
,
104 ConsoleLevel aLevel
);
109 RefPtr
<Console
> mConsole
;
112 } // namespace mozilla::dom
114 #endif // mozilla_dom_ConsoleInstance_h