disable_freezing_flags_after_init_in_node.patch 1.5 KB

123456789101112131415161718192021222324252627282930
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Jeremy Rose <[email protected]>
  3. Date: Mon, 20 Jun 2022 14:53:37 -0700
  4. Subject: disable freezing flags after init in node
  5. This was introduced in
  6. https://chromium-review.googlesource.com/c/chromium/src/+/3687671.
  7. When running node in the renderer, flags are updated after initialization, so
  8. freezing the flags in Blink causes node initialization to fail.
  9. If possible, it would be ideal to do this without a patch.
  10. https://bugs.chromium.org/p/v8/issues/detail?id=12887 suggests that there may
  11. at some point be an API to "unfreeze" the flags, or we may be able to refactor
  12. node initialization to not update flags after V8 initialization.
  13. diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc
  14. index 15928985bed40a7e0a26d9ab09f44f86ed3f3bd6..612616264b1caf097a4d45a4ba09e312b10e7acf 100644
  15. --- a/content/renderer/render_process_impl.cc
  16. +++ b/content/renderer/render_process_impl.cc
  17. @@ -228,6 +228,9 @@ RenderProcessImpl::RenderProcessImpl()
  18. v8::V8::SetFlagsFromString(kSABPerContextFlag, sizeof(kSABPerContextFlag));
  19. }
  20. + // Freezing flags after init conflicts with node in the renderer.
  21. + v8::V8::SetFlagsFromString("--no-freeze-flags-after-init");
  22. +
  23. #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(ARCH_CPU_X86_64)
  24. if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) {
  25. base::CommandLine* const command_line =