diff --git a/background/background.js b/background/background.js index 5026fa53..44e09795 100644 --- a/background/background.js +++ b/background/background.js @@ -320,6 +320,14 @@ function updateIcon(tab, styles) { function onRuntimeMessage(request, sender, sendResponse) { + // prevent browser exception bug on sending a response to a closed tab + sendResponse = (sendResponseOriginal => + data => { + try { + sendResponseOriginal(data); + } catch (e) {} + } + )(sendResponse); switch (request.method) { case 'getStyles': getStyles(request).then(sendResponse);