forked from mirrors/gecko-dev
Bug 1867233 - Rename IsAnnotationAllowlistedForPing() r=afranchuk
Differential Revision: https://phabricator.services.mozilla.com/D194976
This commit is contained in:
parent
2aa8541d0c
commit
e825df6c3f
9 changed files with 31 additions and 31 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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: >
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
};
|
||||
}"""
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue