Skip to content

Commit

Permalink
fix: bad js-flags shouldn't crash the app (#42441)
Browse files Browse the repository at this point in the history
* fix: bad js-flags shouldn't crash the app

Co-authored-by: Shelley Vohr <[email protected]>

* Update shell/browser/javascript_environment.cc

Co-authored-by: Robo <[email protected]>

Co-authored-by: Shelley Vohr <[email protected]>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <[email protected]>
  • Loading branch information
trop[bot] and codebytere committed Jun 11, 2024
1 parent 2633298 commit 3e17753
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions shell/browser/javascript_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,10 @@ JavascriptEnvironment::~JavascriptEnvironment() {
v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop,
bool setup_wasm_streaming) {
auto* cmd = base::CommandLine::ForCurrentProcess();

// --js-flags.
std::string js_flags =
cmd->GetSwitchValueASCII(blink::switches::kJavaScriptFlags);
js_flags.append(" --no-freeze-flags-after-init");
if (!js_flags.empty())
v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size());
std::string js_flags = "--no-freeze-flags-after-init ";
js_flags.append(cmd->GetSwitchValueASCII(blink::switches::kJavaScriptFlags));
v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size());

// The V8Platform of gin relies on Chromium's task schedule, which has not
// been started at this point, so we have to rely on Node's V8Platform.
Expand Down

0 comments on commit 3e17753

Please sign in to comment.