diff --git a/toolkit/components/telemetry/TelemetryEvent.cpp b/toolkit/components/telemetry/TelemetryEvent.cpp index 48d700ac98c3..bf35f8135ef7 100644 --- a/toolkit/components/telemetry/TelemetryEvent.cpp +++ b/toolkit/components/telemetry/TelemetryEvent.cpp @@ -981,7 +981,7 @@ TelemetryEvent::RegisterEvents(const nsACString& aCategory, MOZ_ASSERT(XRE_IsParentProcess(), "Events can only be registered in the parent process"); - if (!IsValidIdentifierString(aCategory, 30, true, false)) { + if (!IsValidIdentifierString(aCategory, 30, true, true)) { JS_ReportErrorASCII(cx, "Category parameter should match the identifier pattern."); return NS_ERROR_INVALID_ARG; } @@ -1065,7 +1065,7 @@ TelemetryEvent::RegisterEvents(const nsACString& aCategory, // Validate methods. for (auto& method : methods) { - if (!IsValidIdentifierString(method, kMaxMethodNameByteLength, false, false)) { + if (!IsValidIdentifierString(method, kMaxMethodNameByteLength, false, true)) { JS_ReportErrorASCII(cx, "Method names should match the identifier pattern."); return NS_ERROR_INVALID_ARG; } @@ -1085,7 +1085,7 @@ TelemetryEvent::RegisterEvents(const nsACString& aCategory, return NS_ERROR_INVALID_ARG; } for (auto& key : extra_keys) { - if (!IsValidIdentifierString(key, kMaxExtraKeyNameByteLength, false, false)) { + if (!IsValidIdentifierString(key, kMaxExtraKeyNameByteLength, false, true)) { JS_ReportErrorASCII(cx, "Extra key names should match the identifier pattern."); return NS_ERROR_INVALID_ARG; } diff --git a/toolkit/components/telemetry/docs/collection/events.rst b/toolkit/components/telemetry/docs/collection/events.rst index 4132fec94ce6..3de9836c85f9 100644 --- a/toolkit/components/telemetry/docs/collection/events.rst +++ b/toolkit/components/telemetry/docs/collection/events.rst @@ -43,7 +43,7 @@ Where the individual fields are: - ``method``: ``String``, identifier. This describes the type of event that occurred, e.g. ``click``, ``keydown`` or ``focus``. - ``object``: ``String``, identifier. This is the object the event occurred on, e.g. ``reload_button`` or ``urlbar``. - ``value``: ``String``, optional, may be ``null``. This is a user defined value, providing context for the event. -- ``extra``: ``Object``, optional, may be ``null``. This is an object of the form ``{"key": "value", ...}``, both keys and values need to be strings. This is used for events where additional richer context is needed. +- ``extra``: ``Object``, optional, may be ``null``. This is an object of the form ``{"key": "value", ...}``, both keys and values need to be strings, keys are identifiers. This is used for events where additional richer context is needed. .. _eventlimits: