]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix backward compatibility with old BrowserWindow options
authorCheng Zhao <zcbenz@gmail.com>
Wed, 9 Sep 2015 07:55:26 +0000 (15:55 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 9 Sep 2015 07:55:26 +0000 (15:55 +0800)
atom/browser/api/atom_api_window.cc

index 4acd101f3c98823eac4d79b8fdb7c7e6c65d423c..7403a7ecbb7716d1a602773c92d44150f6f0adc5 100644 (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);