From 32728b023b85dbde25359725ff57d32fc005e82e Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 1 Nov 2020 22:46:47 +0300 Subject: [PATCH] respond with null to avoid "port closed" errors --- background/background.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/background/background.js b/background/background.js index 968e1b42..109123f2 100644 --- a/background/background.js +++ b/background/background.js @@ -296,8 +296,8 @@ function onRuntimeMessage(msg, sender) { if (!fn) { throw new Error(`unknown API: ${msg.name}`); } - const context = {msg, sender}; - return fn.apply(context, msg.args); + const res = fn.apply({msg, sender}, msg.args); + return res === undefined ? null : res; } function openEditor(params) {