OS: macOS, Windows, probably Linux too
Version: v11.x, master
Last working version: v10.1.1

Repro: https://gist.github.com/3eac58d56eede968a9a9e86c899f16a7

```js
const { app, BrowserWindow } = require('electron')

app.whenReady().then(() => {
  const w = new BrowserWindow({ show: true, webPreferences: { webviewTag: true } });
  w.loadURL('data:text/html,<webview src="data:text/html,hi"></webview>');
  app.on('web-contents-created', () => {
    w.close();
  });
})
```

Stack trace:

```
    frame #1: 0x000000010038bf85 Electron Framework`IsVisible at native_window_mac.mm:713:19 [opt]
    frame #2: 0x00000001003e8a20 Electron Framework`::AppendCommandLineSwitches() at web_contents_preferences.cc:423:42 [opt]
    frame #3: 0x0000000100356dc6 Electron Framework`::AppendExtraCommandLineSwitches() at electron_browser_client.cc:791:26 [opt]
    frame #4: 0x000000010494c39f Electron Framework`::AppendRendererCommandLine() at render_process_host_impl.cc:3269:34 [opt]
    frame #5: 0x000000010494a08b Electron Framework`::Init() at render_process_host_impl.cc:1878:5 [opt]
    frame #6: 0x00000001046a09aa Electron Framework`::InitRenderView() at render_frame_host_manager.cc:2356:40 [opt]
    frame #7: 0x0000000104b75c87 Electron Framework`::AttachInnerWebContents() at web_contents_impl.cc:2039:25 [opt]
    frame #8: 0x00000001003f0d5d Electron Framework`::AttachToIframe() at web_view_guest_delegate.cc:46:27 [opt]
[...]
```

<details>
<summary>Full stack trace</summary>

```
* thread #1, name = 'CrBrowserMain', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1ace073f0)
  * frame #0: 0x00007fff7289a029 libobjc.A.dylib`objc_msgSend + 41
    frame #1: 0x000000010038bf85 Electron Framework`IsVisible at native_window_mac.mm:713:19 [opt]
    frame #2: 0x00000001003e8a20 Electron Framework`::AppendCommandLineSwitches() at web_contents_preferences.cc:423:42 [opt]
    frame #3: 0x0000000100356dc6 Electron Framework`::AppendExtraCommandLineSwitches() at electron_browser_client.cc:791:26 [opt]
    frame #4: 0x000000010494c39f Electron Framework`::AppendRendererCommandLine() at render_process_host_impl.cc:3269:34 [opt]
    frame #5: 0x000000010494a08b Electron Framework`::Init() at render_process_host_impl.cc:1878:5 [opt]
    frame #6: 0x00000001046a09aa Electron Framework`::InitRenderView() at render_frame_host_manager.cc:2356:40 [opt]
    frame #7: 0x0000000104b75c87 Electron Framework`::AttachInnerWebContents() at web_contents_impl.cc:2039:25 [opt]
    frame #8: 0x00000001003f0d5d Electron Framework`::AttachToIframe() at web_view_guest_delegate.cc:46:27 [opt]
    frame #9: 0x0000000100321df6 Electron Framework`::DispatchToCallback() [inlined] Run at callback.h:133:12 [opt]
    frame #10: 0x0000000100321dab Electron Framework`::DispatchToCallback() [inlined] DispatchToCallback at function_template.h:228 [opt]
    frame #11: 0x0000000100321d83 Electron Framework`::DispatchToCallback() at function_template.h:262 [opt]
    frame #12: 0x0000000102871188 Electron Framework`::Call() at api-arguments-inl.h:158:3 [opt]
    frame #13: 0x000000010286f59d Electron Framework`::HandleApiCallHelper<false>() at builtins-api.cc:111:36 [opt]
    frame #14: 0x000000010286d89f Electron Framework`::Builtin_Impl_HandleApiCall() at builtins-api.cc:141:5 [opt]
    frame #15: 0x000000010286d417 Electron Framework`::Builtin_HandleApiCall() at builtins-api.cc:129:1 [opt]
    frame #16: 0x0000000103af887f Electron Framework`Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 63
    frame #17: 0x00000001038a78d5 Electron Framework`Builtins_InterpreterEntryTrampoline + 213
    frame #18: 0x00000001038a78d5 Electron Framework`Builtins_InterpreterEntryTrampoline + 213
    frame #19: 0x00000001038a78d5 Electron Framework`Builtins_InterpreterEntryTrampoline + 213
    frame #20: 0x00000001038858ff Electron Framework`Builtins_ArgumentsAdaptorTrampoline + 191
    frame #21: 0x00000001038a78d5 Electron Framework`Builtins_InterpreterEntryTrampoline + 213
    frame #22: 0x00000001038858ff Electron Framework`Builtins_ArgumentsAdaptorTrampoline + 191
    frame #23: 0x00000001038a78d5 Electron Framework`Builtins_InterpreterEntryTrampoline + 213
    frame #24: 0x00000001038a78d5 Electron Framework`Builtins_InterpreterEntryTrampoline + 213
    frame #25: 0x00000001038858ff Electron Framework`Builtins_ArgumentsAdaptorTrampoline + 191
    frame #26: 0x000000010389e09a Electron Framework`Builtins_JSEntryTrampoline + 90
    frame #27: 0x000000010389de78 Electron Framework`Builtins_JSEntry + 120
    frame #28: 0x00000001029c3780 Electron Framework`::Invoke() [inlined] Call at simulator.h:142:12 [opt]
    frame #29: 0x00000001029c3775 Electron Framework`::Invoke() at execution.cc:368 [opt]
    frame #30: 0x00000001029c2d3b Electron Framework`::Call() at execution.cc:462:10 [opt]
    frame #31: 0x000000010279efb5 Electron Framework`::Call() at api.cc:4955:7 [opt]
    frame #32: 0x000000010b839bf8 Electron Framework`::InternalMakeCallback() at callback.cc:189:21 [opt]
    frame #33: 0x000000010b839e45 Electron Framework`::MakeCallback() at callback.cc:250:7 [opt]
    frame #34: 0x000000010042c51d Electron Framework`::CallMethodWithArgs() at event_emitter_caller.cc:23:35 [opt]
    frame #35: 0x0000000100317c03 Electron Framework`::EmitEvent<base::BasicStringPiece<std::string>, v8::Local<v8::Object> &, bool &, const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > &, blink::CloneableMessage>() at event_emitter_caller.h:51:10 [opt]
    frame #36: 0x0000000100317af6 Electron Framework`::EmitCustomEvent<bool &, const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > &, blink::CloneableMessage>() [inlined] EmitWithEvent<bool &, const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > &, blink::CloneableMessage> at event_emitter_mixin.h:80:5 [opt]
    frame #37: 0x0000000100317ac8 Electron Framework`::EmitCustomEvent<bool &, const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > &, blink::CloneableMessage>() at event_emitter_mixin.h:47 [opt]
    frame #38: 0x0000000100301fc7 Electron Framework`::EmitWithSender<bool &, const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > &, blink::CloneableMessage>() at electron_api_web_contents.h:428:12 [opt]
    frame #39: 0x0000000100302102 Electron Framework`::Invoke() at electron_api_web_contents.cc:1229:3 [opt]
    frame #40: 0x00000001051047cb Electron Framework`::AcceptWithResponder() at api.mojom.cc:2539:13 [opt]
    frame #41: 0x0000000100317666 Electron Framework`::AcceptWithResponder() at api.mojom.h:506:12 [opt]
    frame #42: 0x0000000105fdeb27 Electron Framework`::HandleValidatedMessage() at interface_endpoint_client.cc:528:56 [opt]
    frame #43: 0x0000000105fe28df Electron Framework`::Accept() at message_dispatcher.cc:46:24 [opt]
    frame #44: 0x0000000105fe00a1 Electron Framework`::HandleIncomingMessage() at interface_endpoint_client.cc:356:22 [opt]
    frame #45: 0x0000000105fe893c Electron Framework`::ProcessIncomingMessage() at multiplex_router.cc:953:42 [opt]
    frame #46: 0x0000000105fe7dd5 Electron Framework`::Accept() at multiplex_router.cc:620:38 [opt]
    frame #47: 0x0000000105fe291b Electron Framework`::Accept() at message_dispatcher.cc:41:19 [opt]
    frame #48: 0x0000000105fd7cd4 Electron Framework`::DispatchMessage() at connector.cc:509:49 [opt]
    frame #49: 0x0000000105fd87fe Electron Framework`::ReadAllAvailableMessages() at connector.cc:567:14 [opt]
    frame #50: 0x0000000105fd8b1f Electron Framework`::CallDispatchNextMessageFromPipe() at connector.cc:536:3 [opt]
    frame #51: 0x0000000105fd916b Electron Framework`::RunOnce() [inlined] Invoke<void (mojo::Connector::*)(), base::WeakPtr<mojo::Connector>> at bind_internal.h:498:12 [opt]
    frame #52: 0x0000000105fd9101 Electron Framework`::RunOnce() [inlined] MakeItSo<void (mojo::Connector::*)(), base::WeakPtr<mojo::Connector>> at bind_internal.h:657 [opt]
    frame #53: 0x0000000105fd90e6 Electron Framework`::RunOnce() [inlined] RunImpl<void (mojo::Connector::*)(), std::__1::tuple<base::WeakPtr<mojo::Connector> >, 0> at bind_internal.h:710 [opt]
    frame #54: 0x0000000105fd90e6 Electron Framework`::RunOnce() at bind_internal.h:679 [opt]
    frame #55: 0x0000000105acfafb Electron Framework`::RunTask() [inlined] Run at callback.h:99:12 [opt]
    frame #56: 0x0000000105acfaa9 Electron Framework`::RunTask() at task_annotator.cc:142 [opt]
    frame #57: 0x0000000105aeeae7 Electron Framework`::DoWorkImpl() at thread_controller_with_message_pump_impl.cc:332:23 [opt]
    frame #58: 0x0000000105aee758 Electron Framework`::DoWork() at thread_controller_with_message_pump_impl.cc:252:36 [opt]
    frame #59: 0x0000000105b60251 Electron Framework`RunWork at message_pump_mac.mm:358:54 [opt]
    frame #60: 0x0000000105b552e2 Electron Framework`base::mac::CallWithEHFrame(void () block_pointer) at call_with_eh_frame_asm.S:39
    frame #61: 0x0000000105b5fc1f Electron Framework`RunWorkSource at message_pump_mac.mm:334:3 [opt]
    frame #62: 0x00007fff3c570b21 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #63: 0x00007fff3c570ac0 CoreFoundation`__CFRunLoopDoSource0 + 103
    frame #64: 0x00007fff3c5708d4 CoreFoundation`__CFRunLoopDoSources0 + 209
    frame #65: 0x00007fff3c56f740 CoreFoundation`__CFRunLoopRun + 1272
    frame #66: 0x00007fff3c56ebd3 CoreFoundation`CFRunLoopRunSpecific + 499
    frame #67: 0x00007fff3b0c465d HIToolbox`RunCurrentEventLoopInMode + 292
    frame #68: 0x00007fff3b0c439d HIToolbox`ReceiveNextEventCommon + 600
    frame #69: 0x00007fff3b0c4127 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
    frame #70: 0x00007fff39734ba4 AppKit`_DPSNextEvent + 990
    frame #71: 0x00007fff39733380 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
    frame #72: 0x00007fff3972509e AppKit`-[NSApplication run] + 658
    frame #73: 0x0000000105b6120c Electron Framework`DoRun at message_pump_mac.mm:691:5 [opt]
    frame #74: 0x0000000105b5f722 Electron Framework`Run at message_pump_mac.mm:149:3 [opt]
    frame #75: 0x0000000105aef31d Electron Framework`::Run() at thread_controller_with_message_pump_impl.cc:446:12 [opt]
    frame #76: 0x0000000105aa2c6c Electron Framework`::Run() at run_loop.cc:124:14 [opt]
    frame #77: 0x0000000104406b8b Electron Framework`::RunMainMessageLoopParts() [inlined] MainMessageLoopRun at browser_main_loop.cc:1440:12 [opt]
    frame #78: 0x0000000104406afe Electron Framework`::RunMainMessageLoopParts() at browser_main_loop.cc:1005 [opt]
    frame #79: 0x0000000104408f52 Electron Framework`::Run() at browser_main_runner_impl.cc:150:15 [opt]
    frame #80: 0x00000001044036ab Electron Framework`::BrowserMain() at browser_main.cc:47:28 [opt]
    frame #81: 0x000000010421956e Electron Framework`::RunServiceManager() [inlined] RunBrowserProcessMain at content_main_runner_impl.cc:525:10 [opt]
    frame #82: 0x0000000104219515 Electron Framework`::RunServiceManager() at content_main_runner_impl.cc:997 [opt]
    frame #83: 0x0000000104218fc3 Electron Framework`::Run() at content_main_runner_impl.cc:881:12 [opt]
    frame #84: 0x0000000108272e5e Electron Framework`::Main() at main.cc:453:29 [opt]
    frame #85: 0x0000000102150308 Electron Framework`::ContentMain() at content_main.cc:19:10 [opt]
    frame #86: 0x00000001002428c6 Electron Framework`ElectronMain at electron_library_main.mm:23:10 [opt]
    frame #87: 0x0000000100001551 Electron`main at electron_main.cc:274:10 [opt]
    frame #88: 0x00007fff73c147fd libdyld.dylib`start + 1
```

</details>
shell/common/gin_converters/content_converter.cc
v8::Isolate* isolate,
    content::WebContents* web_contents,
    const content::CustomContextMenuContext& context,
    const content::MenuItem& item) {
  gin_helper::Dictionary v8_item = gin::Dictionary::CreateEmpty(isolate);
  switch (item.type) {
    case content::MenuItem::CHECKABLE_OPTION:
    case content::MenuItem::GROUP:
      v8_item.Set("checked", item.checked);
      FALLTHROUGH;
    case content::MenuItem::OPTION:
    case content::MenuItem::SUBMENU:
      v8_item.Set("label", item.label);
      v8_item.Set("enabled", item.enabled);
      FALLTHROUGH;
    default:
      v8_item.Set("type", item.type);
  }
  if (item.type == content::MenuItem::SUBMENU)
    v8_item.Set("submenu",
                MenuToV8(isolate, web_contents, context, item.submenu));
  else if (item.action > 0)
    v8_item.Set("click", base::BindRepeating(ExecuteCommand, web_contents,
                                             item.action, context));
  return v8_item.GetHandle();
}
v8::Local<v8::Value> MenuToV8(v8::Isolate* isolate,