Bug 1688354 [wpt PR 27298] - Treat 'rem' as an absolute unit for font size, a=testonly
[gecko.git] / dom / workers / WorkerError.h
blob2d07c4fcf62cbcf8edd70c4d2c4953684d1d2ff4
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_WorkerError_h
8 #define mozilla_dom_workers_WorkerError_h
10 #include "mozilla/dom/SerializedStackHolder.h"
11 #include "mozilla/dom/WorkerCommon.h"
12 #include "jsapi.h"
14 namespace mozilla {
16 class DOMEventTargetHelper;
18 namespace dom {
20 class ErrorData;
21 class WorkerErrorBase {
22 public:
23 nsString mMessage;
24 nsString mFilename;
25 uint32_t mLineNumber;
26 uint32_t mColumnNumber;
27 uint32_t mErrorNumber;
29 WorkerErrorBase() : mLineNumber(0), mColumnNumber(0), mErrorNumber(0) {}
31 void AssignErrorBase(JSErrorBase* aReport);
34 class WorkerErrorNote : public WorkerErrorBase {
35 public:
36 void AssignErrorNote(JSErrorNotes::Note* aNote);
39 class WorkerPrivate;
41 class WorkerErrorReport : public WorkerErrorBase, public SerializedStackHolder {
42 public:
43 nsString mLine;
44 bool mIsWarning;
45 JSExnType mExnType;
46 bool mMutedError;
47 nsTArray<WorkerErrorNote> mNotes;
49 WorkerErrorReport();
51 void AssignErrorReport(JSErrorReport* aReport);
53 // aWorkerPrivate is the worker thread we're on (or the main thread, if null)
54 // aTarget is the worker object that we are going to fire an error at
55 // (if any).
56 static void ReportError(
57 JSContext* aCx, WorkerPrivate* aWorkerPrivate, bool aFireAtScope,
58 DOMEventTargetHelper* aTarget, UniquePtr<WorkerErrorReport> aReport,
59 uint64_t aInnerWindowId,
60 JS::Handle<JS::Value> aException = JS::NullHandleValue);
62 static void LogErrorToConsole(JSContext* aCx, WorkerErrorReport& aReport,
63 uint64_t aInnerWindowId);
65 static void LogErrorToConsole(const mozilla::dom::ErrorData& aReport,
66 uint64_t aInnerWindowId,
67 JS::HandleObject aStack = nullptr,
68 JS::HandleObject aStackGlobal = nullptr);
70 static void CreateAndDispatchGenericErrorRunnableToParent(
71 WorkerPrivate* aWorkerPrivate);
74 } // namespace dom
75 } // namespace mozilla
77 #endif // mozilla_dom_workers_WorkerError_h