prevent browser exception bug on sendResponse to a closed tab
fixes #171
This commit is contained in:
parent
38c7ed1bc1
commit
7e5396a11d
|
@ -320,6 +320,14 @@ 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
|
||||||
|
sendResponse = (sendResponseOriginal =>
|
||||||
|
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