mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Fix handling of no-longer-existing port condition
The condition has been spotted occurring when bringing up the DOM inspector for a page on which cosmetic filters are being applied. Not clear why this happens, but uBO must be ready to graciously handle such condition.
This commit is contained in:
parent
262a1a044f
commit
4d68d7f586
@ -959,7 +959,7 @@ vAPI.messaging = {
|
|||||||
try {
|
try {
|
||||||
port.postMessage(messageWrapper);
|
port.postMessage(messageWrapper);
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
this.ports.delete(port.name);
|
this.onPortDisconnect(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -985,7 +985,11 @@ vAPI.messaging = {
|
|||||||
msg.tabId = tabId;
|
msg.tabId = tabId;
|
||||||
for ( const { port: toPort } of this.ports.values() ) {
|
for ( const { port: toPort } of this.ports.values() ) {
|
||||||
if ( toPort === port ) { continue; }
|
if ( toPort === port ) { continue; }
|
||||||
toPort.postMessage(request);
|
try {
|
||||||
|
toPort.postMessage(request);
|
||||||
|
} catch (ex) {
|
||||||
|
this.onPortDisconnect(toPort);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'connectionBroken':
|
case 'connectionBroken':
|
||||||
|
Loading…
Reference in New Issue
Block a user