From c94f1fc857e0c07303e60d8df0e89e48808f207c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 9 Feb 2016 10:20:55 -0800 Subject: [PATCH] Throw error when IPC channel is missing --- atom/browser/api/lib/web-contents.js | 3 +++ spec/api-browser-window-spec.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/atom/browser/api/lib/web-contents.js b/atom/browser/api/lib/web-contents.js index 08252923fc27..8dde10df4d19 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 d91e9d410e0a..ee34ba2c576b 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'); }); }); });