| Index: components/app_modal/javascript_dialog_manager.cc
|
| diff --git a/components/app_modal/javascript_dialog_manager.cc b/components/app_modal/javascript_dialog_manager.cc
|
| index 0fcfb9228d3768daecbcf05da283bb2c1b446c1a..3dc55163ec73ef2e14d4aa4a028568559e79a345 100644
|
| --- a/components/app_modal/javascript_dialog_manager.cc
|
| +++ b/components/app_modal/javascript_dialog_manager.cc
|
| @@ -94,6 +94,21 @@ void JavaScriptDialogManager::RunJavaScriptDialog(
|
| &javascript_dialog_extra_data_[web_contents];
|
|
|
| if (extra_data->suppress_javascript_messages_) {
|
| + // If a page tries to open dialogs in a tight loop, the number of
|
| + // suppressions logged can grow out of control. Arbitrarily cap the number
|
| + // logged at 100. That many suppressed dialogs is enough to indicate the
|
| + // page is doing something very hinky.
|
| + if (extra_data->suppressed_dialog_count_ < 100) {
|
| + // Log a suppressed dialog as one that opens and then closes immediately.
|
| + UMA_HISTOGRAM_MEDIUM_TIMES(
|
| + "JSDialogs.FineTiming.TimeBetweenDialogCreatedAndSameDialogClosed",
|
| + base::TimeDelta());
|
| +
|
| + // Only increment the count if it's not already at the limit, to prevent
|
| + // overflow.
|
| + extra_data->suppressed_dialog_count_++;
|
| + }
|
| +
|
| *did_suppress_message = true;
|
| return;
|
| }
|
|
|