Skip to content
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

CEF3: Support JS bindings again #159

Closed
perlun opened this issue Aug 28, 2013 · 15 comments
Closed

CEF3: Support JS bindings again #159

perlun opened this issue Aug 28, 2013 · 15 comments
Assignees
Milestone

Comments

@perlun
Copy link
Member

perlun commented Aug 28, 2013

For the moment, Javascript bindings is missing from the CEF3 branch. We should fix it to work once again.

Blocks closing of #136.

@ghost ghost assigned perlun Aug 28, 2013
perlun added a commit that referenced this issue Aug 28, 2013
…process, which we are able to call from the main process. The next step is to try and make it execute Javascript in the proper CefFrame. Might not be so incredibly simple, but we'll have to give it a try and see.
perlun added a commit that referenced this issue Sep 2, 2013
…a bit, to try and get it working with the cross-process scenario which is a reality w/ CEF3.
perlun added a commit that referenced this issue Sep 2, 2013
…avascript execution over to the CefFrame in the render process, but it doesn't seem to work yet… Have to check with Marshall & friends.
perlun added a commit that referenced this issue Sep 25, 2013
@perlun perlun mentioned this issue Oct 24, 2013
perlun added a commit that referenced this issue Oct 27, 2013
… was also highly non-functional...) earlier because it caused stability problems, since CEF starts up more than 1 child process sometimes (which caused problems). I think we might have to distinguish between different process types here, which is why we start fiddling around with the arguments. Perhaps there are other, better ways to detect the current process type though.
perlun added a commit that referenced this issue Oct 27, 2013
…y use the CefBrowser object on the "wrong" thread, even though we are in the render process. Time to roll up our sleeves and start doing some CefPostTask() work I think...
perlun added a commit that referenced this issue Oct 29, 2013
…TA... and also, I cannot for some odd reason attach to the process with the debugger, which I hope I will be able to with C#.
perlun added a commit that referenced this issue Oct 29, 2013
…ich is debuggable and hence a HUGE plus in what we are trying to achieve...). Will also consider using the C API for CEF, since I think it actually will suit us better.
perlun added a commit that referenced this issue Oct 30, 2013
…a get that one solved actually... Well, of course we are, but how well with it work? Anyway, time to go to bed now and so forth.
@perlun
Copy link
Member Author

perlun commented Nov 6, 2013

(EvaluateScript stuff is quite far actually. Will start working on the JS bindings also asap.)

perlun added a commit that referenced this issue Nov 6, 2013
perlun added a commit that referenced this issue Nov 6, 2013
…y in use, so we must send in a request to terminate the endpoint if it’s already there…
perlun added a commit that referenced this issue Nov 8, 2013
@JanEggers
Copy link
Contributor

i would like too take care of this one i will start by looking at the code of CefSharp1 branch and port the changes. i suspect the JavaScript proxy has to get involved in object binding too!?

@perlun
Copy link
Member Author

perlun commented Mar 26, 2014

Great! This one is a bit challenging. Start off by forking off of the latest master code from us (i.e. excluding the pull requests which haven't been merged yet).

In this case, I really want us to be careful in making small, atomic commits, which can easily be cherry-picked and analyzed as individual items.

As you say, the Javascript proxy (which is actually a WCF host using named pipes as the communication channel) has to be involved. The challenge here is to get the information about the types (that are registered in the parent process) to be transmitted to the actual CEF/browser thread (which is running in the render process). That's the sole reason for why I set up this WCF thing in the first place.

So, transfer some form of data structure to it, with a list of the types eligible for registration. Each type should then have a list of properties and methods which are being registered.

You can play around with it for a while and see how far you get. Feel free to submit a "WIP PR" then, in which we can discuss things further. Thanks for your interest in this one!

@perlun perlun modified the milestones: 31.1.0, 33.0.0 Mar 26, 2014
@JanEggers
Copy link
Contributor

oki i perfectly understand all your points.

my first change will be to create proxy objects in the browserprocess which wrapp the registered objects and provide Ids for each object so we can identify them and add serializable objects for the wcf.

for my understanding:

is the communication oneway or should the values be written back to the objects in the browserprocess when they are changed by javascript. if they dont need to be written back i think i dont need that id think and just add serializable proxy objects

how complex can the objects be ? is it possible to register a complex object with Properties that have backlinks to the parentobjects? thats importent thing to know for the object identification

for method binding:

here i think i just intercept the requested call send it to the browserprocess and execute it there and return the result to the renderprocess.

@perlun
Copy link
Member Author

perlun commented Mar 28, 2014

is the communication oneway or should the values be written back to the objects in the browserprocess when they are changed by javascript. if they dont need to be written back i think i dont need that id think and just add serializable proxy objects

Ideally, they would be written back to the objects in the browser process, even though I assume this complicates things a bit... Could it be solved by means of WCF events/callbacks perhaps?

how complex can the objects be ? is it possible to register a complex object with Properties that have backlinks to the parentobjects? thats importent thing to know for the object identification

I don't think we have to support that level of complexity at the moment, no.

here i think i just intercept the requested call send it to the browserprocess and execute it there and return the result to the renderprocess.

Sounds like a plan. 😃

@perlun
Copy link
Member Author

perlun commented Mar 28, 2014

Btw, it would also be cool (at some point) to be able to play around with dynamic related to this. I.e. be able to get a reference to a JS object and cast it to dynamic and call a method on it (for example). Also the other way around.

I guess this is quite hard though, so we don't have to do that at this stage.

For the actual type interrogation stuff, take a look at the TypeUtils class. It could also be converted to C# I guess, as part of this change.

Btw - please do not submit this as one fat, big PR in the end. 😃 It will be impossible to merge. Instead, as always, try to work in small steps that we can merge on at a time and so forth...

@JanEggers
Copy link
Contributor

Btw - please do not submit this as one fat, big PR in the end. It will be impossible to merge. Instead, as always, try to work in small steps that we can merge on at a time and so forth...

did you say something i didnt hear anything.

all you mention above can be done its all about getting a clever interface.

it is only a matter of how to address stuff

i really would like to make the DOM more accessible not just the JS part of it

@perlun
Copy link
Member Author

perlun commented Mar 28, 2014

did you say something i didnt hear anything.

😉

I think your work is actually quite awesome; it just isn't always so "tidy and clean". I guess that's the result of hacking away late in the night... 😃

all you mention above can be done its all about getting a clever interface.

Yes.

i really would like to make the DOM more accessible not just the JS part of it

Feel free to experiment in that direction if you like.

@JanEggers
Copy link
Contributor

I think your work is actually quite awesome; it just isn't always so "tidy and clean". I guess that's the result of hacking away late in the night...

thanks and please dont stop beeing critical otherwise i will not improve. just dont get mad at me because i cant get over my biggish change handling that is just what im used to so i have to migrate my brain for the new process and that takes a while.

@perlun
Copy link
Member Author

perlun commented Apr 2, 2014

@JanEggers, have you managed to do anything about this? I might be able to squeeze in a few CefSharp hours later tonight so just want to check status. This one I am more than willing to start jumping into, it's challenging and fun. 😄

@JanEggers
Copy link
Contributor

not really i just added wrapper classes but i didnt commit them yet. and im at work now so ill try to submit a pr when at home.

we have some timing issues to resolve i found out.

the wcf proxy has to be created after the browser is created but before the oncontextcreated method is called. atm it is created on first call to javascriptevaluate thats definitly too late.

update: at home ca now + 10 hours

@perlun
Copy link
Member Author

perlun commented Apr 2, 2014

Alright. I might start looking into it now also while on the plane (boarding in a few minutes. 😄). I strongly suggest you make a WIP PR asap, and I can then use your code and build on top of it.

@Sertelegger
Copy link

I think I'll also finally start jumping on this again since I've been
needing this so much I was close to implementing it myself but my work
schedule didn't allow spending any time on it until now.

I'll spend some time tonight syncing my fork with latest master and getting
everything building on VS2013, and then I'm happy to test stuff or
contribute on this if you let me know where you need some help. I've been
looking at every pull request for a while now to familiarize myself with
the code base some more, so by tomorrow I should be good to go.

// Sascha

On Wed, Apr 2, 2014 at 7:08 AM, Per Lundberg notifications@gh.neting.ccwrote:

Alright. I might start looking into it now also while on the plane
(boarding in a few minutes. [image: 😄]). I strongly suggest you
make a WIP PR asap, and I can then use your code and build on top of it.

Reply to this email directly or view it on GitHubhttps://github.com//issues/159#issuecomment-39334107
.

@JanEggers JanEggers mentioned this issue Apr 3, 2014
@perlun
Copy link
Member Author

perlun commented Apr 4, 2014

I've started looking into it the other day, but didn't get very far. Let's see if I can push up a feature branch with (some) of this stuff later today. I just feel sooo "not-used-to" C++ function pointers and all... I write too little C++ code these days, but I guess I should be more than happy with that. 😉

@amaitland
Copy link
Member

Js Binding merged into master, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants