### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.

### Electron Version

18.2.0

### What operating system are you using?

Windows

### Operating System Version

Windows 10 version 20H2, build 19042

### What arch are you using?

x64

### Last Known Working Electron version

18.1.0

### Expected Behavior

When `win.setTitleBarOverlay` is called, apparently the only valid option for `titleBarStyle` is `'hidden'`. So when `win` was created with `titleBarStyle` different from `'hidden'`, Electron should throw an error.

### Actual Behavior

Electron crashes unexpectedly.

### Testcase Gist URL

https://gist.github.com/wheezard/207499979a7fda8cc7d874fdb87886fc

### Additional Information

This might work on older versions, but I haven't tested it in them.
shell/browser/ui/views/win_frame_view.cc
WinFrameView::~WinFrameView() = default;
void WinFrameView::Init(NativeWindowViews* window, views::Widget* frame) {
  window_ = window;
  frame_ = frame;
  if (window->IsWindowControlsOverlayEnabled()) {
    caption_button_container_ =
        AddChildView(std::make_unique<WinCaptionButtonContainer>(this));
  } else {
    caption_button_container_ = nullptr;
  }
}
SkColor WinFrameView::GetReadableFeatureColor(SkColor background_color) {
  
  
  
  const auto windows_luma = [](SkColor c) {
    return 0.25f * SkColorGetR(c) + 0.625f * SkColorGetG(c) +
           0.125f * SkColorGetB(c);
  };
  return windows_luma(background_color) <= 128.0f ? SK_ColorWHITE
                                                  : SK_ColorBLACK;
}
void WinFrameView::InvalidateCaptionButtons() {
  
  DCHECK(caption_button_container_);
  caption_button_container_->InvalidateLayout();
  caption_button_container_->SchedulePaint();
}
gfx::Rect WinFrameView::GetWindowBoundsForClientBounds(