mirror of https://github.com/gorhill/uBlock.git
code review, fixes #383
This commit is contained in:
parent
d68f1624df
commit
a087190847
|
@ -251,7 +251,7 @@ vAPI.messaging.onPortMessage = function(request, port) {
|
||||||
if ( request.requestId !== undefined ) {
|
if ( request.requestId !== undefined ) {
|
||||||
callback = function(response) {
|
callback = function(response) {
|
||||||
// https://github.com/gorhill/uBlock/issues/383
|
// https://github.com/gorhill/uBlock/issues/383
|
||||||
if ( port.disconnected === true ) {
|
if ( vAPI.messaging.ports.hasOwnProperty(port.name) === false ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
port.postMessage({
|
port.postMessage({
|
||||||
|
@ -292,8 +292,6 @@ vAPI.messaging.onPortDisconnect = function(port) {
|
||||||
port.onDisconnect.removeListener(vAPI.messaging.onPortDisconnect);
|
port.onDisconnect.removeListener(vAPI.messaging.onPortDisconnect);
|
||||||
port.onMessage.removeListener(vAPI.messaging.onPortMessage);
|
port.onMessage.removeListener(vAPI.messaging.onPortMessage);
|
||||||
delete vAPI.messaging.ports[port.name];
|
delete vAPI.messaging.ports[port.name];
|
||||||
// https://github.com/gorhill/uBlock/issues/383
|
|
||||||
port.disconnected = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue