]> khamidou — GitHub mirrors - electron.git/commitdiff
Throw error when IPC channel is missing
authorKevin Sawicki <kevinsawicki@gmail.com>
Tue, 9 Feb 2016 18:20:55 +0000 (10:20 -0800)
committerKevin Sawicki <kevinsawicki@gmail.com>
Tue, 9 Feb 2016 18:22:43 +0000 (10:22 -0800)
atom/browser/api/lib/web-contents.js
spec/api-browser-window-spec.js

index 08252923fc27f9cec87658e5af446e4a3be45ca8..8dde10df4d19eebeb4bb7a903fdf7429ec3bee39 100644 (file)
@@ -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));
   };
 
index d91e9d410e0ad681788e1df024b1bc9b6620732d..ee34ba2c576bc16fa0eb167d39675dc74ae184c0 100644 (file)
@@ -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');
     });
   });
 });