use tryCatch to simplify 7e5396a1
This commit is contained in:
parent
3c5d20f862
commit
c88438c6eb
|
@ -306,13 +306,7 @@ function updateIcon(tab, styles) {
|
||||||
|
|
||||||
function onRuntimeMessage(request, sender, sendResponse) {
|
function onRuntimeMessage(request, sender, sendResponse) {
|
||||||
// prevent browser exception bug on sending a response to a closed tab
|
// prevent browser exception bug on sending a response to a closed tab
|
||||||
sendResponse = (sendResponseOriginal =>
|
sendResponse = (send => data => tryCatch(send, data))(sendResponse);
|
||||||
data => {
|
|
||||||
try {
|
|
||||||
sendResponseOriginal(data);
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
)(sendResponse);
|
|
||||||
switch (request.method) {
|
switch (request.method) {
|
||||||
case 'getStyles':
|
case 'getStyles':
|
||||||
getStyles(request).then(sendResponse);
|
getStyles(request).then(sendResponse);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user