Add support for specifying custom V8 flags via a new CefSettings.javascript_flags configuration option (issue #413).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@363 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-11-07 22:46:34 +00:00
parent 8e45560a02
commit 8257177763
3 changed files with 14 additions and 1 deletions

View File

@ -152,6 +152,12 @@ typedef struct _cef_settings_t
///
unsigned int session_storage_quota;
///
// Custom flags that will be used when initializing the V8 JavaScript engine.
// The consequences of using custom flags may not be well tested.
///
cef_string_t javascript_flags;
#if defined(OS_WIN)
///
// Set to true (1) to use the system proxy resolver on Windows when

View File

@ -258,6 +258,7 @@ struct CefSettingsTraits {
if(s->extra_plugin_paths)
cef_string_list_free(s->extra_plugin_paths);
cef_string_clear(&s->log_file);
cef_string_clear(&s->javascript_flags);
}
static inline void set(const struct_type* src, struct_type* target, bool copy)
@ -283,6 +284,8 @@ struct CefSettingsTraits {
target->graphics_implementation = src->graphics_implementation;
target->local_storage_quota = src->local_storage_quota;
target->session_storage_quota = src->session_storage_quota;
cef_string_set(src->javascript_flags.str, src->javascript_flags.length,
&target->javascript_flags, copy);
#if defined(OS_WIN)
target->auto_detect_proxy_settings_enabled =

View File

@ -111,7 +111,11 @@ void CefProcessUIThread::Init() {
base::StatsTable::set_current(statstable_);
// CEF always exposes the GC.
webkit_glue::SetJavaScriptFlags("--expose-gc");
std::string javascript_flags = "--expose-gc";
if (settings.javascript_flags.length > 0)
javascript_flags += " " + CefString(&settings.javascript_flags).ToString();
webkit_glue::SetJavaScriptFlags(javascript_flags);
// Expose GCController to JavaScript.
WebKit::WebScriptController::registerExtension(
extensions_v8::GCExtension::Get());