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_ConsoleUtils_h
8 #define mozilla_dom_ConsoleUtils_h
10 #include "mozilla/JSObjectHolder.h"
11 #include "nsISupportsImpl.h"
14 namespace mozilla::dom
{
16 class ConsoleUtils final
{
18 NS_INLINE_DECL_REFCOUNTING(ConsoleUtils
)
26 // Main-thread only, reports a console message from a ServiceWorker.
27 static void ReportForServiceWorkerScope(const nsAString
& aScope
,
28 const nsAString
& aMessage
,
29 const nsAString
& aFilename
,
31 uint32_t aColumnNumber
, Level aLevel
);
37 static ConsoleUtils
* GetOrCreate();
39 JSObject
* GetOrCreateSandbox(JSContext
* aCx
);
41 void ReportForServiceWorkerScopeInternal(const nsAString
& aScope
,
42 const nsAString
& aMessage
,
43 const nsAString
& aFilename
,
45 uint32_t aColumnNumber
,
48 RefPtr
<JSObjectHolder
> mSandbox
;
51 } // namespace mozilla::dom
53 #endif /* mozilla_dom_ConsoleUtils_h */