diff options
Diffstat (limited to 'components/app_modal/javascript_dialog_manager.cc')
| -rw-r--r-- | components/app_modal/javascript_dialog_manager.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/app_modal/javascript_dialog_manager.cc b/components/app_modal/javascript_dialog_manager.cc index f654f8bf3..7c4db07 100644 --- a/components/app_modal/javascript_dialog_manager.cc +++ b/components/app_modal/javascript_dialog_manager.cc @@ -104,6 +104,21 @@ void JavaScriptDialogManager::RunJavaScriptDialog( 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; } |
