We're getting lots of crash reports from users on macOS Big Sur. The crashing line is either

https://github.com/electron/electron/blob/e3c4bbd21fb0ea2a79d8572add78e4b8c07c64a8/shell/browser/ui/message_box_mac.mm#L117

or

https://github.com/electron/electron/blob/e3c4bbd21fb0ea2a79d8572add78e4b8c07c64a8/shell/browser/ui/message_box_mac.mm#L128

The crash report is annotated with:

>Crashing on exception: -[NSApplication runModalForWindow:] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)
>ViewBridge hint(s): (
>     "bridge key: most-recent-completion"
>)

This is on Electron 10.1.6, I have not tested other versions.

cc @zcbenz
shell/common/gin_helper/promise.h
#ifndef SHELL_COMMON_GIN_HELPER_PROMISE_H_
#define SHELL_COMMON_GIN_HELPER_PROMISE_H_
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include "base/strings/string_piece.h"
#include "base/task/post_task.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "shell/common/gin_converters/std_converter.h"
#include "shell/common/gin_helper/locker.h"
#include "shell/common/gin_helper/microtasks_scope.h"
namespace gin_helper {
class PromiseBase {
 public:
  explicit PromiseBase(v8::Isolate* isolate);
  PromiseBase(v8::Isolate* isolate, v8::Local<v8::Promise::Resolver> handle);
  ~PromiseBase();
  
  PromiseBase(PromiseBase&&);
  PromiseBase& operator=(PromiseBase&&);
  
  
  
  
  static void RejectPromise(PromiseBase&& promise, base::StringPiece errmsg) {