Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / workers / WorkerDebugger.h
blob3be7ef4203f6b616e46226e6b74941c596a9d051
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_workers_WorkerDebugger_h
8 #define mozilla_dom_workers_WorkerDebugger_h
10 #include "mozilla/dom/WorkerScope.h"
11 #include "nsCOMPtr.h"
12 #include "nsIWorkerDebugger.h"
14 class mozIDOMWindow;
15 class nsIPrincipal;
16 class nsPIDOMWindowInner;
18 namespace mozilla::dom {
20 class WorkerPrivate;
22 class WorkerDebugger : public nsIWorkerDebugger {
23 class ReportDebuggerErrorRunnable;
24 class PostDebuggerMessageRunnable;
26 CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
27 bool mIsInitialized;
28 nsTArray<nsCOMPtr<nsIWorkerDebuggerListener>> mListeners;
30 public:
31 explicit WorkerDebugger(WorkerPrivate* aWorkerPrivate);
33 NS_DECL_ISUPPORTS
34 NS_DECL_NSIWORKERDEBUGGER
36 void AssertIsOnParentThread();
38 void Close();
40 void PostMessageToDebugger(const nsAString& aMessage);
42 void ReportErrorToDebugger(const nsAString& aFilename, uint32_t aLineno,
43 const nsAString& aMessage);
45 private:
46 virtual ~WorkerDebugger();
48 void PostMessageToDebuggerOnMainThread(const nsAString& aMessage);
50 void ReportErrorToDebuggerOnMainThread(const nsAString& aFilename,
51 uint32_t aLineno,
52 const nsAString& aMessage);
54 nsCOMPtr<nsPIDOMWindowInner> DedicatedWorkerWindow();
57 } // namespace mozilla::dom
59 #endif // mozilla_dom_workers_WorkerDebugger_h