How to get CefV8Context for specific Browser/Frame?

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

How to get CefV8Context for specific Browser/Frame?

Postby fddima » Wed Sep 14, 2011 4:46 am

Hi, all!

Is exists way to get CefV8Context for specific CefFrame?
I mean something like webkit_glue::GetV8Context.
It needed to JS execution. When issue#151 introduce CefV8Task, instead of this we can do more simple thing:
1. Post task to UI thread.
2. Get target Frame's context.
3. Execute function on global object via CefV8Value.ExecuteFunction/WithContext.
4. Get return value and exception.

I.e. my proposal is expose static function CefV8Context::GetContext(CefFrame).
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: How to get CefV8Context for specific Browser/Frame?

Postby magreenblatt » Fri Sep 16, 2011 9:02 am

A CefFrame::GetContext() method is probably better API than a static method that takes a CefFrame argument. Please add a new issue to the CEF issue tracker.

Note that you can currently retrieve the context for a frame indirectly by using ExecuteJavaScript or similar to call a native function from that frame.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to get CefV8Context for specific Browser/Frame?

Postby fddima » Fri Sep 16, 2011 9:20 am

Submitted http://code.google.com/p/chromiumembedd ... ail?id=344

Thanks, i know that i can got it indirectly, but ExecuteJavaScript function post task to UI thread, and this becomes not very usable from UI thread. Of course it can be done and in this case, but much simpler it is got v8 context directly.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: How to get CefV8Context for specific Browser/Frame?

Postby fddima » Sun Oct 23, 2011 11:11 am

Check issue to review provided patch http://code.google.com/p/chromiumembedd ... ail?id=344
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 161 guests