diff --git a/lib/renderer/web-view/guest-view-internal.js b/lib/renderer/web-view/guest-view-internal.js index 9f3bbf0dacfd..f07ded2c3155 100644 --- a/lib/renderer/web-view/guest-view-internal.js +++ b/lib/renderer/web-view/guest-view-internal.js @@ -68,7 +68,7 @@ module.exports = { }) ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-${viewInstanceId}`, function (event, eventName, ...args) { - dispatchEvent.apply(null, [webView, eventName, eventName].concat(args)) + dispatchEvent(webView, eventName, eventName, ...args) }) ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE-${viewInstanceId}`, function (event, channel, ...args) { diff --git a/lib/renderer/web-view/web-view.js b/lib/renderer/web-view/web-view.js index 29a1945decc1..fc8b9a4abdde 100644 --- a/lib/renderer/web-view/web-view.js +++ b/lib/renderer/web-view/web-view.js @@ -396,7 +396,7 @@ var registerWebViewElement = function () { return function (...args) { const internal = v8Util.getHiddenValue(this, 'internal') if (internal.webContents) { - return internal.webContents[m].apply(internal.webContents, args) + return internal.webContents[m](...args) } else { throw new Error(`Cannot call ${m} because the webContents is unavailable. The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.`) } @@ -409,7 +409,7 @@ var registerWebViewElement = function () { const createNonBlockHandler = function (m) { return function (...args) { const internal = v8Util.getHiddenValue(this, 'internal') - ipcRenderer.send.apply(ipcRenderer, ['ELECTRON_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', null, internal.guestInstanceId, m].concat(args)) + ipcRenderer.send('ELECTRON_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', null, internal.guestInstanceId, m, ...args) } } for (const method of nonblockMethods) {