diff --git a/toolkit/components/crashes/CrashManager.in.sys.mjs b/toolkit/components/crashes/CrashManager.in.sys.mjs index 41b62201cfc3..253f70d07edf 100644 --- a/toolkit/components/crashes/CrashManager.in.sys.mjs +++ b/toolkit/components/crashes/CrashManager.in.sys.mjs @@ -674,7 +674,7 @@ CrashManager.prototype = Object.freeze({ for (let line in annotations) { try { - if (Services.appinfo.isAnnotationAllowlistedForPing(line)) { + if (Services.appinfo.isAnnotationAllowedForPing(line)) { filteredAnnotations[line] = annotations[line]; } } catch (e) { diff --git a/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js b/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js index e03b90d62a32..2f77ea51053b 100644 --- a/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js +++ b/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js @@ -330,7 +330,7 @@ add_task(async function test_main_crash_event_file() { Assert.equal( found.payload.metadata.ThisShouldNot, undefined, - "Non-allowlisted fields should be filtered out" + "Non-allowed fields should be filtered out" ); count = await m.aggregateEventsFiles(); @@ -757,17 +757,17 @@ add_task(async function test_child_process_crash_ping() { Assert.equal( found.payload.metadata.ThisShouldNot, undefined, - "Non-allowlisted fields should be filtered out" + "Non-allowed fields should be filtered out" ); Assert.equal( found.payload.metadata.RemoteType, remoteType, - "RemoteType should be allowlisted for content crashes" + "RemoteType should be allowed for content crashes" ); Assert.equal( found.payload.metadata.ipc_channel_error, "ShutDownKill", - "ipc_channel_error should be allowlisted for content crashes" + "ipc_channel_error should be allowed for content crashes" ); } diff --git a/toolkit/crashreporter/CrashAnnotations.cpp b/toolkit/crashreporter/CrashAnnotations.cpp index 54c3ad16105a..65f672a23fa0 100644 --- a/toolkit/crashreporter/CrashAnnotations.cpp +++ b/toolkit/crashreporter/CrashAnnotations.cpp @@ -15,7 +15,7 @@ using std::find_if; namespace CrashReporter { bool AnnotationFromString(Annotation& aResult, const char* aValue) { - auto elem = find_if( + const auto* elem = find_if( begin(kAnnotationStrings), end(kAnnotationStrings), [&aValue](const char* aString) { return strcmp(aString, aValue) == 0; }); @@ -27,12 +27,12 @@ bool AnnotationFromString(Annotation& aResult, const char* aValue) { return true; } -bool IsAnnotationAllowlistedForPing(Annotation aAnnotation) { - auto elem = find_if( - begin(kCrashPingAllowlist), end(kCrashPingAllowlist), +bool IsAnnotationAllowedForPing(Annotation aAnnotation) { + const auto* elem = find_if( + begin(kCrashPingAllowedList), end(kCrashPingAllowedList), [&aAnnotation](Annotation aElement) { return aElement == aAnnotation; }); - return elem != end(kCrashPingAllowlist); + return elem != end(kCrashPingAllowedList); } } // namespace CrashReporter diff --git a/toolkit/crashreporter/CrashAnnotations.h.in b/toolkit/crashreporter/CrashAnnotations.h.in index c87ad4a2eab6..8f53e9b54933 100644 --- a/toolkit/crashreporter/CrashAnnotations.h.in +++ b/toolkit/crashreporter/CrashAnnotations.h.in @@ -21,8 +21,8 @@ ${strings} }; // Allowlist of crash annotations that can be included in a crash ping -const Annotation kCrashPingAllowlist[] = { -${allowlist} +const Annotation kCrashPingAllowedList[] = { +${allowedlist} }; /** @@ -46,14 +46,14 @@ static inline const char* AnnotationToString(Annotation aAnnotation) { bool AnnotationFromString(Annotation& aResult, const char* aValue); /** - * Checks if the given crash annotation is allowlisted for inclusion in the - * crash ping. + * Checks if the given crash annotation is allowed for inclusion in the crash + * ping. * * @param aAnnotation the crash annotation to be checked * @return true if the annotation can be included in the crash ping, false * otherwise */ -bool IsAnnotationAllowlistedForPing(Annotation aAnnotation); +bool IsAnnotationAllowedForPing(Annotation aAnnotation); /** * Abstract annotation writer, this is needed only for code that writes out diff --git a/toolkit/crashreporter/CrashAnnotations.yaml b/toolkit/crashreporter/CrashAnnotations.yaml index 3734780d45fa..79964e9b8b02 100644 --- a/toolkit/crashreporter/CrashAnnotations.yaml +++ b/toolkit/crashreporter/CrashAnnotations.yaml @@ -8,8 +8,8 @@ # Additionally a field can have the following optional fields: # - altname: A string that will be used when writing out the annotation to the # .extra file instead of the annotation name -# - ping: A boolean that indicates whether the annotation is allowlisted for -# going into the crash ping, if not specified this defaults to false +# - ping: A boolean that indicates whether the annotation is allowed for +# inclusion in the crash ping, if not specified this defaults to false AbortMessage: description: > diff --git a/toolkit/crashreporter/client/ping.cpp b/toolkit/crashreporter/client/ping.cpp index 72dc163de25c..b49211c9c158 100644 --- a/toolkit/crashreporter/client/ping.cpp +++ b/toolkit/crashreporter/client/ping.cpp @@ -124,7 +124,7 @@ static Json::Value CreateMetadataNode(const Json::Value& aExtra) { Annotation annotation; if (AnnotationFromString(annotation, iter.memberName())) { - if (IsAnnotationAllowlistedForPing(annotation)) { + if (IsAnnotationAllowedForPing(annotation)) { node[iter.memberName()] = *iter; } } diff --git a/toolkit/crashreporter/generate_crash_reporter_sources.py b/toolkit/crashreporter/generate_crash_reporter_sources.py index beefa2e2741b..19541f9ef748 100644 --- a/toolkit/crashreporter/generate_crash_reporter_sources.py +++ b/toolkit/crashreporter/generate_crash_reporter_sources.py @@ -72,8 +72,8 @@ def read_template(template_filename): return template -def extract_crash_ping_allowlist(annotations): - """Extract an array holding the names of the annotations allowlisted for +def extract_crash_ping_allowedlist(annotations): + """Extract an array holding the names of the annotations allowed for inclusion in the crash ping.""" return [ @@ -123,13 +123,13 @@ def generate_header(template, annotations): """Generate a header by filling the template with the the list of annotations and return it as a string.""" - allowlist = extract_crash_ping_allowlist(annotations) + allowedlist = extract_crash_ping_allowedlist(annotations) return template_header + string.Template(template).substitute( { "enum": generate_enum(annotations), "strings": generate_strings(annotations), - "allowlist": generate_array_initializer(allowlist), + "allowedlist": generate_array_initializer(allowedlist), } ) @@ -168,11 +168,11 @@ def generate_java_array_initializer(contents): def generate_class(template, annotations): """Fill the class template from the list of annotations.""" - allowlist = extract_crash_ping_allowlist(annotations) + allowedlist = extract_crash_ping_allowedlist(annotations) return template_header + string.Template(template).substitute( { - "allowlist": generate_java_array_initializer(allowlist), + "allowedlist": generate_java_array_initializer(allowedlist), } ) @@ -189,8 +189,8 @@ def emit_class(output, annotations_filename): * are kept in sync with the other C++ and JS users. */ public class CrashReporterConstants { - public static final String[] ANNOTATION_ALLOWLIST = { - ${allowlist} + public static final String[] ANNOTATION_ALLOWEDLIST = { + ${allowedlist} }; }""" ) diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index baa30a602123..73e94c206b68 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -1837,15 +1837,15 @@ nsXULAppInfo::RemoveCrashReportAnnotation(const nsACString& key) { } NS_IMETHODIMP -nsXULAppInfo::IsAnnotationAllowlistedForPing(const nsACString& aValue, - bool* aIsAllowlisted) { +nsXULAppInfo::IsAnnotationAllowedForPing(const nsACString& aValue, + bool* aIsAllowed) { CrashReporter::Annotation annotation; if (!AnnotationFromString(annotation, PromiseFlatCString(aValue).get())) { return NS_ERROR_INVALID_ARG; } - *aIsAllowlisted = CrashReporter::IsAnnotationAllowlistedForPing(annotation); + *aIsAllowed = CrashReporter::IsAnnotationAllowedForPing(annotation); return NS_OK; } diff --git a/xpcom/system/nsICrashReporter.idl b/xpcom/system/nsICrashReporter.idl index 0bcb6dcb49c0..6fd0967e752d 100644 --- a/xpcom/system/nsICrashReporter.idl +++ b/xpcom/system/nsICrashReporter.idl @@ -99,7 +99,7 @@ interface nsICrashReporter : nsISupports void removeCrashReportAnnotation(in AUTF8String key); /** - * Checks if an annotation is allowlisted for inclusion in the crash ping. + * Checks if an annotation is allowed for inclusion in the crash ping. * * @param key * Name of a known crash annotation constant. @@ -108,7 +108,7 @@ interface nsICrashReporter : nsISupports included in the crash ping, false otherwise. * @throw NS_ERROR_INVALID_ARG if key contains an invalid value. */ - boolean isAnnotationAllowlistedForPing(in ACString value); + boolean isAnnotationAllowedForPing(in ACString value); /** * Append some data to the "Notes" field, to be submitted with a crash report.