From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Rose <japthorp@slack-corp.com>
Date: Mon, 20 Jun 2022 14:53:37 -0700
Subject: disable freezing flags after init in node

This was introduced in
https://chromium-review.googlesource.com/c/chromium/src/+/3687671.

When running node in the renderer, flags are updated after initialization, so
freezing the flags in Blink causes node initialization to fail.

If possible, it would be ideal to do this without a patch.
https://bugs.chromium.org/p/v8/issues/detail?id=12887 suggests that there may
at some point be an API to "unfreeze" the flags, or we may be able to refactor
node initialization to not update flags after V8 initialization.

diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc
index 0739558b3912221356ed1a4491bab95eca8e7156..613c757eb7366263df2781da16e18266cb2f5ba4 100644
--- a/content/renderer/render_process_impl.cc
+++ b/content/renderer/render_process_impl.cc
@@ -229,6 +229,9 @@ RenderProcessImpl::RenderProcessImpl()
     v8::V8::SetFlagsFromString(kSABPerContextFlag, sizeof(kSABPerContextFlag));
   }
 
+  // Freezing flags after init conflicts with node in the renderer.
+  v8::V8::SetFlagsFromString("--no-freeze-flags-after-init");
+
 #ifdef ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX
   if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) {
     base::CommandLine* const command_line =
