From 446235c8cdfc979d5cc8917000288ca2f252f745 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 9 Sep 2015 15:55:26 +0800 Subject: [PATCH] Fix backward compatibility with old BrowserWindow options --- atom/browser/api/atom_api_window.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 4acd101f3c98..7403a7ecbb77 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -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 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);