Bug 1610775 [wpt PR 21336] - Update urllib3 to 1.25.8, a=testonly
[gecko.git] / dom / console / ConsoleUtils.h
blob0626d909078779d191a3fb1b4aa270b3eedd342a
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"
12 #include "nsString.h"
14 namespace mozilla {
15 namespace dom {
17 class ConsoleUtils final {
18 public:
19 NS_INLINE_DECL_REFCOUNTING(ConsoleUtils)
21 enum Level {
22 eLog,
23 eWarning,
24 eError,
27 // Main-thread only, reports a console message from a ServiceWorker.
28 static void ReportForServiceWorkerScope(const nsAString& aScope,
29 const nsAString& aMessage,
30 const nsAString& aFilename,
31 uint32_t aLineNumber,
32 uint32_t aColumnNumber, Level aLevel);
34 private:
35 ConsoleUtils();
36 ~ConsoleUtils();
38 static ConsoleUtils* GetOrCreate();
40 JSObject* GetOrCreateSandbox(JSContext* aCx);
42 void ReportForServiceWorkerScopeInternal(const nsAString& aScope,
43 const nsAString& aMessage,
44 const nsAString& aFilename,
45 uint32_t aLineNumber,
46 uint32_t aColumnNumber,
47 Level aLevel);
49 RefPtr<JSObjectHolder> mSandbox;
52 } // namespace dom
53 } // namespace mozilla
55 #endif /* mozilla_dom_ConsoleUtils_h */