From 3ac98587269ab4620008b3a44d8ab22835473edb Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Mon, 28 Nov 2016 01:08:48 +0530 Subject: [PATCH] override window.confirm in devtools --- lib/renderer/inspector.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/renderer/inspector.js b/lib/renderer/inspector.js index 3192aa160edb..fdb14b717013 100644 --- a/lib/renderer/inspector.js +++ b/lib/renderer/inspector.js @@ -6,6 +6,22 @@ window.onload = function () { window.WebInspector.createFileSelectorElement = createFileSelectorElement } +window.confirm = function (message, title) { + const {dialog} = require('electron').remote + let buttons, cancelId + if (title == null) { + title = '' + } + buttons = ['OK', 'Cancel'] + cancelId = 1 + return !dialog.showMessageBox({ + message: message, + title: title, + buttons: buttons, + cancelId: cancelId + }) +} + const convertToMenuTemplate = function (items) { return items.map(function (item) { const transformed = item.type === 'subMenu' ? {