Fix backward compatibility with old BrowserWindow options

This commit is contained in:
Cheng Zhao 2015-09-09 15:55:26 +08:00
parent 375ac3e6ec
commit 446235c8cd

View file

@ -70,14 +70,13 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
options.Get(switches::kWebPreferences, &web_preferences);
// Be compatible with old options which are now in web_preferences.
std::string str;
double d;
if (options.Get(switches::kNodeIntegration, &str))
web_preferences.Set(switches::kNodeIntegration, str);
if (options.Get(switches::kPreloadScript, &str))
web_preferences.Set(switches::kPreloadScript, str);
if (options.Get(switches::kZoomFactor, &d))
web_preferences.Set(switches::kZoomFactor, d);
v8::Local<v8::Value> value;
if (options.Get(switches::kNodeIntegration, &value))
web_preferences.Set(switches::kNodeIntegration, value);
if (options.Get(switches::kPreloadScript, &value))
web_preferences.Set(switches::kPreloadScript, value);
if (options.Get(switches::kZoomFactor, &value))
web_preferences.Set(switches::kZoomFactor, value);
// Creates the WebContents used by BrowserWindow.
auto web_contents = WebContents::Create(isolate, web_preferences);