1 Commits

Author SHA1 Message Date
Alex Maitland 1460dee5a1 Core - ClientAdapter improve HasParent checks (#4443)
* Core - Improve ClientAdapter::GetBrowserWrapper logic

Simplify the logic

- For non popup return immediately (most common scenario)
- Check for IBrowser instance for matching popup
- Check for HasParent and return the browser Instance
- Return nullptr if no matching IBrowser wrapper found

* Core - ClientAdapter::OnFrameCreated called before OnAfterCreated

- The very first call to ClientAdapter::OnFrameCreated happens
  before OnAfterCreated leaving us with a IBrowser instance that's null
  Create an IBrowser instance that's scoped to the method call

* Core - ClientAdapter improve HasParent checks

- HasParent check has now been replaced with IsHostedBrowser
  which has additional check to make sure the internal
  IWebBrowser.Set* methods are only called for a IBrowser
  instance that's directly associated with a ChromiumWebBrowser instance
  This resolves issues with DevTools being opened for a popup hosted
  in a ChromiumWebBrowser instance.

Related discussion https://github.com/cefsharp/CefSharp/discussions/4438
2023-04-01 18:58:27 +10:00