Skip to content

Commit

Permalink
Bandaid fix for crash in RecordDismissalType.
Browse files Browse the repository at this point in the history
This CL adds a quick if to fix the crash. Since I was unable to deduce
which content settings type is causing the crash, I've added a metric
for investigation. Will revisit the original bug in 1 milestone.

Bug: 346343332
Change-Id: Ibdb4d6f42e9d7287bec454006af61ec0160f1d63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622173
Reviewed-by: Ravjit Uppal <ravjit@chromium.org>
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1313462}
  • Loading branch information
andypaicu authored and Chromium LUCI CQ committed Jun 11, 2024
1 parent ca7fafe commit be49f04
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/permissions/permission_uma_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,15 @@ void PermissionUmaUtil::RecordDismissalType(
const std::vector<ContentSettingsType>& content_settings_types,
PermissionPromptDisposition ui_disposition,
DismissalType dismissalType) {
RequestTypeForUma type = GetUmaValueForRequestType(
ContentSettingsTypeToRequestType(content_settings_types[0]));
std::optional<RequestType> request_type =
ContentSettingsTypeToRequestTypeIfExists(content_settings_types[0]);
if (!request_type.has_value()) {
base::UmaHistogramEnumeration(
"Permissions.Prompt.Dismissed.InvalidContentSetting",
content_settings_types[0]);
return;
}
RequestTypeForUma type = GetUmaValueForRequestType(request_type.value());

if (content_settings_types.size() > 1) {
type = RequestTypeForUma::MULTIPLE_AUDIO_AND_VIDEO_CAPTURE;
Expand Down
12 changes: 12 additions & 0 deletions tools/metrics/histograms/metadata/permissions/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,18 @@ chromium-metrics-reviews@google.com.
</summary>
</histogram>

<histogram name="Permissions.Prompt.Dismissed.InvalidContentSetting"
enum="ContentSetting" expires_after="2025-06-01">
<owner>andypaicu@chromium.org</owner>
<owner>src/components/permissions/PERMISSIONS_OWNERS</owner>
<summary>
This metric is used to investigate a crash observed when a certain type of
permission prompt is dismissed. It's recorded when a permission prompt is
dismissed with an invalid content setting (aka one that does not have a
corresponding request type) and it records the content setting itself.
</summary>
</histogram>

<histogram name="Permissions.Prompt.Dismissed.PriorDismissCount2" units="units"
expires_after="2024-07-09">
<owner>engedy@chromium.org</owner>
Expand Down

0 comments on commit be49f04

Please sign in to comment.