-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when renderer-process-limit=1, in the same ChromiumWebBrowser instance ,after cross-site access,CefSharp.BindObjectAsync not work. #3166
Comments
Please fork https://github.com/cefsharp/CefSharp.MinimalExample and provide an example that reproduces your problem. |
Just to be clear this is not officially tested/supported. |
OK!CefSharp.MinimalExample settings.CefCommandLineArgs.Add("renderer-process-limit", "1"); BrowserForm.cs add code in BrowserForm constructor: browser.JavascriptObjectRepository.ResolveObject += (sender,e)=> {
var repo = e.ObjectRepository;
if (e.ObjectName == "boundAsync2") {
BindingOptions bindingOptions = BindingOptions.DefaultBinder;
bindingOptions.CamelCaseJavascriptNames = false;
repo.Register(e.ObjectName, new BoundAsync2(), isAsync: true, options: bindingOptions);
}
}; Add Bound Class: public class BoundAsync2 {
public string hello(string s) {
return "hello " + s;
}
} test.html: <html>
<body>
<img src="1.png?a=120309093"></img>
</body>
</html> test2.html: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="scripts/jquery.min.js"></script>
</head>
<body>
<div>v1</div>
<script type="text/javascript">
function Main() {
var foo = async function () {
var ret=CefSharp.RemoveObjectFromCache("boundAsync2")
alert("1“)
var ret2=CefSharp.DeleteBoundObject("boundAsync2")
alert("2")
try{
await CefSharp.BindObjectAsync({ NotifyIfAlreadyBound: true, IgnoreCache: true },"boundAsync2")
}catch(err){
alert(err);
}
alert("3")
var ret3=await boundAsync2.hello(" world")
alert(ret3)
};
foo();
}
$(function () {
Main();
});
</script>
</body>
</html> Put test2.html in 192.168.1.100,and put test.html in c:\ 1.access 192.168.1.100\test2.html ,and it will alert "1",”2“, “3” and “hello world”
|
Please fork the minimum example and push your changes to GitHub. |
|
Does the problem reproduce if you use the The
If you remove this line does it behave as expected? |
Problem reproduce if corss-domain access use http scheme. settings.CefCommandLineArgs.Add("renderer-process-limit", "1");
|
I will have a quick look though it's unlikely this can be fixed. I suspect the |
In some instances Basically there are bugs in |
cefsharp v81
cefsharp.winforms.example
settings.CefCommandLineArgs.Add("renderer-process-limit", "1");
In same ChromiumWebBrowser instance ,access file:///c:/test.html first,then access http://192.168.1.100/test2.html
CefSharp.BindObjectAsync in test2.html dont work,but no throw exception,and devtools console no message too.
i visited #2246 it look like no help.
test2.html some js code:
The text was updated successfully, but these errors were encountered: