Defer navigations during JS modal dialogs.

This will prevent all navigations in the WebContents from committing
for the duration of the dialog, unless the navigation is
user-initiated and targeting the main frame.

CL written by [email protected]; updated by [email protected].

Bug: 972456
Change-Id: I1bad82117a6dc1897b765c63e3b7155e179353e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688153
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Charlie Reis <[email protected]>
Reviewed-by: Ɓukasz Anforowicz <[email protected]>
Commit-Queue: Charlie Reis <[email protected]>
Cr-Commit-Position: refs/heads/master@{#674683}
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 87618062..49418589 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -1922,6 +1922,8 @@
     "web_contents/aura/types.h",
     "web_contents/frame_tree_node_id_registry.cc",
     "web_contents/frame_tree_node_id_registry.h",
+    "web_contents/javascript_dialog_navigation_deferrer.cc",
+    "web_contents/javascript_dialog_navigation_deferrer.h",
     "web_contents/web_contents_impl.cc",
     "web_contents/web_contents_impl.h",
     "web_contents/web_contents_view.h",