use tryCatch to simplify 7e5396a1

This commit is contained in:
tophf 2017-08-30 18:05:22 +03:00
parent 3c5d20f862
commit c88438c6eb

View File

@ -306,13 +306,7 @@ 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);
sendResponse = (send => data => tryCatch(send, data))(sendResponse);
switch (request.method) {
case 'getStyles':
getStyles(request).then(sendResponse);