RuidSiel / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

Support for "isolated world" JS contexts #302

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
WebKit supports the concept of "isolated worlds" where a view can be assigned a 
JavaScript context that is completely independent of all other JavaScript 
contexts. Explore what would be required to support this feature from CEF.

Original issue reported on code.google.com by magreenb...@gmail.com on 8 Aug 2011 at 6:10

GoogleCodeExporter commented 9 years ago
The attached patch adds the following API to CEF3's CefFrame:

  ///
  // Execute several strings of JavaScript code in this frame in isolated context.
  // The |script_urls| parameter is the URLs where the scripts in question can be found, if any.
  // The renderer may request this URL to show the developer the source of the
  // error.  The |start_lines| parameter is the base line number to use for error
  // reporting.
  ///
  /*--cef()--*/
  virtual void ExecuteJavaScriptInIsolatedWorld(int world_id,
                                    const std::vector<CefString>& codes,
                                    const std::vector<CefString>& script_url,
                                    const std::vector<int>& start_lines,
                                    int num_sources,
                                    int extension_group) =0;

It allows for executing isolated code independent of all other JavaScript 
contexts.

Original comment by pgu...@gmail.com on 31 Jul 2013 at 2:17

Attachments:

GoogleCodeExporter commented 9 years ago
The attached updated patch additionally provides the following API to get the 
results from the scripts:

  ///
  // Execute several strings of JavaScript code in this frame in isolated context
  // and get the results. This method can only be called from the render
  // process.
  ///
  /*--cef(count_param=ret_vals:num_sources)--*/
  virtual void EvalJavaScriptInIsolatedWorld(int world_id,
                                    const std::vector<CefString>& codes,
                                    const std::vector<CefString>& script_url,
                                    const std::vector<int>& start_lines,
                                    int num_sources,
                                    int extension_group,
                                    std::vector< CefRefPtr<CefV8Value> >& ret_vals) =0;

For this API, translator was extended to support count_param instead of 
count_func for this very case: ret_vals is typically empty on input but filled 
with num_sources values on output.

Original comment by pgu...@gmail.com on 9 Aug 2013 at 8:59

Attachments:

GoogleCodeExporter commented 9 years ago
CEF is transitioning from Google Code to Bitbucket project hosting. If you 
would like to continue receiving notifications on this issue please add 
yourself as a Watcher at the new location: 
https://bitbucket.org/chromiumembedded/cef/issue/302

Original comment by magreenb...@gmail.com on 14 Mar 2015 at 3:21