Closed m-kovac closed 4 months ago
The remote-allow-origins
flag is implemented in Chromium. I suggest that you test the behavior in Google Chrome.
Sorry, I don't understand. What should I test in Google Chrome?
What should I test in Google Chrome?
You should test how the --remote-allow-origins
flag behaves in Google Chrome. From the code:
// Enables web socket connections from the specified origins only. '*' allows
// any origin.
Go to localhost:1236 Observe window with the link to "Google"
You should use chrome://inspect/ for connecting to remote debugging.
Your "Missing link" and "Expected behavior" screenshots are also both showing Chrome style windows.
Closing this issue as WontFix given that CEF has no special handling for the --remote-allow-origins
flag, and there are better/preferred ways to access remote debugging if that is the intention.
To be honest, we are facing the exact same problem starting from v126 and I don't get the "WontFix" reason; we were able to successfully use the "--remote-allow-origins" switch:
https://github.com/cefsharp/CefSharp/issues/4894
this seems a regression to me, either in CEF or in CefSharp :-/
Opening the URL for the remote debugging port on previous CEF releases will load the JSON with list of active browser instances:
This no longer happens for the v126:
Requesting the JSON manually for v126 does work:
curl http://localhost:1236/json/list?t=1722606942069
[ {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:1236/devtools/page/A4A02D4EEDF8E9EDB16F4C71237DB7FD",
"id": "A4A02D4EEDF8E9EDB16F4C71237DB7FD",
"title": "Slido",
"type": "page",
"url": "https://app.example.org/",
"webSocketDebuggerUrl": "ws://localhost:1236/devtools/page/A4A02D4EEDF8E9EDB16F4C71237DB7FD"
} ]
And opening the devtoolsFrontendUrl
in the browser will show the Dev Tools for the running CEF instance.
this seems a regression to me, either in CEF or in CefSharp :-/
This is not a regression in CefSharp
.
Testing with cef_binary_127.3.2+gf1af617+chromium-127.0.6533.100_windows64_client
and the problem reproduces.
# Works
.\cefclient.exe --use-alloy-style --remote-debugging-port=9955 --remote-allow-origins=http://localhost:9955 --disable-chrome-runtime
# Doesn't work
.\cefclient.exe --use-alloy-style --remote-debugging-port=9955 --remote-allow-origins=http://localhost:9955
Tested with --disable-request-handling-for-testing
also which makes no difference.
given that CEF has no special handling for the
--remote-allow-origins
flag
Without actually debugging my guess would be that it's something fairly simple that's missing or not enabled in the Chrome Bootstrap
.
Our CefSharp setttings:
var settings = new CefSettings();
settings.RootCachePath = Path.Combine(appDataFolder, @"browser-cache");
settings.BrowserSubprocessPath = Path.Combine(installPath, Environment.Is64BitProcess ? "x64" : "x86", "CefSharp.BrowserSubprocess.exe");
settings.RemoteDebuggingPort = 1236;
settings.CefCommandLineArgs.Add("remote-allow-origins", $"http://localhost:{settings.RemoteDebuggingPort}");
CefSharpSettings.RuntimeStyle = CefRuntimeStyle.Chrome;
curl -v http://localhost:1236
* Host localhost:1236 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:1236...
* Trying 127.0.0.1:1236...
* Connected to localhost (127.0.0.1) port 1236
> GET / HTTP/1.1
> Host: localhost:1236
> User-Agent: curl/8.8.0
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< X-Frame-Options:DENY
< Content-Length:1475
< Content-Type:text/html; charset=UTF-8
<
<html>
<head>
<title>CEF remote debugging</title>
<style>
</style>
<script>
function onLoad() {
var tabs_list_request = new XMLHttpRequest();
tabs_list_request.open("GET", "/json/list?t=" + new Date().getTime(), true);
tabs_list_request.onreadystatechange = onReady;
tabs_list_request.send();
}
function onReady() {
if(this.readyState == 4 && this.status == 200) {
if(this.response != null)
var responseJSON = JSON.parse(this.response);
for (var i = 0; i < responseJSON.length; ++i)
appendItem(responseJSON[i]);
}
}
function appendItem(item_object) {
var frontend_ref;
if (item_object.devtoolsFrontendUrl) {
frontend_ref = document.createElement("a");
frontend_ref.href = item_object.devtoolsFrontendUrl;
frontend_ref.title = item_object.title;
} else {
frontend_ref = document.createElement("div");
frontend_ref.title = "The tab already has active debugging session";
}
var text = document.createElement("div");
if (item_object.title)
text.innerText = item_object.title;
else
text.innerText = "(untitled tab)";
text.style.cssText = "background-image:url(" + item_object.faviconUrl + ")";
frontend_ref.appendChild(text);
var item = document.createElement("p");
item.appendChild(frontend_ref);
document.getElementById("items").appendChild(item);
}
</script>
</head>
<body onload='onLoad()'>
<div id='caption'>Inspectable WebContents</div>
<div id='items'></div>
</body>
</html>
* Connection #0 to host localhost left intact
curl -v http://localhost:1236
* Host localhost:1236 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:1236...
* Trying 127.0.0.1:1236...
* Connected to localhost (127.0.0.1) port 1236
> GET / HTTP/1.1
> Host: localhost:1236
> User-Agent: curl/8.8.0
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Frame-Options:DENY
< Content-Length:0
< Content-Type:text/html; charset=UTF-8
<
* Connection #0 to host localhost left intact
Describe the bug
With
CefSharp
v126.2.70, CEF v126.0.6478.115 theremote-allow-origins
parameter with setlocalhost:port
stopped to have effect. This is connected to switch from Alloy bootstrap to Chrome bootstrap.To Reproduce
CefSharp.MinimalExample.net472
CefSharp
forCefSharp.MinimalExample.WinForms.net472
to v126.2.70CefSharp.MinimalExample.WinForms.net472
projectProgram.cs
set following settings toCefSettings
localhost:1236
settings.ChromeRuntime = false;
toCefSettings
to change back to Alloy bootstraplocalhost:1236
Expected behavior The
remote-allow-origins
should work with Chrome bootstrap.Screenshots
Missing link
Expected behavior
Versions (please complete the following information):