prevent browser exception bug on sendResponse to a closed tab

fixes #171
This commit is contained in:
tophf 2017-08-26 07:51:28 +03:00
parent 38c7ed1bc1
commit 7e5396a11d

View File

@ -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);