From: Kevin Sawicki Date: Tue, 9 Feb 2016 18:20:55 +0000 (-0800) Subject: Throw error when IPC channel is missing X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=e06aa36f981d49f5990a95a2c3d10f72ecc908e7;p=electron.git Throw error when IPC channel is missing --- diff --git a/atom/browser/api/lib/web-contents.js b/atom/browser/api/lib/web-contents.js index 08252923..8dde10df 100644 --- a/atom/browser/api/lib/web-contents.js +++ b/atom/browser/api/lib/web-contents.js @@ -78,6 +78,9 @@ let wrapWebContents = function(webContents) { webContents.send = function() { var args = 2 <= arguments.length ? slice.call(arguments, 1) : []; var channel = arguments[0]; + if (channel == null) { + throw new Error('channel must be specified'); + } return this._send(channel, slice.call(args)); }; diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index d91e9d41..ee34ba2c 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -664,6 +664,10 @@ describe('browser-window module', function() { assert.throws(function () { w.webContents.send(); }, 'channel must be specified'); + + assert.throws(function () { + w.webContents.send(null); + }, 'channel must be specified'); }); }); });