Convert frameName/features to strings in render process

This commit is contained in:
Kevin Sawicki 2017-04-25 13:16:28 -07:00
parent 7e285711ca
commit 3894c1c625

View file

@ -32,6 +32,10 @@ const resolveURL = function (url) {
return a.href return a.href
} }
const toString = (value) => {
return value != null ? `${value}` : value
}
const windowProxies = {} const windowProxies = {}
const getOrCreateProxy = (ipcRenderer, guestId) => { const getOrCreateProxy = (ipcRenderer, guestId) => {
@ -112,7 +116,7 @@ module.exports = (ipcRenderer, guestInstanceId, openerId, hiddenPage) => {
if (url != null && url !== '') { if (url != null && url !== '') {
url = resolveURL(url) url = resolveURL(url)
} }
const guestId = ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, features) const guestId = ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, toString(frameName), toString(features))
if (guestId != null) { if (guestId != null) {
return getOrCreateProxy(ipcRenderer, guestId) return getOrCreateProxy(ipcRenderer, guestId)
} else { } else {
@ -121,11 +125,11 @@ module.exports = (ipcRenderer, guestInstanceId, openerId, hiddenPage) => {
} }
window.alert = function (message, title) { window.alert = function (message, title) {
ipcRenderer.sendSync('ELECTRON_BROWSER_WINDOW_ALERT', `${message}`, `${title}`) ipcRenderer.sendSync('ELECTRON_BROWSER_WINDOW_ALERT', toString(message), toString(title))
} }
window.confirm = function (message, title) { window.confirm = function (message, title) {
return ipcRenderer.sendSync('ELECTRON_BROWSER_WINDOW_CONFIRM', `${message}`, `${title}`) return ipcRenderer.sendSync('ELECTRON_BROWSER_WINDOW_CONFIRM', toString(message), toString(title))
} }
// But we do not support prompt(). // But we do not support prompt().