cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.88k stars 2.92k forks source link

PermissionRequestType is out of sync compared to cef_permission_request_types_t #4935

Closed szanto90balazs closed 1 month ago

szanto90balazs commented 2 months ago

Is there an existing issue for this?

CefSharp Version

128.4.90

Operating System

Windows 11

Architecture

x64

.Net Version

.Net 6.0

Implementation

WPF

Reproduction Steps

  1. Run the CefSharp.Wpf.Example app with debugger attached
  2. Go to https://permission.site/
  3. Click on the Location button
  4. Go to the Debug output and find the following debug line sent by this code (System.Diagnostics.Debug.WriteLine($"{promptId}|{requestedPermissions} {requestingOrigin}");)

Expected behavior

Expected: 1|Geolocation https://permission.site/

Actual behavior

Actual: 1|MicStream https://permission.site/

Regression?

The C# PermissionRequestType enum and the C++ cef_permission_request_types_t enum got out of sync, seems like since this CEF commit: https://github.com/chromiumembedded/cef/commit/dc2231cdfb6c355d83c6121ffe2912ea30e6eef0

image

Known Workarounds

You could introduce MyPermissionRequestType based on the values of cef_permission_request_types_t and cast PermissionRequestType to uint to MyPermissionRequestType, this will require a custom permission handler implementation.

Does this problem also occur in the CEF Sample Application

No

Other information

No response

szanto90balazs commented 2 months ago

I'm happy to send a PR with an updated PermissionRequestType and potentially come up with some tests. In the past the uint value of Geolocation changed two times in the enum according to the history of cef_types.h

amaitland commented 2 months ago

PR would be most welcome 👍