<commit_before>diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index b0451e4..0a6457a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1543,6 +1543,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
   std::string unique_name = params.main_frame_name;
   frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
 
+  if (params.view && params.delegate_view) {
+    view_.reset(params.view);
+    render_view_host_delegate_view_ = params.delegate_view;
+  }
+
+  if (!view_) {
   WebContentsViewDelegate* delegate =
       GetContentClient()->browser()->GetWebContentsViewDelegate(this);
 
@@ -1575,6 +1581,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
                                          std::move(view_),
                                          &render_view_host_delegate_view_));
   }
+  }  // !view_
   CHECK(render_view_host_delegate_view_);
   CHECK(view_.get());
 
@@ -4724,6 +4731,7 @@ void WebContentsImpl::RendererUnresponsive(
   // We might have been waiting for both beforeunload and unload ACK.
   // Check if tab is to be unloaded first.
   if (rfhi->IsWaitingForUnloadACK()) {
+#if 0
     // Hang occurred while firing the unload handler.
     // Pretend the handler fired so tab closing continues as if it had.
     GetRenderViewHost()->set_sudden_termination_allowed(true);
@@ -4735,6 +4743,7 @@ void WebContentsImpl::RendererUnresponsive(
     // to recover. Pretend the unload listeners have all fired and close
     // the tab.
     Close();
+#endif
     return;
   }
 
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index efa8ae5..1e64acb 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -55,8 +55,10 @@ class PageState;
 class RenderFrameHost;
 class RenderProcessHost;
 class RenderViewHost;
+class RenderViewHostDelegateView;
 class RenderWidgetHostView;
 class WebContentsDelegate;
+class WebContentsView;
 struct CustomContextMenuContext;
 struct DropData;
 struct Manifest;
@@ -157,6 +159,10 @@ class WebContents : public PageNavigator,
     // Note that the pre-created renderer process may not be used if the first
     // navigation requires a dedicated or privileged process, such as a WebUI.
     bool initialize_renderer;
+
+    // Optionally specify the view and delegate view.
+    content::WebContentsView* view = nullptr;
+    content::RenderViewHostDelegateView* delegate_view = nullptr;
   };
 
   // Creates a new WebContents.<commit_msg>Update web_contents.patch<commit_after>diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 5740537..22921fc 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1578,6 +1578,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
   std::string unique_name;
   frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
 
+  if (params.view && params.delegate_view) {
+    view_.reset(params.view);
+    render_view_host_delegate_view_ = params.delegate_view;
+  }
+
+  if (!view_) {
   WebContentsViewDelegate* delegate =
       GetContentClient()->browser()->GetWebContentsViewDelegate(this);
 
@@ -1608,6 +1614,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
                                          std::move(view_),
                                          &render_view_host_delegate_view_));
   }
+  }  // !view_
   CHECK(render_view_host_delegate_view_);
   CHECK(view_.get());
 
@@ -4808,6 +4815,7 @@ void WebContentsImpl::RendererUnresponsive(
   // We might have been waiting for both beforeunload and unload ACK.
   // Check if tab is to be unloaded first.
   if (rfhi->IsWaitingForUnloadACK()) {
+#if 0
     // Hang occurred while firing the unload handler.
     // Pretend the handler fired so tab closing continues as if it had.
     GetRenderViewHost()->set_sudden_termination_allowed(true);
@@ -4819,6 +4827,7 @@ void WebContentsImpl::RendererUnresponsive(
     // to recover. Pretend the unload listeners have all fired and close
     // the tab.
     Close();
+#endif
     return;
   }
 
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index af944f7..26c5938 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -59,9 +59,11 @@ class PageState;
 class RenderFrameHost;
 class RenderProcessHost;
 class RenderViewHost;
+class RenderViewHostDelegateView;
 class RenderWidgetHost;
 class RenderWidgetHostView;
 class WebContentsDelegate;
+class WebContentsView;
 struct CustomContextMenuContext;
 struct DropData;
 struct Manifest;
@@ -162,6 +164,10 @@ class WebContents : public PageNavigator,
     // Note that the pre-created renderer process may not be used if the first
     // navigation requires a dedicated or privileged process, such as a WebUI.
     bool initialize_renderer;
+
+    // Optionally specify the view and delegate view.
+    content::WebContentsView* view = nullptr;
+    content::RenderViewHostDelegateView* delegate_view = nullptr;
   };
 
   // Creates a new WebContents.
{'fraction_non_alphanumeric': 0.11024498886414254, 'fraction_numerical': 0.03285077951002227, 'mean_word_length': 3.7480176211453746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6481142', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1616, 'n_words': 383}