Silence port disconnected errors. Fix #1587.

This commit is contained in:
FelisCatus 2018-08-20 17:59:59 -07:00
parent 961cdadc8d
commit 2bcd7e633c

View File

@ -10,7 +10,11 @@ module.exports = class ChromePort
@sender = @port.sender
@disconnect = @port.disconnect.bind(@port)
@postMessage = @port.postMessage.bind(@port)
@postMessage = (args...) =>
try
@port.postMessage(args...)
catch
return
@onMessage = new TrackedEvent(@port.onMessage)
@onDisconnect = new TrackedEvent(@port.onDisconnect)