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 /* diagnostic reporting for CSS style sheet parser */
9 #ifndef mozilla_css_ErrorReporter_h_
10 #define mozilla_css_ErrorReporter_h_
28 // FIXME(emilio): Probably better to call this ErrorBuilder or something?
29 class MOZ_STACK_CLASS ErrorReporter final
{
31 explicit ErrorReporter(uint64_t aInnerWindowId
);
34 static void ReleaseGlobals();
35 static void EnsureGlobalsInitialized() {
36 if (MOZ_UNLIKELY(!sInitialized
)) {
41 static bool ShouldReportErrors(const dom::Document
&);
42 static bool ShouldReportErrors(const StyleSheet
*, const Loader
*);
43 static uint64_t FindInnerWindowId(const StyleSheet
*, const Loader
*);
45 void OutputError(const nsACString
& aSource
, const nsACString
& aSelectors
,
46 uint32_t aLineNumber
, uint32_t aColNumber
, nsIURI
* aURI
);
49 // In all overloads of ReportUnexpected, aMessage is a stringbundle
50 // name, which will be processed as a format string with the
51 // indicated number of parameters.
54 void ReportUnexpected(const char* aMessage
);
55 // one parameter which has already been escaped appropriately
56 void ReportUnexpectedUnescaped(const char* aMessage
,
57 const nsTArray
<nsString
>& aParam
);
60 void AddToError(const nsString
& aErrorText
);
61 static void InitGlobals();
63 static bool sInitialized
;
64 static bool sReportErrors
;
67 const uint64_t mInnerWindowId
;
71 } // namespace mozilla
73 #endif // mozilla_css_ErrorReporter_h_