Fix exception in alert for inavlid parameter
authorCheng Zhao <zcbenz@gmail.com>
Tue, 14 Jun 2016 06:22:01 +0000 (15:22 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 14 Jun 2016 06:22:01 +0000 (15:22 +0900)
lib/renderer/override.js

index ced2318..c568388 100644 (file)
@@ -154,20 +154,11 @@ window.open = function (url, frameName, features) {
 }
 
 // Use the dialog API to implement alert().
-window.alert = function (message, title) {
-  var buttons
-  if (arguments.length === 0) {
-    message = ''
-  }
-  if (title == null) {
-    title = ''
-  }
-  buttons = ['OK']
-  message = String(message)
+window.alert = function (message = '', title = '') {
   remote.dialog.showMessageBox(remote.getCurrentWindow(), {
-    message: message,
-    title: title,
-    buttons: buttons
+    message: String(message),
+    title: String(title),
+    buttons: ['OK']
   })
 }