Prevent HungRendererDialogView from appearing during deep scans
This dialog can appear during a long scan, or if the user waits for too
long to close the scan dialog indicating the scanning verdict. It is
misleading as the page seems unresponsive because of the scanning, so
this CL prevents that dialog from appearing at the same time as the
scanning dialog.
The dialog is prevented from being shown by having
ShouldIgnoreUnresponsiveRenderer return true until the paste callback
has been ran.
Bug: 1028750
Change-Id: If34f8184f254074c9ce30b49337a14531e24a8c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2283397
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Roger Tawa <[email protected]>
Commit-Queue: Dominique Fauteux-Chapleau <[email protected]>
Cr-Commit-Position: refs/heads/master@{#786451}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 790018a..6e3c290 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3435,6 +3435,9 @@
}
bool WebContentsImpl::ShouldIgnoreUnresponsiveRenderer() {
+ if (suppress_unresponsive_renderer_count_ > 0)
+ return true;
+
// Ignore unresponsive renderers if the debugger is attached to them since the
// unresponsiveness might be a result of the renderer sitting on a breakpoint.
//
@@ -7341,8 +7344,18 @@
const ui::ClipboardFormatType& data_type,
const std::string& data,
IsClipboardPasteAllowedCallback callback) {
+ ++suppress_unresponsive_renderer_count_;
GetContentClient()->browser()->IsClipboardPasteAllowed(
- this, url, data_type, data, std::move(callback));
+ this, url, data_type, data,
+ base::BindOnce(&WebContentsImpl::IsClipboardPasteAllowedWrapperCallback,
+ weak_factory_.GetWeakPtr(), std::move(callback)));
+}
+
+void WebContentsImpl::IsClipboardPasteAllowedWrapperCallback(
+ IsClipboardPasteAllowedCallback callback,
+ ClipboardPasteAllowed allowed) {
+ std::move(callback).Run(allowed);
+ --suppress_unresponsive_renderer_count_;
}
bool WebContentsImpl::HasSeenRecentScreenOrientationChange() {