From 2bcd7e633c4ef2bee8a025ec09e4766c61188a42 Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Mon, 20 Aug 2018 17:59:59 -0700 Subject: [PATCH] Silence port disconnected errors. Fix #1587. --- .../src/module/chrome_port.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/omega-target-chromium-extension/src/module/chrome_port.coffee b/omega-target-chromium-extension/src/module/chrome_port.coffee index e007b11..6988754 100644 --- a/omega-target-chromium-extension/src/module/chrome_port.coffee +++ b/omega-target-chromium-extension/src/module/chrome_port.coffee @@ -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)