Browse Source

fix: don't crash Web Workers on unhandled rejections (#45992)

Shelley Vohr 1 month ago
parent
commit
a90d50e13f
1 changed files with 3 additions and 0 deletions
  1. 3 0
      shell/renderer/web_worker_observer.cc

+ 3 - 0
shell/renderer/web_worker_observer.cc

@@ -85,6 +85,9 @@ void WebWorkerObserver::WorkerScriptReadyForEvaluation(
     }
   }
 
+  // We do not want to crash Web Workers on unhandled rejections.
+  env->options()->unhandled_rejections = "warn-with-error-code";
+
   // Add Electron extended APIs.
   electron_bindings_->BindTo(env->isolate(), env->process_object());